![]() |
Routines |
| Prev: 41427 | Up: Map | Next: 41497 |
|
Prints a string of characters, and sets the attribute of each character cell it uses. The string data starts with the attribute, followed by the characters, and bit 7 of the last character is set to mark the end of the string.
|
||||||||||||||
| PrintStringColour | 41459 | PUSH HL | Stash HL on the stack. | |||||||||||
| 41460 | CALL ScreenAddress | Call ScreenAddress to get the screen address. | ||||||||||||
| 41463 | LD A,(DE) | Fetch the attribute byte. | ||||||||||||
| 41464 | EX AF,AF' | Switch to the shadow AF register. | ||||||||||||
| 41465 | INC DE | Increment DE by one to point to the text of the string. | ||||||||||||
| 41466 | EXX | Switch to the shadow registers. | ||||||||||||
| 41467 | POP HL | Restore HL from the stack. | ||||||||||||
| 41468 | CALL AttributeAddress | Call AttributeAddress to get the attribute address. | ||||||||||||
|
This entry point is used by the routine at MenuWriteText.
|
||||||||||||||
| PrintString_Loop | 41471 | EXX | Switch back to the normal registers. | |||||||||||
| 41472 | LD A,(DE) | Fetch the character to print. | ||||||||||||
| 41473 | BIT 7,A | If bit 7 is set (which signifies the end of the string), jump to PrintString_LastCharacter. | ||||||||||||
| 41475 | JR NZ,PrintString_LastCharacter | |||||||||||||
| 41477 | CALL PrintScreen | Call PrintScreen to print the character. | ||||||||||||
| 41480 | INC DE | Move DE on to the next character of the string. | ||||||||||||
| 41481 | EXX | Switch to the shadow registers. | ||||||||||||
| 41482 | EX AF,AF' | Switch to the shadow AF register. | ||||||||||||
| 41483 | LD (HL),A | Copy the attribute byte to the screen. | ||||||||||||
| 41484 | INC L | Move L on to the next attribute cell. | ||||||||||||
| 41485 | EX AF,AF' | Switch to the shadow AF register. | ||||||||||||
| 41486 | JR PrintString_Loop | Jump back to PrintString_Loop to print the next character of the string. | ||||||||||||
|
Because the last character contains the terminator, it needs to be handled separately.
|
||||||||||||||
| PrintString_LastCharacter | 41488 | AND %01111111 | Keep only bits 0-6 (i.e. strip the bit 7 terminator). | |||||||||||
| 41490 | CALL PrintScreen | Call PrintScreen to print the character. | ||||||||||||
| 41493 | EXX | Switch to the shadow registers. | ||||||||||||
| 41494 | EX AF,AF' | Switch to the shadow AF register. | ||||||||||||
| 41495 | LD (HL),A | Copy the attribute byte to the screen. | ||||||||||||
| 41496 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 41427 | Up: Map | Next: 41497 |