Prev: 7468 Up: Map Next: 74AE
7488: 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 7488 PUSH HL Save the position of the string on the stack.
7489 CALL ScreenAddress Convert the pixel co-ordinates into a screen buffer address using ScreenAddress.
748C LD A,(DE) Fetch the attribute byte.
748D EX AF,AF' Switch to the shadow AF register.
748E INC DE Move on to the text of the string.
748F EXX Switch to the shadow registers.
7490 POP HL Restore the position of the string from the stack.
7491 CALL AttributeAddress Calculate the attribute buffer address using AttributeAddress.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop 7494 EXX Switch back to the normal registers.
7495 LD A,(DE) Fetch the character to print.
7496 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
7498 JR NZ,PrintString_LastCharacter
749A CALL PrintScreen Print the character using PrintScreen.
749D INC DE Move on to the next character of the string.
749E EXX Switch to the shadow registers.
749F EX AF,AF' Switch to the shadow AF register.
74A0 LD (HL),A Write the colour to the attribute buffer.
74A1 INC L Move on to the next attribute cell.
74A2 EX AF,AF' Switch to the shadow AF register.
74A3 JR PrintString_Loop Jump to PrintString_Loop.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter 74A5 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
74A7 CALL PrintScreen Print the last character using PrintScreen.
74AA EXX Switch to the shadow registers.
74AB EX AF,AF' Switch to the shadow AF register.
74AC LD (HL),A Write the colour to the attribute buffer.
74AD RET Return.
Prev: 7468 Up: Map Next: 74AE