![]() |
Routines |
| Prev: B52D | Up: Map | Next: B563 |
|
Prints a string at the position given, which has its attribute as the first byte. The last character of the string has bit 7 set. The attribute is written to each of the positions of the characters.
|
||||||||||||||
| PrintStringColour | B53D | PUSH HL | Stash the position of the string on the stack. | |||||||||||
| B53E | CALL ScreenAddress | Convert the position into a screen address. | ||||||||||||
| B541 | LD A,(DE) | Fetch the attribute of the string. | ||||||||||||
| B542 | EX AF,AF' | Stash the attribute in the shadow AF register. | ||||||||||||
| B543 | INC DE | Move onto the text of the string. | ||||||||||||
| B544 | EXX | Switch to the shadow registers. | ||||||||||||
| B545 | POP HL | Restore the position of the string from the stack. | ||||||||||||
| B546 | CALL AttributeAddress | Convert the position into an attribute address. | ||||||||||||
|
This entry point is used by the routine at MenuWriteText.
|
||||||||||||||
| PrintString_Loop | B549 | EXX | Switch back to the normal registers. | |||||||||||
| B54A | LD A,(DE) | Fetch the next character of the string. | ||||||||||||
| B54B | BIT 7,A | Jump to PrintString_LastCharacter if this is the last character of the string (bit 7 is set). | ||||||||||||
| B54D | JR NZ,PrintString_LastCharacter | |||||||||||||
| B54F | CALL PrintScreen | Print the character. | ||||||||||||
| B552 | INC DE | Move onto the next character of the string. | ||||||||||||
| B553 | EXX | Switch to the shadow registers. | ||||||||||||
| B554 | EX AF,AF' | Fetch the attribute. | ||||||||||||
| B555 | LD (HL),A | Set the attribute of the character on the screen. | ||||||||||||
| B556 | INC L | Move onto the next column. | ||||||||||||
| B557 | EX AF,AF' | Stash the attribute in the shadow AF register. | ||||||||||||
| B558 | JR PrintString_Loop | Jump back to PrintString_Loop to print the next character. | ||||||||||||
|
Because the last character contains the terminator, it needs to be handled separately.
|
||||||||||||||
| PrintString_LastCharacter | B55A | AND %01111111 | Keep only bits 0-6 (i.e. strip the bit 7 terminator). | |||||||||||
| B55C | CALL PrintScreen | Print the last character of the string. | ||||||||||||
| B55F | EXX | Switch to the shadow registers. | ||||||||||||
| B560 | EX AF,AF' | Fetch the attribute. | ||||||||||||
| B561 | LD (HL),A | Set the attribute of the last character on the screen. | ||||||||||||
| B562 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: B52D | Up: Map | Next: B563 |