Prev: 64F0 Up: Map Next: 653E
6518: Print Colour String
Used by the routines at CreateWindow, DisplayNightDriver and 6A9B.
Input
DE Pointer to string data
PrintStringColour 6518 PUSH HL Stash HL on the stack.
6519 CALL ScreenAddress Call ScreenAddress.
651C LD A,(DE) Fetch the attribute byte.
651D EX AF,AF' Switch to the shadow AF register.
651E INC DE Increment DE by one to point to the text of the string.
This entry point is used by the routines at DisplayPlaceName and DisplayNightDriver.
PrintStringColour_0 651F EXX Switch to the shadow registers.
6520 POP HL Restore HL from the stack.
6521 CALL AttributeAddress Call AttributeAddress.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop 6524 EXX Switch back to the normal registers.
6525 LD A,(DE) Fetch the character to print.
6526 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
6528 JR NZ,PrintString_LastCharacter
652A CALL PrintScreen Call PrintScreen.
652D INC DE Increment DE by one.
652E EXX Switch to the shadow registers.
652F EX AF,AF' Switch to the shadow AF register.
6530 LD (HL),A Copy the attribute byte to the screen.
6531 INC L Increment L by one.
6532 EX AF,AF' Switch to the shadow AF register.
6533 JR PrintString_Loop Jump to PrintString_Loop.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter 6535 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
6537 CALL PrintScreen Call PrintScreen.
653A EXX Switch to the shadow registers.
653B EX AF,AF' Switch to the shadow AF register.
653C LD (HL),A Copy the attribute byte to the screen.
653D RET Return.
View the equivalent code in;
Prev: 64F0 Up: Map Next: 653E