Prev: B563 Up: Map Next: B5A9
B589: Print Character
Input
A ASCII value to print
HL Screen address
PrintScreen B589 PUSH BC Stash BC, DE and HL on the stack.
B58A PUSH DE
B58B PUSH HL
B58C LD L,A Create an offset in HL.
B58D LD H,$00
B58F ADD HL,HL Calculate offset for ASCII character (HL=HL * 8).
B590 ADD HL,HL
B591 ADD HL,HL
B592 LD DE,($5C36) DE=CHARS.
B596 ADD HL,DE DE=HL + 3C00. For examples of usage;
Letter ASCII Value * 8 (offset) CHARS + offset
"U" 55 02A8 3EA8
"L" 4C 0260 3E60
"T" 54 02A0 3EA0
"I" 49 0248 3E48
"M" 4D 0268 3E68
"A" 41 0208 3E08
"T" 54 02A0 3EA0
"E" 45 0228 3E28
B597 EX DE,HL
Print the character to the screen.
B598 POP HL Restore HL, containing the screen buffer location, from the stack.
This entry point is used by the routine at DisplayPlayerLives.
PrintScreen_0 B599 LD B,$08 B=08 (08 rows of pixels).
PrintScreen_Loop B59B LD A,(DE) Copy a byte from the font data to the screen buffer.
B59C LD (HL),A
B59D INC DE Increment the font data by one.
B59E INC H Move onto the next pixel line.
B59F DJNZ PrintScreen_Loop Decrease counter by one and loop back to PrintScreen_Loop until counter is zero.
B5A1 POP DE Restore DE and BC from the stack.
B5A2 POP BC
Reset HL and move to the next column, ready to print the next character.
B5A3 LD A,H H=H - 08 (reset the display line).
B5A4 SUB $08
B5A6 LD H,A
B5A7 INC L Increment screen column by one.
B5A8 RET Return.
View the equivalent code in;
Prev: B563 Up: Map Next: B5A9