Prev: C544 Up: Map Next: C60C
C5C1: Check Score Award Life
Used by the routine at Main_Game_Loop.
Checks whether the player's score has reached the extra-life threshold. Compares the four BCD score bytes at Player_1_State against the threshold at ExtraLifeCompare_b0. Returns immediately if the score falls below the threshold on any byte. When the threshold is reached, awards one extra life, refreshes the life icons, and raises the threshold by BCD 02 ready for the next award. Called from Erase_Narrow_Entity_Sprite.
Compare the four BCD score bytes against the extra-life threshold; return if the score is below the threshold on any byte.
CheckScoreAwardLife C5C1 LD DE,$C403 Point DE at the player's BCD score at Player_1_State.
C5C4 LD HL,$C418 Point HL at the extra-life threshold at ExtraLifeCompare_b0.
C5C7 LD A,(DE) Return if score byte 0 is below the extra-life threshold.
C5C8 CP (HL)
C5C9 RET C
C5CA INC HL Advance to the next score and threshold byte.
C5CB INC DE
C5CC LD A,(DE) Return if score byte 1 is below the extra-life threshold.
C5CD CP (HL)
C5CE RET C
C5CF INC HL Advance to the next score and threshold byte.
C5D0 INC DE
C5D1 LD A,(DE) Return if score byte 2 is below the extra-life threshold.
C5D2 CP (HL)
C5D3 RET C
C5D4 INC HL Advance to the next score and threshold byte.
C5D5 INC DE
C5D6 LD A,(DE) Return if score byte 3 is below the extra-life threshold.
C5D7 CP (HL)
C5D8 RET C
C5D9 LD HL,$C415 Point HL at the player's life counter at Lives.
C5DC INC (HL) Award the player one extra life.
C5DD CALL DrawLivesDisplay Redraw the life icons display.
Raise the extra-life threshold by BCD 02 propagating carry from ExtraLifeCompare_b1 into ExtraLifeCompare_b0 if needed.
C5E0 LD HL,$C419 Point HL at the extra-life threshold low byte at ExtraLifeCompare_b1.
C5E3 LD A,$02 Add BCD 02 to the extra-life threshold low byte.
C5E5 ADD A,(HL)
C5E6 DAA
C5E7 LD (HL),A
C5E8 RET NC Return if the threshold advanced without BCD carry.
C5E9 DEC HL Step back to the extra-life threshold high byte at ExtraLifeCompare_b0.
C5EA LD A,(HL) Apply BCD carry to the extra-life threshold high byte.
C5EB INC A
C5EC DAA
C5ED LD (HL),A
C5EE RET Return.
This entry point is used by the routine at Main_Game_Loop.
Copy-protection gate: if no enemies are active (Active_Enemy_Count is 00) jump to CheckScoreAwardLife_Continue. Otherwise verify the RAM signature at *FFFF and test for an active SPACE keypress; if both match, trigger a fatal error.
CheckScoreAwardLife_SessionGate C5EF LD A,($C41C) Read the active enemy count from Active_Enemy_Count.
C5F2 AND A Jump to CheckScoreAwardLife_Continue if no enemies are currently on screen.
C5F3 JP Z,CheckScoreAwardLife_Continue
C5F6 LD A,($FFFF) Read the RAM signature from *FFFF.
C5F9 CP $63 Return if the RAM signature is not 63.
C5FB RET NZ
C5FC LD A,$7F Read from the keyboard;
Port Number Bit
0 1 2 3 4
7F SPACE FULL-STOP M N B
C5FE IN A,($FE)
C600 RRCA Return if the SPACE key is not pressed.
C601 RET C
C602 EI Enable interrupts.
C603 RST $08 RST 08 (copy-protection error vector).
C604 DEFB $FF Error code: FF.
Restore the stacked register, trigger the extra-life reward, and continue with wave handling.
CheckScoreAwardLife_Continue C605 POP DE Restore DE (stacked by the caller).
C606 CALL Extra_Life_Flash Trigger the extra-life award sound and effects.
C609 JP Stage_Next_Wave Continue with wave and game-flow handling.
Prev: C544 Up: Map Next: C60C