![]() |
Routines |
| Prev: 41179 | Up: Map | Next: 41289 |
|
Used by the routines at PrintTextRepeatedly, CompletePlanet, AddToScore, PrintShipsRemaining, PrintPlayer and GameOver.
Prints a line of text. The text is held in a record made of the horizontal pixel position, the vertical pixel position, the attribute, the number of characters and then the characters. Bit 7 of the attribute makes the text wide.
|
|||||||||||||
| PrintText | 41237 | XOR A | Select normal characters. | ||||||||||
| 41238 | LD (41162),A | Change the instruction at PrintCharacter_Mode to match. | |||||||||||
| 41241 | LD A,(DE) | Fetch the horizontal position. | |||||||||||
| 41242 | LD L,A | ||||||||||||
| 41243 | INC DE | Move on to the vertical position. | |||||||||||
| 41244 | LD A,(DE) | Fetch the vertical position. | |||||||||||
| 41245 | LD H,A | Move on to the attribute. | |||||||||||
| 41246 | INC DE | Save the address of the attribute. | |||||||||||
| 41247 | PUSH DE | Save the position. | |||||||||||
| 41248 | PUSH HL | Find the screen address. | |||||||||||
| 41249 | CALL GetScreenAddress | ||||||||||||
| 41252 | EXX | Switch to the attribute registers. | |||||||||||
| 41253 | POP HL | Restore the position. | |||||||||||
| 41254 | CALL AttributeAddress | Find the attribute address. | |||||||||||
| 41257 | POP DE | Restore the address of the attribute. | |||||||||||
| 41258 | LD A,(DE) | Fetch the attribute. | |||||||||||
| 41259 | BIT 7,A | Jump to PrintText_Attribute if the text is not wide. | |||||||||||
| 41261 | JR Z,PrintText_Attribute | ||||||||||||
| 41263 | LD A,16 | Select wide characters. | |||||||||||
| 41265 | LD (41162),A | Change the instruction at PrintCharacter_Mode to match. | |||||||||||
| 41268 | LD A,(DE) | Fetch the attribute again. | |||||||||||
| 41269 | AND %01111111 | Remove the flag. | |||||||||||
| 41271 | LD DE,32 | Set the offset between rows of attributes. | |||||||||||
| PrintText_Attribute | 41274 | LD B,A | Store the attribute. | ||||||||||
| 41275 | EXX | Switch back to the screen registers. | |||||||||||
| 41276 | INC DE | Move on to the number of characters. | |||||||||||
| 41277 | LD A,(DE) | Fetch it. | |||||||||||
| 41278 | LD B,A | Store it in B. | |||||||||||
| PrintText_Loop | 41279 | PUSH BC | Save the number of characters. | ||||||||||
| 41280 | INC DE | Move on to the next character. | |||||||||||
| 41281 | CALL PrintCharacter | Print the character. | |||||||||||
| 41284 | POP BC | Restore the number of characters. | |||||||||||
| 41285 | DJNZ PrintText_Loop | Loop back to PrintText_Loop for each character. | |||||||||||
| 41287 | INC DE | Move on to the byte after the record. | |||||||||||
| 41288 | RET | Return. | |||||||||||
| Prev: 41179 | Up: Map | Next: 41289 |