Prev: CD8A Up: Map Next: CDD3
CD9A: Run a frame in the "lose a life" sequence
Used by the routine at CFD9.
CD9A LD HL,$C880 Get the current tick counter. (C880)
CD9D LD A,(HL) Is it zero?
CD9E AND A
CD9F JR Z,$CDA3 Jump forward if it is.
CDA1 DEC (HL) Otherwise decrease the tick counter and return.
CDA2 RET
A frame needs to be updated.
CDA3 LD HL,$DA8A Point HL at the current sound state. (#$DA8A)
CDA6 RES 1,(HL) Reset bit 1, to stop all sounds and play this effect instead.
CDA8 LD HL,$C86D Put the current energy (C86D) in A.
CDAB LD A,(HL)
CDAC CP $08 Is it 8 (full)?
CDAE JR Z,$CDB9 Jump forward if it is.
CDB0 INC (HL) Increase the energy.
CDB1 SLA A Multiply the energy amount by 4.
CDB3 SLA A
CDB5 CALL $DB01 Play the sound and return.
CDB8 RET
All frames have been run, now remove one life.
CDB9 LD HL,$C86C Point HL at the number of lives.
CDBC LD A,$19 Have we got 19 lives?
CDBE CP (HL)
CDBF JP C,$0000 If so, reset the game, looks like someone's been hacking.
CDC2 LD A,(HL) Have we got any lives?
CDC3 AND A
CDC4 JR Z,$CDD3 If not, the game's over.
CDC6 DEC (HL) Decrease the number of lives.
CDC7 LD HL,$C874 Point HL to the game flags (C874).
CDCA RES 5,(HL) Reset bit 5 (lose a life).
CDCC LD HL,$EE88 Set HL to the "lose a life" effect.
CDCF CALL $DB0B Play it.
CDD2 RET
Prev: CD8A Up: Map Next: CDD3