Prev: 8EDD Up: Map Next: 8F9F
8F31: Update the moving platforms
Used by the routine at F7C7.
8F31 LD IY,$C622 Set IY to the moving platforms data (C622).
8F35 BIT 7,(IY+$06) Are the platforms moving outward?
8F39 JR NZ,$8F6D Jump if so.
The platforms are moving inward.
8F3B LD A,(IY+$00) Are the X and Y co-ordinates both zero?
8F3E OR (IY+$01)
8F41 RET Z If so, there are no moving platforms here, so return.
8F42 LD HL,$B600 This is the code for NOP; OR (HL)
8F45 LD ($90A4),HL Set this to the drawing routine at 90A3 to draw inwards.
8F48 LD A,(IY+$03) Has the platform reached the middle?
8F4B CP (IY+$00)
8F4E JR NZ,$8F60 Jump forward if not.
8F50 LD A,$80 Swap the direction from inward to outward.
8F52 XOR (IY+$06)
8F55 LD (IY+$06),A
8F58 INC (IY+$00) Move the left platform in and the right platform out.
8F5B DEC (IY+$04)
8F5E JR $8F6D Jump to move outward.
The platforms are moving inward and have not reached the edge.
8F60 INC (IY+$00) Move the left platform to the right
8F63 CALL $9052 Draw the left platform.
8F66 DEC (IY+$04) Move the right platform to the left
8F69 CALL $9058 Draw the right platform.
8F6C RET Add done.
The platforms are moving outward.
8F6D LD A,(IY+$04) Are the X and Y co-ordinates both zero?
8F70 OR (IY+$05)
8F73 RET Z If so, there are no moving platforms here, so return.
8F74 LD HL,$A62F This is the code for LD A,C; CPL
8F77 LD ($90A4),HL Set this to the drawing routine at 90A3 to draw outwards.
8F7A LD A,(IY+$02) Has the platform reached the left edge?
8F7D CP (IY+$00)
8F80 JR NZ,$8F92 No, so move forward.
8F82 LD A,$80 Swap the direction from outward to inward.
8F84 XOR (IY+$06)
8F87 LD (IY+$06),A
8F8A DEC (IY+$00) Move the left platform out and the right platform in.
8F8D INC (IY+$04)
8F90 JR $8F3B Jump to move inward.
The platforms are moving outward and have not reached the edge.
8F92 DEC (IY+$00) Shift the left platform out.
8F95 CALL $9052 Draw it.
8F98 INC (IY+$04) Shift the right platform in.
8F9B CALL $9058 Draw it.
8F9E RET
Prev: 8EDD Up: Map Next: 8F9F