Prev: 29004 Up: Map Next: 29074
29036: Print String
Used by the routines at PlayerReset, GameMenu and PrintBanner.
Input
DE Pointer to string data
PrintString 29036 PUSH HL Stash HL on the stack.
29037 CALL ScreenAddress Call ScreenAddress.
29040 LD A,(DE) Fetch the attribute byte.
29041 EX AF,AF' Switch to the shadow AF register.
29042 INC DE Increment DE by one to point to the text of the string.
29043 EXX Switch to the shadow registers.
29044 POP HL Restore HL' from the stack.
29045 CALL AttributeAddress Call AttributeAddress.
This entry point is used by the routine at PrintMenuItem.
PrintString_Loop 29048 EXX Switch back to the normal registers.
29049 LD A,(DE) Fetch the character to print.
29050 BIT 7,A If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter.
29052 JR NZ,PrintString_LastCharacter
29054 CALL PrintScreen Call PrintScreen.
29057 INC DE Increment DE by one.
29058 EXX Switch to the shadow registers.
29059 EX AF,AF' Switch to the shadow AF register.
29060 LD (HL),A Copy the attribute byte to the screen.
29061 INC L Increment L by one.
29062 EX AF,AF' Switch to the shadow AF register.
29063 JR PrintString_Loop Jump to PrintString_Loop.
Because the last character contains the terminator, it needs to be handled separately.
PrintString_LastCharacter 29065 AND %01111111 Keep only bits 0-6 (i.e. strip the bit 7 terminator).
29067 CALL PrintScreen Call PrintScreen.
29070 EXX Switch to the shadow registers.
29071 EX AF,AF' Switch to the shadow AF register.
29072 LD (HL),A Copy the attribute byte to the screen.
29073 RET Return.
View the equivalent code in;
Prev: 29004 Up: Map Next: 29074