Prev: A1D3 Up: Map Next: A219
A1F3: Print Colour String
Used by the routines at GameMenu, GameOver, GameStats and GameComplete.
Prints a string of characters, and sets the attribute of each character cell it uses. The string data starts with the attribute, followed by the characters, and bit 7 of the last character is set to mark the end of the string.
Before After
print-string-before print-string-after
Input
DE Pointer to string data
HL The position (the Y position in H and the X position in L)
PrintStringColour A1F3 PUSH HL Stash HL on the stack.
A1F4 CALL ScreenAddress Call ScreenAddress to get the screen address.
A1F7 LD A,(DE) Fetch the attribute byte.
A1F8 EX AF,AF' Switch to the shadow AF register.
A1F9 INC DE Increment DE by one to point to the text of the string.
A1FA EXX Switch to the shadow registers.
A1FB POP HL Restore HL from the stack.
A1FC CALL AttributeAddress Call AttributeAddress to get the attribute address.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop A1FF EXX Switch back to the normal registers.
A200 LD A,(DE) Fetch the character to print.
A201 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
A203 JR NZ,PrintString_LastCharacter
A205 CALL PrintScreen Call PrintScreen to print the character.
A208 INC DE Move DE on to the next character of the string.
A209 EXX Switch to the shadow registers.
A20A EX AF,AF' Switch to the shadow AF register.
A20B LD (HL),A Copy the attribute byte to the screen.
A20C INC L Move L on to the next attribute cell.
A20D EX AF,AF' Switch to the shadow AF register.
A20E JR PrintString_Loop Jump back to PrintString_Loop to print the next character of the string.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter A210 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
A212 CALL PrintScreen Call PrintScreen to print the character.
A215 EXX Switch to the shadow registers.
A216 EX AF,AF' Switch to the shadow AF register.
A217 LD (HL),A Copy the attribute byte to the screen.
A218 RET Return.
Prev: A1D3 Up: Map Next: A219