Prev: 29800 Up: Map Next: 29870
29832: Print Colour String
Used by the routines at DrawPantry, GameMenu, GameOver_1UP_Messaging and PrintBanner.
Prints a string of text, in colour, at the given position. The first byte of the string is the colour attribute, followed by the characters of the text. The last character of the string has bit 7 set.
Input
DE Pointer to string data
HL Pixel co-ordinates (horizontal in L, vertical in H)
PrintStringColour 29832 PUSH HL Save the position of the string on the stack.
29833 CALL ScreenAddress Convert the pixel co-ordinates into a screen buffer address using ScreenAddress.
29836 LD A,(DE) Fetch the attribute byte.
29837 EX AF,AF' Switch to the shadow AF register.
29838 INC DE Move on to the text of the string.
29839 EXX Switch to the shadow registers.
29840 POP HL Restore the position of the string from the stack.
29841 CALL AttributeAddress Calculate the attribute buffer address using AttributeAddress.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop 29844 EXX Switch back to the normal registers.
29845 LD A,(DE) Fetch the character to print.
29846 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
29848 JR NZ,PrintString_LastCharacter
29850 CALL PrintScreen Print the character using PrintScreen.
29853 INC DE Move on to the next character of the string.
29854 EXX Switch to the shadow registers.
29855 EX AF,AF' Switch to the shadow AF register.
29856 LD (HL),A Write the colour to the attribute buffer.
29857 INC L Move on to the next attribute cell.
29858 EX AF,AF' Switch to the shadow AF register.
29859 JR PrintString_Loop Jump to PrintString_Loop.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter 29861 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
29863 CALL PrintScreen Print the last character using PrintScreen.
29866 EXX Switch to the shadow registers.
29867 EX AF,AF' Switch to the shadow AF register.
29868 LD (HL),A Write the colour to the attribute buffer.
29869 RET Return.
Prev: 29800 Up: Map Next: 29870