Prev: E2D0 Up: Map Next: E336
E2FA: Character/text printing
Used by the routine at E2D0.
Input
A Offset for letter to print, e.g. 0 = A, 1 = B (see 6D24)
This routine is used at E0C2 to print a single text character. It allows for text to be printed at any pixel line (rather than starting from the top of an 8x8 pixel square).
The character set text graphics are stored at 6D24.
E2FA LD HL,$6D24 Start address of character set ('A')
E2FD LD D,$00 Load DE with offset of character (0 = A, 1 = B, 2 = C etc.)
E2FF LD E,A Outer loop counter
E300 LD B,$08 8 bytes in each character
E302 ADD HL,DE Add offset to base address
E303 DJNZ $E302 ...and repeat 8 times (x8) to find the address of the character to print
E305 EX DE,HL Character address now stored in DE
E306 LD HL,($EAA4) ...Get screen display address (???) to print text at
E309 LD C,H Store high byte in C for retrieval later
E30A LD B,$08 8 pixel row bytes to print
E30C LD A,(DE) Get first byte of letter graphic
E30D INC DE Move to the next byte for later
E30E LD (HL),A Print byte onto screen
E30F LD A,H Get the high byte of the screen address
E310 AND $07 Look at the pixel row of the line (0-7)
E312 INC A Increment and check if it's gone over to the next character row
E313 CP $08
E315 JR NZ,$E321
E317 LD A,H Get the high byte of the display address
E318 AND $F8 Sets the pixel line in the character row to 0 as we're into a new character row
E31A LD H,A ...and restore back to H (high byte of display address)
E31B LD A,L Move the low byte of the display address to the next character row down, and store
E31C ADD A,$20
E31E LD L,A
E31F JR $E322 INC H in next line of code can now be skipped as HL contains the correct display address position
Jump in from E315, where the pixel row is still 0-7 (same character row) so can just increment the high byte of display address (H register) to get to the right place:
E321 INC H
E322 DJNZ $E30C Repeat printing pixel rows until all 8 bytes of the character are printed on screen
E324 LD A,L Restore L (the low byte of the screen address) to its starting column position + 1, i.e. 1 character to the right, ready to print the next letter
E325 SUB $1F
E327 LD L,A
E328 LD H,C ..and also restore H (the high byte) to its starting position
E329 LD ($EAA4),HL ...and store display address position ready to print next character.
Letter/character has been printed
E32C LD A,($EAA3) Decrement the 'number-of-letters-to-print' counter (columns) (I think)
E32F DEC A
E330 LD ($EAA3),A
E333 JR NZ,$E2E0 Continue printing until finished
E335 RET
Prev: E2D0 Up: Map Next: E336