Prev: 6B21 Up: Map Next: 6B75
6B48: Compute and print a digit
Used by the routine at 6B21.
Input
A 48 (ASCII code for '0')
BC 10000, 1000, 100 or 10
DE Display file address
HL Number being printed
F Carry flag reset
Output
A 48 (ASCII code for '0')
F Carry flag reset
6B48 INC A Compute in A the ASCII code for the digit.
6B49 SBC HL,BC
6B4B JR NC,$6B48
6B4D ADD HL,BC
6B4E DEC A
This entry point is used by the routines at 6000, 65A1, 673A and 6B21 with A holding the ASCII code of the character to print.
6B4F PUSH BC Save BC.
6B50 PUSH AF Save the character code briefly.
6B51 LD A,($6B0B) Pick up the game mode indicator.
6B54 LD B,A Copy it to B.
6B55 POP AF Restore the character code to A.
6B56 BIT 0,B Set the zero flag if it's demo mode.
6B58 POP BC Restore BC.
6B59 RET Z Return if it's demo mode.
6B5A EX DE,HL Swap DE and HL for no apparent reason.
6B5B PUSH BC Save BC.
6B5C PUSH DE Save DE.
6B5D EX DE,HL Swap DE and HL back again.
6B5E LD H,$00 Compute in HL the address of the graphic data for the character in the ROM.
6B60 LD L,A
6B61 ADD HL,HL
6B62 ADD HL,HL
6B63 ADD HL,HL
6B64 LD BC,$3C00
6B67 ADD HL,BC
6B68 EX DE,HL Point DE at the character's graphic data, and set HL to the display file address.
6B69 LD C,$38 This is the attribute byte for the character (INK 0: PAPER 7).
6B6B CALL $6BFA Print the character.
6B6E POP DE Restore DE.
6B6F POP BC Restore BC.
6B70 EX DE,HL Point DE back at the display file, and restore the original value of HL.
6B71 LD A,"0" Reset A to the ASCII code for '0'.
6B73 AND A Clear the carry flag. (This instruction is redundant.)
6B74 RET
Prev: 6B21 Up: Map Next: 6B75