Prev: 9BCF Up: Map Next: 9CD6
9CC2: Increments score in proportion to current speed
The low byte of speed is rotated using the carry out of the high byte, halved twice, then BCD corrected with any remaining carry folded in. What comes out is the low pair of BCD digits of the increment; the higher pairs are zero.
Used by the routine at main_loop.
speed_score 9CC2 LD HL,($A24A) Load speed into HL
This code makes little sense.
9CC5 LD A,L Speed low byte
9CC6 RR H Bottom bit of H moves to carry (H now unused)
9CC8 RLA Merge carry into LSB of speed [Wrong end? RRA intended?]
9CC9 SRL A Divide by four
9CCB SRL A
9CCD LD E,A [Needless move]
9CCE ADD A,$00 Add carry in -- the bit shifted out by the second SRL, which rounds the divide by four to nearest
9CD0 DAA BCD correction
9CD1 LD DE,$0000 Zero high part of score increment
9CD4 JR increment_score Exit via increment_score
Prev: 9BCF Up: Map Next: 9CD6