Prev: 27425 Up: Map Next: 27509
27464: Compute and print a digit
Used by the routine at 27425.
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
27464 INC A Compute in A the ASCII code for the digit.
27465 SBC HL,BC
27467 JR NC,27464
27469 ADD HL,BC
27470 DEC A
This entry point is used by the routines at 24576, 26017, 26426 and 27425 with A holding the ASCII code of the character to print.
27471 PUSH BC Save BC.
27472 PUSH AF Save the character code briefly.
27473 LD A,(27403) Pick up the game mode indicator.
27476 LD B,A Copy it to B.
27477 POP AF Restore the character code to A.
27478 BIT 0,B Set the zero flag if it's demo mode.
27480 POP BC Restore BC.
27481 RET Z Return if it's demo mode.
27482 EX DE,HL Swap DE and HL for no apparent reason.
27483 PUSH BC Save BC.
27484 PUSH DE Save DE.
27485 EX DE,HL Swap DE and HL back again.
27486 LD H,0 Compute in HL the address of the graphic data for the character in the ROM.
27488 LD L,A
27489 ADD HL,HL
27490 ADD HL,HL
27491 ADD HL,HL
27492 LD BC,15360
27495 ADD HL,BC
27496 EX DE,HL Point DE at the character's graphic data, and set HL to the display file address.
27497 LD C,56 This is the attribute byte for the character (INK 0: PAPER 7).
27499 CALL 27642 Print the character.
27502 POP DE Restore DE.
27503 POP BC Restore BC.
27504 EX DE,HL Point DE back at the display file, and restore the original value of HL.
27505 LD A,"0" Reset A to the ASCII code for '0'.
27507 AND A Clear the carry flag. (This instruction is redundant.)
27508 RET
Prev: 27425 Up: Map Next: 27509