Prev: 50500 Up: Map Next: 50700
50625: 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 2 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 50625 LD DE,50179 Point DE at the player's BCD score at Player_1_State.
50628 LD HL,50200 Point HL at the extra-life threshold at ExtraLifeCompare_b0.
50631 LD A,(DE) Return if score byte 0 is below the extra-life threshold.
50632 CP (HL)
50633 RET C
50634 INC HL Advance to the next score and threshold byte.
50635 INC DE
50636 LD A,(DE) Return if score byte 1 is below the extra-life threshold.
50637 CP (HL)
50638 RET C
50639 INC HL Advance to the next score and threshold byte.
50640 INC DE
50641 LD A,(DE) Return if score byte 2 is below the extra-life threshold.
50642 CP (HL)
50643 RET C
50644 INC HL Advance to the next score and threshold byte.
50645 INC DE
50646 LD A,(DE) Return if score byte 3 is below the extra-life threshold.
50647 CP (HL)
50648 RET C
50649 LD HL,50197 Point HL at the player's life counter at Lives.
50652 INC (HL) Award the player one extra life.
50653 CALL DrawLivesDisplay Redraw the life icons display.
Raise the extra-life threshold by BCD 2 propagating carry from ExtraLifeCompare_b1 into ExtraLifeCompare_b0 if needed.
50656 LD HL,50201 Point HL at the extra-life threshold low byte at ExtraLifeCompare_b1.
50659 LD A,2 Add BCD 2 to the extra-life threshold low byte.
50661 ADD A,(HL)
50662 DAA
50663 LD (HL),A
50664 RET NC Return if the threshold advanced without BCD carry.
50665 DEC HL Step back to the extra-life threshold high byte at ExtraLifeCompare_b0.
50666 LD A,(HL) Apply BCD carry to the extra-life threshold high byte.
50667 INC A
50668 DAA
50669 LD (HL),A
50670 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 0) jump to CheckScoreAwardLife_Continue. Otherwise verify the RAM signature at *65535 and test for an active SPACE keypress; if both match, trigger a fatal error.
CheckScoreAwardLife_SessionGate 50671 LD A,(50204) Read the active enemy count from Active_Enemy_Count.
50674 AND A Jump to CheckScoreAwardLife_Continue if no enemies are currently on screen.
50675 JP Z,CheckScoreAwardLife_Continue
50678 LD A,(65535) Read the RAM signature from *65535.
50681 CP 99 Return if the RAM signature is not 99.
50683 RET NZ
50684 LD A,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE FULL-STOP M N B
50686 IN A,(254)
50688 RRCA Return if the SPACE key is not pressed.
50689 RET C
50690 EI Enable interrupts.
50691 RST 8 RST 8 (copy-protection error vector).
50692 DEFB 255 Error code: 255.
Restore the stacked register, trigger the extra-life reward, and continue with wave handling.
CheckScoreAwardLife_Continue 50693 POP DE Restore DE (stacked by the caller).
50694 CALL Extra_Life_Flash Trigger the extra-life award sound and effects.
50697 JP Stage_Next_Wave Continue with wave and game-flow handling.
Prev: 50500 Up: Map Next: 50700