← B3FD High-score overtake flag Map B412 → Check whether the just-finished score makes the high-score table
B3FE: Increment one score digit with carry
Increments one ASCII decimal digit, and carries toward more significant digits. A byte with bit 7 set stops the carry at the field boundary.
Input
HL address of the digit to increment
Output
HL unchanged, so a caller can carry into the same field again
inc_score_digit B3FE PUSH HL Hold the digit's address for the caller.
score_digit_carry_loop B3FF BIT 7,(HL) Stop if this byte is the field boundary – the carry cannot pass it.
B401 JR Z,score_digit_bump
B403 POP HL
B404 RET
score_digit_bump B405 INC (HL) Bump the ASCII digit; past '9' wrap it to '0' and carry into the next digit.
B406 LD A,(HL)
B407 CP $3A
B409 JR C,score_digit_done
B40B LD (HL),$30
B40D DEC HL Step to the next more significant digit (lower address) and repeat the carry.
B40E JR score_digit_carry_loop
score_digit_done B410 POP HL The digit did not wrap, so no carry is owed: drop the saved pointer and return.
B411 RET
← B3FD High-score overtake flag Map B412 → Check whether the just-finished score makes the high-score table
Fork me on GitHub