Dynamite Dan | Routines |
Prev: CC5F | Up: Map | Next: CD24 |
Used by the routine at C800.
|
||||
CC89 | CALL $DC71 | Is Dan standing by the lift? | ||
CC8C | LD BC,($C87A) | Put the lift flags (C87B) in B and the time until the lift moves (C87A) in C. | ||
CC90 | LD A,($CFCA) | Put the current room (CFCA) in H. | ||
CC93 | LD H,A | |||
CC94 | LD DE,($C87C) | Put the lift's room (C87D) in D and the Y co-ordinate (C87C) in E. | ||
CC98 | LD A,C | Get the wait time. | ||
CC99 | AND A | Is it zero. | ||
CC9A | JR Z,$CCA8 | Jump forward if it is. | ||
CC9C | DEC C | Otherwise decrement the wait time. | ||
CC9D | LD A,H | Is the lift in this room? | ||
CC9E | CP D | |||
CC9F | JP NZ,$CD1B | If not, just update the settings and return. | ||
The lift is in this room, so it needs drawing.
|
||||
CCA2 | CALL $CD2B | Draw the lift. | ||
CCA5 | JP $CD1B | Update the settings and return. | ||
The lift needs moving.
|
||||
CCA8 | BIT 1,B | |||
CCAA | JR NZ,$CCA2 | |||
CCAC | BIT 0,B | Is the lift moving up? | ||
CCAE | JR NZ,$CCE5 | Jump if so. | ||
Move the lift down.
|
||||
CCB0 | DEC E | Decrease the Y co-ordinate by 2. | ||
CCB1 | DEC E | |||
CCB2 | LD A,E | Has the lift reached the bottom of the screen? | ||
CCB3 | CP $FE | |||
CCB5 | JR NZ,$CCC5 | Jump if not. | ||
CCB7 | LD A,D | Move down a room. | ||
CCB8 | ADD A,$08 | |||
CCBA | LD D,A | |||
CCBB | LD E,$9E | Set the new Y co-ordinate. | ||
CCBD | SUB $08 | Is the lift now in another room? | ||
CCBF | CP H | |||
CCC0 | JR NZ,$CCC5 | Skip the next code if not. | ||
CCC2 | XOR A | The lift is now off-screen. Reset all flags and jump forward. | ||
CCC3 | JR $CCE0 | |||
CCC5 | CALL $D1B2 | Check to see if the lift has reached the top or bottom. | ||
CCC8 | LD A,D | |||
CCC9 | CP H | |||
CCCA | JR Z,$CCD7 | |||
CCCC | SUB H | |||
CCCD | JR C,$CD1B | |||
CCCF | CP $10 | |||
CCD1 | JR C,$CD1B | |||
CCD3 | SET 0,B | |||
CCD5 | JR $CD1B | |||
CCD7 | CALL $CD2B | |||
CCDA | CALL $CD5C | |||
CCDD | LD A,E | |||
CCDE | INC A | |||
CCDF | INC A | |||
CCE0 | CALL $CD24 | |||
CCE3 | JR $CD1B | |||
Move the lift up.
|
||||
CCE5 | INC E | Increase the Y co-ordinate by 2. | ||
CCE6 | INC E | |||
CCE7 | LD A,E | Has the lift reached the top of the screen? | ||
CCE8 | CP $A0 | |||
CCEA | JR NZ,$CCFD | Jump if not. | ||
CCEC | LD A,D | Move up a room. | ||
CCED | SUB $08 | |||
CCEF | LD D,A | |||
CCF0 | LD E,$00 | Set the new Y co-ordinate. | ||
CCF2 | ADD A,$08 | Is the lift now in another room? | ||
CCF4 | CP H | |||
CCF5 | JR NZ,$CCFD | Skip the next code if not. | ||
CCF7 | LD E,$1A | |||
CCF9 | LD A,$9E | |||
CCFB | JR $CD18 | |||
CCFD | CALL $D1B2 | Check to see if the lift has reached the top or bottom. | ||
CD00 | LD A,H | |||
CD01 | CP D | |||
CD02 | JR Z,$CD0F | |||
CD04 | SUB D | |||
CD05 | JR C,$CD1B | |||
CD07 | CP $10 | |||
CD09 | JR C,$CD1B | |||
CD0B | RES 0,B | |||
CD0D | JR $CD1B | |||
CD0F | CALL $CD2B | |||
CD12 | CALL $CD5C | |||
CD15 | LD A,E | |||
CD16 | DEC A | |||
CD17 | DEC A | |||
CD18 | CALL $CD24 | Redraw the lift. | ||
CD1B | LD ($C87C),DE | Set the new y co-ordinate and room. | ||
CD1F | LD ($C87A),BC | Set the new wait time and flags. | ||
CD23 | RET |
Prev: CC5F | Up: Map | Next: CD24 |