Prev: 8964 Up: Map Next: 8A63
89D4: Update Monty's position
Used by the routines at 940C and CD41.
89D4 LD IX,$8D52 Point IX at the room flags (8D52).
89D8 LD HL,($5C7B) Get the room position (5C7B and 5C7C).
89DB LD ($8D7D),HL Put this in the temporary store (8D7D).
89DE BIT 0,(IX+$00)
89E2 JP NZ,$8B1F
89E5 LD A,($848F) Get Monty's jump position.
89E8 OR A Is it 0?
89E9 JP NZ,$8A63 Move forward to handle jump movement if Monty is already in mid-air.
89EC LD A,($832E) Get the movement flags?
89EF BIT 7,A Is Monty jumping?
89F1 JR Z,$8A03 Move forward if not.
89F3 RES 7,A Reset the jump flag.
89F5 LD ($849B),A Store this.
89F8 INC A Set the initial position on the ground.
89F9 LD ($848F),A
89FC SET 1,(IX+$00) Set bit 1 to show Monty is jumping and move forward.
8A00 JP $8A63
8A03 BIT 2,(IX+$00) Is Monty on a ladder?
8A07 JP NZ,$917A Move forward if so.
This entry point is used by the routine at 917A.
8A0A LD A,($832E) Get the last input data.
8A0D AND $07 Remove the jump flag.
8A0F CP $04 Was there valid input?
8A11 JP Z,$8B34 Jump forward if not.
8A14 LD B,A Does the input match the last input when jumping or falling?
8A15 LD A,($849B)
8A18 CP B
8A19 JR NZ,$8A5B Jump forward if not.
Act on moving left.
8A1B CP $02 Was 'left' pressed?
8A1D JR NZ,$8A48 Jump forward if not.
8A1F LD A,($5C7B) Decrease the X co-ordinate by 2.
8A22 SUB $02
8A24 LD ($5C7B),A
This entry point is used by the routine at 917A.
8A27 LD A,($848E) Cycle Monty's frame between 0-7.
8A2A INC A
8A2B AND $07
8A2D LD ($848E),A
8A30 SRL A Halve this to get the right frame offset.
8A32 LD DE,$849C Point DE at the start of Monty's graphic (849C).
8A35 BIT 2,(IX+$00) Is Monty on a ladder?
8A39 JR Z,$8A3F Jump forward if so.
8A3B LD DE,($C51E) Point DE at the offset for Monty's graphic in this room.
8A3F CALL $8395 Select the right graphic for Monty.
8A42 LD ($848C),HL Store this. (848C).
8A45 JP $8B34 Jump forward and check on room flags.
Act on moving right?
8A48 CP $03 Was 'right' pressed?
8A4A JP NZ,$8B34 Jump forward if not to check for the room flags.
8A4D LD A,($5C7B) Increase the X co-ordinate by 2.
8A50 ADD A,$02
8A52 LD ($5C7B),A
8A55 LD A,($848E) Get Monty's frame counter.
8A58 DEC A Decrease by 1 and call the earlier routine to update the graphic.
8A59 JR $8A2B
This entry point is used by the routine at 917A.
8A5B LD A,($832E) Copy the last input to a copy.
8A5E LD ($849B),A
8A61 JR $8A27 Jump back to draw Monty.
Prev: 8964 Up: Map Next: 8A63