Prev: BEDF Up: Map Next: BF48
BF36: Print the percentage
Used by the routine at GAME_OVER.
Called by GAME_OVER with HL the screen address and the attribute in A'. Under a hundred it prints the two digits a column in, through the whole of PRINT_BCD. At a hundred it prints three, but by jumping into that routine past the instructions that point FONT_BASE at the digits (FONT); GAME_OVER has just printed text, which leaves FONT_BASE at the text font's base, 384 bytes lower, where codes 0 and 1 are bytes of a building's graphics. So a game finished at 100% shows three meaningless characters where the figure should be. Measured: the build's quest session run to the moment after this call, with PERCENT holding 1 and 0 and FONT_BASE the text font's, left three characters on the screen that match no digit; the same call with FONT_BASE at the digits printed 100.
Input
HL the screen address
A' the attribute
PRINT_PERCENTAGE BF36 LD DE,PERCENT one byte of digits; is the hundreds byte zero?
BF39 LD B,$01
BF3B LD A,(DE)
BF3C AND A
BF3D JR Z,PRINT_PERCENTAGE_0
BF3F INC B a hundred: three digits from the hundreds' low one -- in whatever font was last used
BF40 JP PRINT_BCD_LOW
PRINT_PERCENTAGE_0 BF43 INC L under a hundred: a column in, and the tens and units
BF44 INC DE
BF45 JP PRINT_BCD
Prev: BEDF Up: Map Next: BF48