| Dynamite Dan | Routines | 
| Prev: D16F | Up: Map | Next: D1CD | 
| 
 | ||||||||||||||
| 
See if the lift has reached the bottom.
 | ||||||||||||||
| D1B2 | LD A,D | Is the lift in room 05? (6A22) | ||||||||||||
| D1B3 | CP $05 | |||||||||||||
| D1B5 | JR NZ,$D1BE | Jump if not. | ||||||||||||
| 
The lift has reached the bottom room.
 | ||||||||||||||
| D1B7 | LD A,E | Get the Y co-ordinate. | ||||||||||||
| D1B8 | CP $48 | Is it the lowest one? | ||||||||||||
| D1BA | JR NZ,$D1BE | Jump forward if not. | ||||||||||||
| D1BC | JR $D1C6 | Otherwise reverse direction. | ||||||||||||
| 
See if the lift has reached the top.
 | ||||||||||||||
| D1BE | LD A,D | Is the lift in room 2D? (6C02) | ||||||||||||
| D1BF | CP $2D | |||||||||||||
| D1C1 | RET NZ | Return if it isn't, nothing to do in this room. | ||||||||||||
| 
The lift has reached the top room.
 | ||||||||||||||
| D1C2 | LD A,E | Get the Y co-ordinate. | ||||||||||||
| D1C3 | CP $40 | Is it the highest one? | ||||||||||||
| D1C5 | RET NZ | Return if it isn't. | ||||||||||||
| 
The lift has reached the bottom or the top and needs reversing direction.
 | ||||||||||||||
| D1C6 | LD C,$64 | Set the wait time back to 64. | ||||||||||||
| D1C8 | LD A,B | Invert the direction flag. | ||||||||||||
| D1C9 | XOR $01 | |||||||||||||
| D1CB | LD B,A | |||||||||||||
| D1CC | RET | Return. | ||||||||||||
| Prev: D16F | Up: Map | Next: D1CD |