Prev: BD82 Up: Map Next: BDCD
BD99: Print Colour String
Used by the routine at ShowGameOver.
Prints a string using the ROM character set. The first byte of the string is the attribute of the text.
Before After
print-colour-string-before print-colour-string-after
Input
DE Address of the string, which starts with an attribute
HL Pixel position of the start of the text (L is x and H is y)
PrintStringColour BD99 PUSH HL Use the ROM character set.
BD9A LD HL,($5C36)
BD9D LD ($9618),HL
BDA0 POP HL
This entry point is used by the routine at DrawGameScreen.
This entry point uses the current character set.
PrintStringColour_CustomFont BDA1 PUSH HL Find the address of the display file using ScreenAddress.
BDA2 CALL ScreenAddress
BDA5 LD A,(DE) Fetch the attribute from the string and keep it in A'...
BDA6 EX AF,AF'
BDA7 INC DE ...and move on to the first character.
BDA8 EXX Switch to the alternate registers and find the address of the attributes using AttributeAddress.
BDA9 POP HL
BDAA CALL AttributeAddress
This entry point is used by the routine at PrintText.
PrintStringColour_Loop BDAD EXX Switch back to the main registers.
BDAE LD A,(DE) Fetch a character.
BDAF BIT 7,A Jump if it is the last one.
BDB1 JR NZ,PrintStringColour_Last
BDB3 PUSH DE Save the address of the string.
BDB4 CALL PrintScreen Print the character using PrintScreen.
BDB7 POP DE Restore the address of the string...
BDB8 INC DE ...and move on to the next character.
BDB9 EXX Switch to the alternate registers.
BDBA EX AF,AF' Fetch the attribute...
BDBB LD (HL),A ...and set it...
BDBC INC L ...and move on to the next cell...
BDBD EX AF,AF' ...keeping the attribute.
BDBE JR PrintStringColour_Loop Loop back to print the next character.
PrintStringColour_Last BDC0 AND $7F Clear bit 7 of the last character.
BDC2 PUSH DE Save the address of the string.
BDC3 CALL PrintScreen Print the character.
BDC6 POP DE Restore the address of the string.
BDC7 INC DE Move on to the next character.
BDC8 EXX Switch to the alternate registers.
BDC9 EX AF,AF' Fetch the attribute...
BDCA LD (HL),A ...and set it for the last cell.
BDCB EXX Switch back to the main registers.
BDCC RET Return.
View the equivalent code in;
Prev: BD82 Up: Map Next: BDCD