| Prev: 9191 | Up: Map | Next: 91C1 |
91A9: Handle carry for player 2'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_2_score_digit | 91A9 | LD (HL),$30 | Write '0' to the overflowed digit. | |||||||
| 91AB | LD A,$06 | Check if this is the leftmost digit (offset 0): A = SCORE_DIGIT_COUNT - D + 1. | ||||||||
| 91AD | SUB D | |||||||||
| 91AE | INC A | |||||||||
| 91AF | CP $07 | |||||||||
| 91B1 | RET Z | Return if leftmost digit (no more digits to carry into). | ||||||||
| 91B2 | PUSH HL | Save HL/DE, call update_score to increment next higher digit. | ||||||||
| 91B3 | PUSH DE | |||||||||
| 91B4 | CALL update_score | |||||||||
| 91B7 | LD A,$01 | Open channel 1 (upper screen) for printing. | ||||||||
| 91B9 | CALL $1601 | |||||||||
| 91BC | POP DE | Restore HL/DE, jump to print_player_2_score_digit to print the '0' digit. | ||||||||
| 91BD | POP HL | |||||||||
| 91BE | JP print_player_2_score_digit | |||||||||
| Prev: 9191 | Up: Map | Next: 91C1 |