| Prev: 90CE | Up: Map | Next: 9109 |
90E0: Add score points for a hit target
|
Adds points to the current player's score. The value in A is BCD-encoded as score/10: high nibble increments the 10s digit (×100 displayed points), low nibble increments the 1s digit (×10 displayed points). The trailing zero in the score display provides the ×10 factor. E.g. POINTS_TANK = BCD 25 → 2×100 + 5×10 = 250 points.
|
||||||||
| add_points | 90E0 | PUSH AF | Extract high nibble (hundreds digit), skip if zero. | |||||
| 90E1 | SRL A | |||||||
| 90E3 | SRL A | |||||||
| 90E5 | SRL A | |||||||
| 90E7 | SRL A | |||||||
| 90E9 | CP $00 | |||||||
| 90EB | JP Z,add_points_units_entry | |||||||
| add_points_tens_loop | 90EE | PUSH AF | Increment 10s score digit once per high-nibble unit. | |||||
| 90EF | LD A,$02 | |||||||
| 90F1 | CALL update_score | |||||||
| 90F4 | POP AF | |||||||
| 90F5 | DEC A | |||||||
| 90F6 | JR NZ,add_points_tens_loop | |||||||
| add_points_units_entry | 90F8 | POP AF | Extract low nibble (tens digit), return if zero. | |||||
| 90F9 | AND $0F | |||||||
| 90FB | CP $00 | |||||||
| 90FD | RET Z | |||||||
| add_points_units_loop | 90FE | PUSH AF | Increment 1s score digit once per low-nibble unit. | |||||
| 90FF | LD A,$01 | |||||||
| 9101 | CALL update_score | |||||||
| 9104 | POP AF | |||||||
| 9105 | DEC A | |||||||
| 9106 | JR NZ,add_points_units_loop | |||||||
| 9108 | RET | |||||||
| Prev: 90CE | Up: Map | Next: 9109 |