Prev: 48514 Up: Map Next: 48589
48537: 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 48537 PUSH HL Use the ROM character set.
48538 LD HL,(23606)
48541 LD (38424),HL
48544 POP HL
This entry point is used by the routine at DrawGameScreen.
This entry point uses the current character set.
PrintStringColour_CustomFont 48545 PUSH HL Find the address of the display file using ScreenAddress.
48546 CALL ScreenAddress
48549 LD A,(DE) Fetch the attribute from the string and keep it in A'...
48550 EX AF,AF'
48551 INC DE ...and move on to the first character.
48552 EXX Switch to the alternate registers and find the address of the attributes using AttributeAddress.
48553 POP HL
48554 CALL AttributeAddress
This entry point is used by the routine at PrintText.
PrintStringColour_Loop 48557 EXX Switch back to the main registers.
48558 LD A,(DE) Fetch a character.
48559 BIT 7,A Jump if it is the last one.
48561 JR NZ,PrintStringColour_Last
48563 PUSH DE Save the address of the string.
48564 CALL PrintScreen Print the character using PrintScreen.
48567 POP DE Restore the address of the string...
48568 INC DE ...and move on to the next character.
48569 EXX Switch to the alternate registers.
48570 EX AF,AF' Fetch the attribute...
48571 LD (HL),A ...and set it...
48572 INC L ...and move on to the next cell...
48573 EX AF,AF' ...keeping the attribute.
48574 JR PrintStringColour_Loop Loop back to print the next character.
PrintStringColour_Last 48576 AND 127 Clear bit 7 of the last character.
48578 PUSH DE Save the address of the string.
48579 CALL PrintScreen Print the character.
48582 POP DE Restore the address of the string.
48583 INC DE Move on to the next character.
48584 EXX Switch to the alternate registers.
48585 EX AF,AF' Fetch the attribute...
48586 LD (HL),A ...and set it for the last cell.
48587 EXX Switch back to the main registers.
48588 RET Return.
View the equivalent code in;
Prev: 48514 Up: Map Next: 48589