Prev: F30B Up: Map Next: F39E
F311: Reset Life
Used by the routine at PrepareLife.
Resets everything for the start of a life: the colour of the ship, the explosion, the shield timer and some other counters, the stars, the shots and the saved copies of the flame objects. The ship object at ShipObject is restored from the state at ShipStartState and all the enemy and map object slots are freed.
ResetLife F311 LD A,$47 A=47.
F313 LD ($F201),A The ship starts white.
F316 XOR A Clear A.
F317 LD ($8F53),A Update the ship state.
F31A LD ($896F),A Update the falling timer.
F31D LD ($96AB),A Update the crystal-delivery flag.
F320 LD ($8FC3),A The damage counter.
F323 LD ($C27A),A No piece has been drawn yet.
F326 LD ($87F5),A The bonus timer.
F329 LD A,$18 A=18.
F32B LD ($9D2F),A Update the beam hit delay.
F32E LD HL,$C0EA The star positions.
F331 LD B,$12 B=12.
ResetLife_Stars F333 LD A,(HL) Read HL.
F334 AND %11111110 Keep the bits of A that are set in FE.
F336 LD (HL),A Write A where HL points.
F337 INC HL Advance HL.
F338 INC HL Advance HL.
F339 DJNZ ResetLife_Stars Decrease B and jump to ResetLife_Stars until none remain.
F33B LD HL,$B37A The shot slots.
F33E LD B,$60 B=60.
F340 CALL ClearBytes Call ClearBytes.
F343 LD HL,$96B0 The crystal-stack table.
F346 LD B,$08 B=08.
ResetLife_Entries F348 LD (HL),$00 Store 00 at the address in HL.
F34A LD A,$05 A=05.
F34C CALL AddAToHL Call AddAToHL.
F34F DJNZ ResetLife_Entries Decrease B and jump to ResetLife_Entries until none remain.
F351 LD HL,$9D43 The beam table.
F354 LD B,$10 B=10.
F356 CALL ClearBytes Call ClearBytes.
F359 LD DE,$C7BC The ship top object.
F35C LD HL,$C7C2 The other player's ship top.
F35F LD BC,$0006 BC=06.
F362 LDIR Copy BC bytes from HL to DE.
F364 LD DE,$C78F The main flame object.
F367 LD HL,$C795 The other player's main flame.
F36A LD C,$06 C=06.
F36C LDIR Copy BC bytes from HL to DE.
F36E LD DE,$C6C2 The side flame object.
F371 LD HL,$C6C9 The other player's side flame.
F374 LD C,$07 C=07.
F376 LDIR Copy BC bytes from HL to DE.
F378 LD C,$20 C=20.
F37A LD DE,$C8E5 The ship.
F37D LD HL,$C906 The ship start state.
F380 LDIR Copy BC bytes from HL to DE.
ResetLife_Slots F382 LD IX,$9974 The enemy slots.
F386 LD B,$09 B=09.
F388 LD DE,$0018 DE=18.
F38B CALL ResetLife_FreeSlot Call ResetLife_FreeSlot.
F38E LD IX,$A80B The map object slots.
F392 LD E,$1A E=1A.
F394 LD B,$06 B=06.
ResetLife_FreeSlot F396 CALL FreeObjectSlot Call FreeObjectSlot.
F399 ADD IX,DE IX gains DE.
F39B DJNZ ResetLife_FreeSlot Decrease B and jump to ResetLife_FreeSlot until none remain.
F39D RET Return.
Prev: F30B Up: Map Next: F39E