![]() |
Routines |
| Prev: 815B | Up: Map | Next: 81BA |
|
Routine that prints a string of text for menu 1 (8039) and menu 2 (811B). The menu font used is the standard ZX Spectrum ROM character set, rather than the in-game text characters.
|
||||
| 8179 | LD DE,($8BC0) | Get the address pointer for the address of the text to print (e.g. 8BC2/8C9A). | ||
| 817D | LD A,(DE) | Get first byte = length of text string | ||
| 817E | INC DE | Increment to start of text string, and store address | ||
| 817F | LD ($8BC0),DE | |||
| 8183 | LD ($8BBD),A | Store the length of string (number of characters) | ||
| 8186 | LD ($8BBE),HL | Store screen address position | ||
|
Loop for printing the text characters on screen
|
||||
| 8189 | LD DE,($8BC0) | Get the next text character to print | ||
| 818D | LD A,(DE) | |||
| 818E | INC DE | Increment to next text character and store address for future printing | ||
| 818F | LD ($8BC0),DE | |||
| 8193 | LD HL,($5C36) | Get pointer to the ZX Spectrum character set (CHARS) | ||
| 8196 | LD D,$00 | Get the text character's ASCII value (store in DE register pair) | ||
| 8198 | LD E,A | |||
| 8199 | LD B,$08 | 8 pixel rows to print | ||
| 819B | ADD HL,DE | Calculate the address of the character in the character set ready to print [CHARS address + (character ASCII value x 8)] and swap into DE | ||
| 819C | DJNZ $819B | |||
| 819E | EX DE,HL | |||
| 819F | LD HL,($8BBE) | Get the screen address position | ||
| 81A2 | LD C,H | Preserve screen address of top pixel row in C register | ||
| 81A3 | LD B,$08 | 8 pixel lines to print | ||
|
Draw the 8 pixel row bytes of the text character
|
||||
| 81A5 | LD A,(DE) | Get pixel row byte of character | ||
| 81A6 | INC DE | (and move pointer along to the next one) | ||
| 81A7 | LD (HL),A | Copy byte onto screen | ||
| 81A8 | INC H | Move down 1 pixel line | ||
| 81A9 | DJNZ $81A5 | Repeat for 8 pixel rows to print full text character | ||
|
Move on to the next character in the string and next screen position
|
||||
| 81AB | INC L | Move one horizontal character position to the right... | ||
| 81AC | LD H,C | Retrieve vertical screen address of top pixel row from C register and put into high byte of H register | ||
| 81AD | LD ($8BBE),HL | ...and store this screen address ready for next character | ||
| 81B0 | LD A,($8BBD) | Decrement and re-store the text length counter | ||
| 81B3 | DEC A | |||
| 81B4 | LD ($8BBD),A | |||
| 81B7 | JR NZ,$8189 | Repeat loop x number of characters in the text string | ||
| 81B9 | RET | |||
| Prev: 815B | Up: Map | Next: 81BA |