Prev: 935C Up: Map Next: 946E
940C: Enter a room
Used by the routines at 946E, 94D9, 96D9, CD41 and F7D6.
940C LD SP,$5FFE Reset the stack to 5FFE.
940F LD A,($9649) Get the current room (9649).
9412 CP $15 Is it the final room?
9414 JP Z,$F858 Jump forward if so.
9417 CP $2C Is it the first room?
9419 JP Z,$CD41 Jump forward if so.
941C DI Set up interrupts at C700 which points to 5B5B.
941D IM 2
941F LD A,$C7
9421 LD I,A
9423 LD HL,$8F9F Use 8F9F as the routine to be called.
9426 LD ($5B5C),HL
9429 LD A,$C3 Put a "JP" command as the first byte.
942B LD ($5B5B),A
942E CALL $94C3 Copy the current room's data to the working set.
9431 CALL $9551 Display the room.
9434 LD A,($9649) Are we on room 10?
9437 CP $10
9439 JP Z,$96D9 Jump forward if so.
Run the main loop in this room. This entry point is used by the routine at 96D9.
943C HALT Let interrupts run.
943D CALL $8751 Move the nasties.
9440 CALL $935C Check for picking up coal.
9443 CALL $95B3 Animate the coal.
9446 CALL $9298 See if Monty collided with a white nasty.
9449 CALL $82A6 Check for player input.
944C CALL $89D4 Update Monty's position.
944F CALL $927E Check for picking up a collectable item.
9452 LD A,($5C7B) Move to a new room (94D9) if Monty is off the edge of the room.
9455 OR A
9456 JP Z,$94D9
9459 CP $F0
945B JP Z,$94D9
945E LD A,($5C7C)
9461 CP $21
9463 JP C,$94D9
9466 CP $AF
9468 JP NC,$94D9
946B JP $943C Otherwise loop back.
Prev: 935C Up: Map Next: 946E