Prev: 9109 Up: Map Next: 913B
9122: Update and print score for current player.
Increments a score digit and propagates carry if needed. The digit offset is calculated as (6 - type), where offset 0 is the leftmost (100,000s) and offset 5 is the rightmost (1s). When carry propagates to type=4 (offset 2, the 1,000s column), add_life is called to award a bonus life. This means bonus lives are awarded every 10,000 points.
Input
A Update type: determines digit offset (1=1s, 2=10s, 3=100s, 4=1000s+bonus life, 5=10000s, 6=100000s)
update_score 9122 PUSH AF Save A, open upper screen channel via ROM CHAN_OPEN, restore A.
9123 LD A,$01
9125 CALL $1601
9128 POP AF
9129 CP $04 If update type is 4, award bonus life via add_life.
912B CALL Z,add_life
912E LD B,A Calculate digit offset: C = 6 - update_type.
912F LD A,$06
9131 SUB B
9132 LD C,A
9133 LD A,($923D) Load current player number.
9136 CP $02 Route to player 2 handler if current player is PLAYER_2.
9138 JP Z,inc_player_2_score_digit
Prev: 9109 Up: Map Next: 913B