Prev: A185 Up: Map Next: A1D3
A19C: Add to the score and redraw it
Used by the routines at MOVE_FACE and MOVE_FRANKENSTEIN.
The score is three bytes of BCD at $5E2A-$5E2C, printed as six digits. The three DAAs carry across the whole of it, so a caller only has to hand over the amount in BC.
Confirmed against a running game: with the panel reading SCORE 000310 the three bytes held $00 $03 $10.
Input
BC The amount to add, in BCD
ADD_SCORE A19C LD HL,$5E2C The least significant byte, working backwards from there.
A19F LD A,(HL) DAA after each addition is what keeps it decimal.
A1A0 ADD A,C
A1A1 DAA
A1A2 LD (HL),A
A1A3 DEC HL Carry up through the middle and top bytes.
A1A4 LD A,(HL)
A1A5 ADC A,B
A1A6 DAA
A1A7 LD (HL),A
A1A8 DEC HL
A1A9 LD A,(HL)
A1AA ADC A,$00
A1AC DAA
A1AD LD (HL),A
This entry point is used by the routine at DRAW_SCROLL.
DRAW_SCORE A1AE LD HL,FONT_DIGITS Point the tile source at the digits before drawing -- this is the biased pointer PLOT_TILE's note describes, TEXT_FONT + $80, so a digit value indexes its own character.
A1B1 LD ($5E01),HL
A1B4 LD HL,$50C8
This entry point is used by the routine at DRAW_SUMMARY.
DRAW_SCORE_AT A1B7 CALL PIXEL_TO_SCREEN
A1BA LD DE,$5E2A Three bytes, two digits in each.
A1BD LD B,$03
This entry point is used by the routines at TICK_CLOCK and DRAW_SUMMARY.
DRAW_DIGITS A1BF LD A,(DE) High nibble first, then the low one.
A1C0 RRCA
A1C1 RRCA
A1C2 RRCA
A1C3 RRCA
A1C4 AND $0F
A1C6 CALL PLOT_TILE
This entry point is used by the routine at TICK_CLOCK.
DRAW_LOW_DIGIT A1C9 LD A,(DE)
A1CA AND $0F
A1CC CALL PLOT_TILE
A1CF INC DE
A1D0 DJNZ DRAW_DIGITS
A1D2 RET
DRAW_SCORE and DRAW_SCORE_AT are entered on their own to redraw the score without changing it, and DRAW_DIGITS is the general digit printer: B bytes of BCD from DE, drawn at the screen address in HL. The status panel uses that last entry to print the rooms-explored figure from COUNT_ROOMS_EXPLORED as well.
Prev: A185 Up: Map Next: A1D3