Prev: BB28 Up: Map Next: BB64
BB29: Add BC to the score, in BCD, and print it
Used by the routine at SHOOT_DOWN.
C goes into the last two digits (the third byte of SCORE), B with the carry into the middle two and the carry into the first two. The score is then printed into the buffer; the only caller, SHOOT_DOWN, copies it to the screen with SHOW_SCORE.
The entry point PRINT_BCD prints B bytes of BCD at DE, two digits each, into the buffer at HL; PRINT_BCD_LSD starts with only the second digit of the first byte. DRAW_LIVES prints the lives with the first, PERCENTAGE the percentage with both.
Input
BC the points, BCD
ADD_SCORE BB29 LD HL,$A746 the last two digits
BB2C LD A,(HL)
BB2D ADD A,C
BB2E DAA
BB2F LD (HL),A
BB30 DEC HL the middle two, with the carry
BB31 LD A,(HL)
BB32 ADC A,B
BB33 DAA
BB34 LD (HL),A
BB35 DEC HL the first two
BB36 LD A,(HL)
BB37 ADC A,$00
BB39 DAA
BB3A LD (HL),A
This entry point is used by the routine at PRINT_SCORE.
PRINT_SCORE_DIGITS BB3B LD BC,$10B8 HL = the buffer at pixel x 184, pixel y 16; three bytes from SCORE
BB3E CALL CALC_VIDBUF_ADDR
BB41 LD L,C
BB42 LD H,B
BB43 LD DE,SCORE
BB46 LD B,$03
This entry point is used by the routines at DRAW_LIVES and PERCENTAGE.
PRINT_BCD BB48 PUSH HL the font's own address as the base: digits are codes 0-9
BB49 LD HL,FONT
BB4C LD (FONT_BASE),HL
BB4F POP HL
BB50 LD A,(DE) the first digit, from the high four bits
BB51 RRCA
BB52 RRCA
BB53 RRCA
BB54 RRCA
BB55 AND $0F
BB57 CALL PRINT_CHAR
This entry point is used by the routine at PERCENTAGE.
PRINT_BCD_LSD BB5A LD A,(DE) the second, from the low four
BB5B AND $0F
BB5D CALL PRINT_CHAR
BB60 INC DE the next byte
BB61 DJNZ PRINT_BCD
BB63 RET
Prev: BB28 Up: Map Next: BB64