Prev: BBB1 Up: Map Next: BC15
BBEB: Print a character into the screen buffer
Used by the routines at PRINT_LIVES and PRINT_TEXT.
A character is eight bytes from FONT_BASE plus eight times its code, the top row first; they overwrite eight rows of the buffer going down from HL (32 bytes a row, down being towards the start of the buffer). HL comes back one byte to the right, on the same top row, ready for the next character. A space is printed as code $3D, whose glyph is blank.
For text FONT_BASE is 384 bytes below the font (PRINT_TEXT_SINGLE_COLOUR), so the codes $30 to $5A land in it; for numbers it is the font itself (PRINT_BCD_NUMBER, in PRINT_LIVES), so that digits are codes 0 to 9. The light years (PRINT_ROLLING_DIGIT) come in at PRINT_GLYPH with HL already eight times the code.
Input
A the code
HL the buffer address of the character's top row
Output
HL one byte to the right
PRINT_CHAR BBEB CP $20 a space is code $3D
BBED JR NZ,PRINT_CHAR_0
BBEF LD A,$3D
PRINT_CHAR_0 BBF1 PUSH BC HL = 8 * the code
BBF2 PUSH DE
BBF3 PUSH HL
BBF4 LD L,A
BBF5 LD H,$00
BBF7 ADD HL,HL
BBF8 ADD HL,HL
BBF9 ADD HL,HL
This entry point is used by the routine at PRINT_ROLLING_DIGIT.
PRINT_GLYPH BBFA LD DE,(FONT_BASE) DE = FONT_BASE + HL, the glyph
BBFE ADD HL,DE
BBFF EX DE,HL
BC00 POP HL eight rows, each written 32 bytes below the one before
BC01 LD B,$08
PRINT_CHAR_1 BC03 LD A,(DE)
BC04 LD (HL),A
BC05 INC DE
BC06 PUSH BC
BC07 LD BC,$FFE0
BC0A ADD HL,BC
BC0B POP BC
BC0C DJNZ PRINT_CHAR_1
BC0E POP DE back up the eight rows and one byte right
BC0F LD BC,$0101
BC12 ADD HL,BC
BC13 POP BC
BC14 RET
Prev: BBB1 Up: Map Next: BC15