Prev: F422 Up: Map Next: F4C6
F440: The play: a life, from its start to its end
Used by the routine at level_done.
Entered at the start of every life after the first: from its own death sequence once lose_life has taken a life, and from level_done at the end of a level. A new game enters further on, past the reset and the panel, from game. Resets the play (reset_for_life), goes back to the menu if the current player has no lives, redraws the panel, and then: puts back the ore (ore) the player had aboard, patches the BIT in spawn_objects_from_list and the SETs in ship_hits_ground_objects and beam_hits_ground_object that test and mark an object gone in map_object_kinds (one byte per object lying in the world) so that they use bit 7 for player 1 and bit 6 for player 2, and starts the level (start_landscape).
The play loop, once a pass (about 20 a second): ship_pass, the fuel gauge (update_fuel_gauge), spawn_tick, update_objects (counts the death byte up, and much else), the random numbers (random). It ends when the death byte death_count reaches 12, or when launch_state is $FF: the rocket, all eight parts built and the ship docked, has risen (level_done).
The death sequence: the landscape is stopped (scroll_down), the fuel is set to empty (fuel), part of draw_ship runs once and lift_jet erases the lift jet; then a shorter loop -- ship_pass, the pause key (check_pause), the fuel gauge, update_objects, carried_part, the gauge again -- runs until update_objects has counted the death byte up to $50. Then the death tune (death_tune), the play area dissolved (dissolve_and_clear), and a life is taken (lose_life) before going round again.
play F440 CALL reset_for_life Reset the play
F443 LD A,(lives) No lives left: back to the menu
F446 AND A
F447 JR Z,game
F449 CALL draw_panel Redraw the panel
This entry point is used by the routine at game.
play_0 F44C LD A,(ore_kept) Put back the player's ore
F44F LD (ore),A
F452 LD A,(player_in_play) Player 1 tests bit 7 of an object's state (BIT 7,(HL)), player 2 bit 6 (BIT 6,(HL))
F455 LD B,A
F456 LD A,$7E
F458 BIT 0,B
F45A JR Z,play_1
F45C LD A,$76
play_1 F45E LD ($E118),A Patch the test, and (with the bits for SET) the two instructions that set it
F461 OR $F0
F463 LD ($A9B8),A
F466 LD ($ABDE),A
F469 CALL start_landscape Start the level
play_2 F46C CALL ship_pass A pass of the play loop
F46F CALL update_fuel_gauge
F472 CALL spawn_tick
F475 CALL update_objects
F478 CALL random
F47B LD A,(death_count) Has the death byte reached 12?
F47E CP $0C
F480 JR NC,play_3
F482 LD A,(launch_state) Go round again unless launch_state is $FF
F485 INC A
F486 JR NZ,play_2
F488 JP level_done The level is done
play_3 F48B XOR A Death: stop the landscape, the fuel gauge to empty
F48C LD (scroll_across),A
F48F LD (scroll_down),A
F492 LD HL,$BE00
F495 LD (fuel),HL
F498 CALL draw_trail Once at the start of the death sequence
F49B CALL lift_jet
play_4 F49E CALL ship_pass A pass of the death sequence
F4A1 CALL check_pause
F4A4 CALL update_fuel_gauge
F4A7 CALL update_objects
F4AA CALL carried_part
F4AD CALL update_fuel_gauge
F4B0 LD A,(death_count) Until the death byte is $50
F4B3 CP $50
F4B5 JR NZ,play_4
F4B7 LD DE,death_tune The death tune
F4BA CALL play_tune
F4BD CALL dissolve_and_clear Dissolve the play area
F4C0 CALL lose_life Take a life, and start the next
F4C3 JP play
Prev: F422 Up: Map Next: F4C6