![]() |
Routines |
| Prev: C97A | Up: Map | Next: CA1B |
|
Used by the routine at DisplayMenu.
Prints a string in the main font, at a position given in pixels measured from the bottom left of the screen. The string ends with a character that has bit 7 set. The attribute for the whole string is in AF', unless the string is printed by entering at PrintStringWithAttribute, which takes the attribute from the first byte of the string.
|
||||||||||||||
|
Set the font and find the screen address.
|
||||||||||||||
| PrintString | C9EF | PUSH HL | Stash the position on the stack. | |||||||||||
| C9F0 | LD HL,$6B5E | Write 6B5E to FontPointer. | ||||||||||||
| C9F3 | LD ($BBAC),HL | |||||||||||||
| C9F6 | POP HL | Restore the position from the stack. | ||||||||||||
| C9F7 | CALL CalculateScreenAddress | Call CalculateScreenAddress. | ||||||||||||
| C9FA | JR PrintString_Loop | Jump to PrintString_Loop. | ||||||||||||
| PrintStringWithAttribute | C9FC | PUSH HL | Stash the position on the stack. | |||||||||||
| C9FD | LD HL,$6B5E | Write 6B5E to FontPointer. | ||||||||||||
| CA00 | LD ($BBAC),HL | |||||||||||||
| CA03 | POP HL | Restore the position from the stack. | ||||||||||||
| CA04 | CALL CalculateScreenAddress | Call CalculateScreenAddress. | ||||||||||||
| CA07 | LD A,(DE) | Fetch the attribute. | ||||||||||||
| CA08 | INC DE | Move on to the string. | ||||||||||||
| CA09 | EX AF,AF' | Keep the attribute in AF'. | ||||||||||||
|
Print each character of the string.
|
||||||||||||||
| PrintString_Loop | CA0A | LD A,(DE) | Fetch the next character. | |||||||||||
| CA0B | INC DE | Move on to the next character. | ||||||||||||
| CA0C | BIT 7,A | Jump to PrintString_Last if it is the last one. | ||||||||||||
| CA0E | JR NZ,PrintString_Last | |||||||||||||
| CA10 | CALL PrintCharacterWithAttribute | Call PrintCharacterWithAttribute. | ||||||||||||
| CA13 | INC L | Move on to the next position. | ||||||||||||
| CA14 | JR PrintString_Loop | Jump to PrintString_Loop. | ||||||||||||
|
Print the last character.
|
||||||||||||||
| PrintString_Last | CA16 | AND %01111111 | Keep bits 0 to 6. | |||||||||||
| CA18 | JP PrintCharacterWithAttribute | Jump to PrintCharacterWithAttribute. | ||||||||||||
| Prev: C97A | Up: Map | Next: CA1B |