Prev: 33115 Up: Map Next: 33210
33145: Menu text PRINT routine
Used by the routines at 32825, 33051 and 33069.
Routine that prints a string of text for menu 1 (32825) and menu 2 (33051). The menu font used is the standard ZX Spectrum ROM character set, rather than the in-game text characters.
33145 LD DE,(35776) Get the address pointer for the address of the text to print (e.g. 35778/35994).
33149 LD A,(DE) Get first byte = length of text string
33150 INC DE Increment to start of text string, and store address
33151 LD (35776),DE
33155 LD (35773),A Store the length of string (number of characters)
33158 LD (35774),HL Store screen address position
Loop for printing the text characters on screen
33161 LD DE,(35776) Get the next text character to print
33165 LD A,(DE)
33166 INC DE Increment to next text character and store address for future printing
33167 LD (35776),DE
33171 LD HL,(23606) Get pointer to the ZX Spectrum character set (CHARS)
33174 LD D,0 Get the text character's ASCII value (store in DE register pair)
33176 LD E,A
33177 LD B,8 8 pixel rows to print
33179 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
33180 DJNZ 33179
33182 EX DE,HL
33183 LD HL,(35774) Get the screen address position
33186 LD C,H Preserve screen address of top pixel row in C register
33187 LD B,8 8 pixel lines to print
Draw the 8 pixel row bytes of the text character
33189 LD A,(DE) Get pixel row byte of character
33190 INC DE (and move pointer along to the next one)
33191 LD (HL),A Copy byte onto screen
33192 INC H Move down 1 pixel line
33193 DJNZ 33189 Repeat for 8 pixel rows to print full text character
Move on to the next character in the string and next screen position
33195 INC L Move one horizontal character position to the right...
33196 LD H,C Retrieve vertical screen address of top pixel row from C register and put into high byte of H register
33197 LD (35774),HL ...and store this screen address ready for next character
33200 LD A,(35773) Decrement and re-store the text length counter
33203 DEC A
33204 LD (35773),A
33207 JR NZ,33161 Repeat loop x number of characters in the text string
33209 RET
Prev: 33115 Up: Map Next: 33210