Prev: B115 Up: Map Next: B178
B145: Copy the score to the screen
Used by the routine at SHOOT_DOWN.
ADD_SCORE prints the score's six digits into the buffer; this copies them to the screen: six bytes wide and eight rows high, from pixel x 184, y 9. Used when something shot scores (SHOOT_DOWN).
SHOW_SCORE B145 LD BC,$09B8 The bottom left of the digits: DE its display address, BC its buffer address
B148 CALL CALC_VRAM_ADDR
B14B CALL CALC_VIDBUF_ADDR
B14E LD H,B HL the buffer; eight rows
B14F LD L,C
B150 LD C,$08
SHOW_SCORE_0 B152 PUSH BC A row: six bytes
B153 PUSH DE
B154 LD BC,$0006
B157 LDIR
B159 POP DE Up a display line: DEC D is enough unless the line crossed into the character row above
B15A DEC D
B15B LD A,D
B15C CPL
B15D AND $07
B15F JR NZ,SHOW_SCORE_1 Crossing a character row: back 32 in E, and back into this third unless that borrowed
B161 LD A,E
B162 SUB $20
B164 LD E,A
B165 JR C,SHOW_SCORE_1
B167 LD A,D
B168 ADD A,$08
B16A LD D,A
SHOW_SCORE_1 B16B POP BC The buffer row above: 26 more after the six copied
B16C LD A,L
B16D ADD A,$1A
B16F LD L,A
B170 LD A,H
B171 ADC A,$00
B173 LD H,A
B174 DEC C The next row
B175 JR NZ,SHOW_SCORE_0
B177 RET
Prev: B115 Up: Map Next: B178