Prev: 39979 Up: Map Next: 40034
39996: Print Colour String
Used by the routines at GameMenu, Show_Game_Over and Show_Ending_Screen.
Prints a string whose first byte is the attribute for every character. The last character of the string has bit 7 set. Entering at 40008 prints the characters with the attribute that is already in AF'.
Before After PrintStringColour
colour-string-before colour-string-after
Input
HL Position (L is the x position, H is the y position)
DE Pointer to the string
PrintStringColour 39996 PUSH HL Stash the position on the stack.
39997 CALL ScreenAddress Convert the position into a screen address.
40000 LD A,(DE) Fetch the attribute from the start of the string.
40001 EX AF,AF' Keep it as the attribute of every character of the string (in AF').
40002 INC DE Move on to the first character.
40003 EXX Switch to the shadow registers.
40004 POP HL Restore the position from the stack.
40005 CALL AttributeAddress Convert the position into an attribute buffer address.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop 40008 EXX Switch to the shadow registers.
40009 LD A,(DE) Fetch a character.
40010 BIT 7,A Jump to PrintString_LastCharacter if this is the last character of the string (bit 7 is set).
40012 JR NZ,PrintString_LastCharacter
40014 CALL PrintScreen Print the character.
40017 INC DE Move on to the next character.
40018 EXX Switch to the shadow registers.
40019 EX AF,AF' Fetch the attribute from AF'.
40020 LD (HL),A Write it to the attribute buffer.
40021 INC L Move on to the next cell.
40022 EX AF,AF' Store the attribute in AF' again.
40023 JR PrintString_Loop Jump back to PrintString_Loop.
PrintString_LastCharacter 40025 AND 127 Clear bit 7 of the last character.
40027 CALL PrintScreen Print the character.
40030 EXX Switch to the shadow registers.
40031 EX AF,AF' Fetch the attribute from AF'.
40032 LD (HL),A Write it to the attribute buffer.
40033 RET Return.
Prev: 39979 Up: Map Next: 40034