Prev: CD40 Up: Map Next: CDC4
CD41: Display the first (outdoor) room
Used by the routine at 940C.
CD41 LD HL,$964D Reset the "collected" flag on all coal.
CD44 LD B,$40
CD46 RES 7,(HL)
CD48 INC HL
CD49 DJNZ $CD46
CD4B LD A,$03 Set the miner in room 0 to invisible.
CD4D LD ($9BBE),A
CD50 LD ($9BD2),A
CD53 LD A,$01 Set A to 1 to set some flags.
CD55 LD ($CD32),A Set no bucket collected.
CD58 LD ($CD35),A Set miner's x co-ordinate to 1.
CD5B LD HL,$4FD8 Set Monty's position to D8 4F.
CD5E LD ($5C7B),HL
CD61 DI Turn off interrupts, so a new service routine can be used.
CD62 LD A,$C7 Point I to the jump buffer at C700.
CD64 LD I,A
CD66 LD HL,$CDEF Set the interrupt service routine to jump to CDEF.
CD69 LD ($5B5C),HL
CD6C LD A,$C3 Add a 'JP' command to the first byte.
CD6E LD ($5B5B),A
CD71 IM 2 Switch to interrupt mode 2 so this routine will be fired.
CD73 LD HL,$D260 Clear the screen buffer.
CD76 LD DE,$D261
CD79 LD BC,$17FF
CD7C LD (HL),$00
CD7E LDIR
CD80 LD HL,$F14B F14B points to the static UDGs on screen at 7C00.
CD83 CALL $EF7E Print the graphics.
CD86 CALL $C62A Copy the graphic buffer to screen.
CD89 CALL $91E8 Print the score.
CD8C CALL $949E Print number of lives.
CD8F CALL $D254 Copy the screen back to the buffer.
CD92 EI Turn interrupts on, the service routine can now be run.
CD93 LD A,$75 Make 75 (bright cyan on yellow) a deadly attribute. (C51B) so Monty will die if he touches the water under bridge.
CD95 LD ($C51B),A
CD98 CALL $FF5B Wait for interrupts and run one frame in the room.
CD9B CALL $9298 Check for collision.
CD9E CALL $82A6 Check for player input.
CDA1 CALL $89D4 Update Monty's position.
CDA4 LD A,($5C7B) Is Monty's X co-ordinate the same as the bucket?
CDA7 CP $40
CDA9 CALL Z,$CDC4 If so, pick it up.
CDAC LD A,($5C7B) Has Monty reached the far right of the room?
CDAF CP $E0
CDB1 JR NZ,$CD98 Jump back if not.
Monty has reached the far right of the room, so move into room 0.
CDB3 DI Disable interrupts as the service routine will be refreshed.
CDB4 XOR A Set the current room to 0.
CDB5 LD ($9649),A
CDB8 LD HL,$2718 Set the current position to 18 27 ie: in front of the miner.
CDBB LD ($5C7B),HL
CDBE LD ($964B),HL Make this the start position if a life is lost.
CDC1 JP $940C Enter the new room.
Prev: CD40 Up: Map Next: CDC4