Prev: 8D7F Up: Map Next: 8E7A
8DCD: Move a crusher
Used by the routine at 8F9F.
Input
IX Pointer to room flags (8D53)
8DCD LD IY,$C527 Point IY at the crusher data (C527).
8DD1 LD A,(IY+$00) Are the X and Y co-ordinates both zero?
8DD4 OR (IY+$01)
8DD7 RET Z If so, there are no crushers here, so return.
8DD8 LD A,(IY+$03) Is it time to fire a crusher?
8DDB OR A
8DDC JR Z,$8DE2 Jump if it is.
8DDE DEC (IY+$03) Otherwise decrement the time to fire and return.
8DE1 RET
The crusher should now be activated.
8DE2 BIT 0,(IY+$04) Is the crusher descending?
8DE6 CALL NZ,$9148 See if Monty is underneath one and if so, kill him.
8DE9 BIT 0,(IY+$04) Is the crusher descending?
8DED JR NZ,$8E10 Jump forward if not.
The crusher is ascending.
8DEF INC (IY+$01) Move down two rows.
8DF2 INC (IY+$01)
8DF5 LD A,(IY+$05) Has the Y co-ordinate reached the top?
8DF8 CP (IY+$01)
8DFB JR NC,$8E0C Jump forward if it hasn't.
The crusher has reached the top.
8DFD LD (IY+$04),$01 Signal that the crusher is descending.
8E01 CALL $FD9B Get a pseudo-random number.
8E04 RES 7,C Ensure it is a number between 1 and 80.
8E06 INC C
8E07 LD A,C Store it as the next time to fire and return.
8E08 LD (IY+$03),A
8E0B RET
8E0C CALL $8E2C Redraw the crusher and return.
8E0F RET
The crusher is descending.
8E10 DEC (IY+$01) Move down two rows.
8E13 DEC (IY+$01)
8E16 LD A,(IY+$02) Has the Y co-ordinate reached the bottom?
8E19 CP (IY+$01)
8E1C JR C,$8E0C Jump back if it hasn't.
The crusher has reached the bottom.
8E1E LD (IY+$04),$00 Signal that the crusher is ascending.
8E22 LD DE,$0002 Set the length.
8E25 LD HL,$066A Set the frequency.
8E28 CALL $03B6 Call the ROM beep routine without enabling interrupts.
8E2B RET
Prev: 8D7F Up: Map Next: 8E7A