Prev: 9C2B Up: Map Next: 9C62
9C3C: 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 9C48 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 9C3C PUSH HL Stash the position on the stack.
9C3D CALL ScreenAddress Convert the position into a screen address.
9C40 LD A,(DE) Fetch the attribute from the start of the string.
9C41 EX AF,AF' Keep it as the attribute of every character of the string (in AF').
9C42 INC DE Move on to the first character.
9C43 EXX Switch to the shadow registers.
9C44 POP HL Restore the position from the stack.
9C45 CALL AttributeAddress Convert the position into an attribute buffer address.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop 9C48 EXX Switch to the shadow registers.
9C49 LD A,(DE) Fetch a character.
9C4A BIT 7,A Jump to PrintString_LastCharacter if this is the last character of the string (bit 7 is set).
9C4C JR NZ,PrintString_LastCharacter
9C4E CALL PrintScreen Print the character.
9C51 INC DE Move on to the next character.
9C52 EXX Switch to the shadow registers.
9C53 EX AF,AF' Fetch the attribute from AF'.
9C54 LD (HL),A Write it to the attribute buffer.
9C55 INC L Move on to the next cell.
9C56 EX AF,AF' Store the attribute in AF' again.
9C57 JR PrintString_Loop Jump back to PrintString_Loop.
PrintString_LastCharacter 9C59 AND $7F Clear bit 7 of the last character.
9C5B CALL PrintScreen Print the character.
9C5E EXX Switch to the shadow registers.
9C5F EX AF,AF' Fetch the attribute from AF'.
9C60 LD (HL),A Write it to the attribute buffer.
9C61 RET Return.
Prev: 9C2B Up: Map Next: 9C62