Prev: B5AF Up: Map Next: B5EB
B5CB: Print Character
Prints a single character to the display file, at a character position.
Before After
print-character-before print-character-after
Input
A Character code
HL Screen address
Output
HL Screen address of the next column
PrintScreen B5CB PUSH BC Save the registers.
B5CC PUSH DE
B5CD PUSH HL
B5CE LD L,A Multiply the character code by 08, using doubling.
B5CF LD H,$00
B5D1 ADD HL,HL
B5D2 ADD HL,HL
B5D3 ADD HL,HL
B5D4 LD DE,($9618) Add the address of the current character set.
B5D8 ADD HL,DE
B5D9 EX DE,HL Point DE at the graphics of the character.
B5DA POP HL Restore the screen address.
B5DB LD B,$08 There are 08 pixel rows in a character.
PrintScreen_Row B5DD LD A,(DE) Fetch a pixel row of the character.
B5DE LD (HL),A Write it to the screen.
B5DF INC DE Move on to the next pixel row of the character.
B5E0 INC H Move down to the next pixel row on the screen.
B5E1 DJNZ PrintScreen_Row Loop back until the whole character has been printed.
B5E3 POP DE Restore the registers.
B5E4 POP BC
B5E5 LD A,H Move back up to the top of the character.
B5E6 SUB $08
B5E8 LD H,A
B5E9 INC L Move on to the next column.
B5EA RET Return.
Prev: B5AF Up: Map Next: B5EB