Prev: 64F0 Up: Map Next: 653E
6518: Print Colour String
Used by the routines at CreateWindow, DisplayNightDriver and HandlerPlayer.
Prints a string of characters and sets the attribute of each one. The first byte of the string is the attribute and the last character of the string has bit 7 set.
Before After
print-colour-string-before print-colour-string-after
Input
HL Pixel co-ordinates (H is the Y position, L the X position)
DE Pointer to string data
PrintStringColour 6518 PUSH HL Stash the pixel co-ordinates on the stack.
6519 CALL ScreenAddress Convert them to a screen address using ScreenAddress.
651C LD A,(DE) Fetch the attribute from the first byte of the string.
651D EX AF,AF' Keep the attribute in the shadow AF register.
651E INC DE Increment DE by one to point to the text of the string.
This entry point is used by the routines at DisplayPlaceName and DisplayNightDriver.
PrintStringColour_UseAttribute 651F EXX Switch to the shadow registers.
6520 POP HL Restore the pixel co-ordinates from the stack.
6521 CALL AttributeAddress Find the attribute address of the cell using AttributeAddress.
This entry point is used by the routine at MenuWriteText.
Print each character, and set its attribute.
PrintString_Loop 6524 EXX Switch back to the normal registers.
6525 LD A,(DE) Fetch the character to print.
6526 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
6528 JR NZ,PrintString_LastCharacter
652A CALL PrintScreen Print the character using PrintScreen.
652D INC DE Move on to the next character of the string.
652E EXX Switch to the shadow registers.
652F EX AF,AF' Switch to the shadow AF register.
6530 LD (HL),A Copy the attribute byte to the screen.
6531 INC L Move on to the next cell on the row.
6532 EX AF,AF' Switch to the shadow AF register.
6533 JR PrintString_Loop Jump to PrintString_Loop.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter 6535 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
6537 CALL PrintScreen Print the last character using PrintScreen.
653A EXX Switch to the shadow registers.
653B EX AF,AF' Switch to the shadow AF register.
653C LD (HL),A Copy the attribute byte to the screen.
653D RET Return.
Prev: 64F0 Up: Map Next: 653E