Prev: 46381 Up: Map Next: 46435
46397: Print Colour String
Used by the routines at DisplayPoem, GameOver_1UP and PrintBanner.
Input
DE Pointer to string data
PrintStringColour 46397 PUSH HL Stash HL on the stack.
46398 CALL ScreenAddress Call ScreenAddress.
46401 LD A,(DE) Fetch the attribute byte.
46402 EX AF,AF' Switch to the shadow AF register.
46403 INC DE Increment DE by one to point to the text of the string.
46404 EXX Switch to the shadow registers.
46405 POP HL Restore HL from the stack.
46406 CALL AttributeAddress Call AttributeAddress.
This entry point is used by the routine at MenuWriteText.
PrintString_Loop 46409 EXX Switch back to the normal registers.
46410 LD A,(DE) Fetch the character to print.
46411 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
46413 JR NZ,PrintString_LastCharacter
46415 CALL PrintScreen Call PrintScreen.
46418 INC DE Increment DE by one.
46419 EXX Switch to the shadow registers.
46420 EX AF,AF' Switch to the shadow AF register.
46421 LD (HL),A Copy the attribute byte to the screen.
46422 INC L Increment L by one.
46423 EX AF,AF' Switch to the shadow AF register.
46424 JR PrintString_Loop Jump to PrintString_Loop.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter 46426 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
46428 CALL PrintScreen Call PrintScreen.
46431 EXX Switch to the shadow registers.
46432 EX AF,AF' Switch to the shadow AF register.
46433 LD (HL),A Copy the attribute byte to the screen.
46434 RET Return.
View the equivalent code in;
Prev: 46381 Up: Map Next: 46435