Prev: D80C Up: Map Next: D865
D847: The update routine for a dying villain (graphics 132-135)
Flashes the play area's paper through all eight colours, one a turn, for as long as it lasts (FLASH is cleared at the end of every turn, so the flash stops when this does), and steps through its four frames on odd turns only: struck on an even turn it shows 132 and then two turns each of 133-135, seven turns; struck on an odd one it goes straight to 133, six (measured in both parities). The record is empty the turn after. The graphic table draws 132-135 with the vanishing cloud's pictures.
Input
IX The villain's record (VILLAINS)
VILLAIN_DYING D847 LD A,(TURNS) The paper colour from the turn count's low three bits
D84A RLCA
D84B RLCA
D84C RLCA
D84D AND $38
D84F LD (FLASH),A
D852 LD A,(TURNS) A new frame only on odd turns
D855 AND $01
D857 RET Z
D858 INC (IX+$00) Next frame; after 135 the low two bits come round to 0...
D85B LD A,(IX+$00)
D85E AND $03
D860 RET NZ
D861 LD (IX+$00),A ...and the record is emptied
D864 RET
Prev: D80C Up: Map Next: D865