| Prev: 9179 | Up: Map | Next: 91A9 |
9191: Handle carry for player 1's score digit.
|
When a digit overflows past '9', this routine sets it to '0' and propagates the carry to the next higher digit by recursively calling update_score.
|
||||||||||
| carry_player_1_score_digit | 9191 | LD (HL),$30 | Write '0' to the overflowed digit. | |||||||
| 9193 | LD A,$06 | Check if this is the leftmost digit (offset 0): A = SCORE_DIGIT_COUNT - D + 1. | ||||||||
| 9195 | SUB D | |||||||||
| 9196 | INC A | |||||||||
| 9197 | CP $07 | |||||||||
| 9199 | RET Z | Return if leftmost digit (no more digits to carry into). | ||||||||
| 919A | PUSH HL | Save HL/DE, call update_score to increment next higher digit. | ||||||||
| 919B | PUSH DE | |||||||||
| 919C | CALL update_score | |||||||||
| 919F | LD A,$01 | Open channel 1 (upper screen) for printing. | ||||||||
| 91A1 | CALL $1601 | |||||||||
| 91A4 | POP DE | Restore HL/DE, jump to print_player_1_score_digit to print the '0' digit. | ||||||||
| 91A5 | POP HL | |||||||||
| 91A6 | JP print_player_1_score_digit | |||||||||
| Prev: 9179 | Up: Map | Next: 91A9 |