![]() |
Routines |
| Prev: 25948 | Up: Map | Next: 26011 |
|
Used by the routines at Lose_Life, Start_Level, MainMenu, PrintScore, SetUp_NextLevel and PrintMessage_Loop.
|
||||||||||
| PrintCharacter | 25985 | PUSH HL | Stash the screen buffer pointer on the stack. | |||||||
| 25986 | LD DE,(23606) | DE=*CHARS. | ||||||||
|
Font data starts at character 32 (ASCII "SPACE"), so this allows us to reference the data from a zero index.
|
||||||||||
| 25990 | SUB 32 | Subtract 32 from the ASCII character input. | ||||||||
|
CHARS points 256 bytes before the actual font data, so incrementing D adds 256 to compensate.
|
||||||||||
| 25992 | INC D | Increment D by one (add 256 to DE). | ||||||||
| 25993 | LD L,A | Set the ASCII character to print in HL. | ||||||||
| 25994 | LD H,0 | |||||||||
|
Each ASCII character is 8 bytes of data, so this translates the character ID into the offset.
|
||||||||||
| 25996 | ADD HL,HL | Multiply HL by 8 and add the base font address. | ||||||||
| 25997 | ADD HL,HL | |||||||||
| 25998 | ADD HL,HL | |||||||||
| 25999 | ADD HL,DE | |||||||||
| 26000 | EX DE,HL | DE now points to the character font data. | ||||||||
| 26001 | POP HL | Restore the screen buffer pointer from the stack into HL. | ||||||||
| 26002 | LD B,8 | Set a line counter in B (8 lines in a UDG). | ||||||||
| PrintCharacter_LineLoop | 26004 | LD A,(DE) | Copy the UDG data to the screen buffer. | |||||||
| 26005 | LD (HL),A | |||||||||
| 26006 | INC H | Move down one pixel line in the screen buffer. | ||||||||
| 26007 | INC DE | Move to the next UDG graphic data byte. | ||||||||
| 26008 | DJNZ PrintCharacter_LineLoop | Decrease the line counter by one and loop back to PrintCharacter_LineLoop until all 8 lines of the UDG character have been drawn. | ||||||||
| 26010 | RET | Return. | ||||||||
| Prev: 25948 | Up: Map | Next: 26011 |