| Dynamite Dan | Routines |
| Prev: D0DC | Up: Map | Next: D16F |
|
Used by the routine at CFD9.
|
||||
| D123 | LD A,($C876) | Put the height fallen by (C876) in L. | ||
| D126 | LD L,A | |||
| D127 | LD A,($C874) | Put Dan's flags (C874) in B. | ||
| D12A | LD B,A | |||
| D12B | LD A,($C877) | Put the current jump height (C877) in H. | ||
| D12E | LD H,A | |||
| D12F | BIT 2,B | Is bit 2 (falling onto a trampoline) set? | ||
| D131 | JR NZ,$D14B | |||
| D133 | LD A,L | |||
| D134 | CP H | |||
| D135 | JR NZ,$D145 | |||
| D137 | SET 2,B | Set bit 2 (falling onto a trampoline). | ||
| D139 | LD L,$00 | |||
| D13B | PUSH HL | |||
| D13C | LD A,($CFCB) | Get the current note to play while in mid-air. (CFCB) | ||
| D13F | CALL $DB01 | Play a sound. | ||
| D142 | POP HL | |||
| D143 | JR $D155 | |||
| D145 | INC L | Increase the height fallen (what comes up must come down!) | ||
| D146 | CALL $D567 | Move Dan upwards while jumping. | ||
| D149 | JR $D155 | |||
| D14B | INC L | Increase the height fallen. | ||
| D14C | CALL $D607 | Fall through the air. | ||
| D14F | LD A,L | |||
| D150 | CP H | |||
| D151 | JR NZ,$D155 | |||
| D153 | RES 0,B | |||
| D155 | BIT 3,B | Does Dan need changing direction? | ||
| D157 | JR Z,$D165 | Skip the next bit of code if not. | ||
|
Dan needs changing direction.
|
||||
| D159 | BIT 1,B | Is Dan facing right? | ||
| D15B | JR Z,$D162 | Skip the next bit if not. | ||
| D15D | CALL $D4B5 | Move Dan right. | ||
| D160 | JR $D165 | Skip the next bit. | ||
| D162 | CALL $D3EC | Move Dan left. | ||
|
Write all the data back out to memory.
|
||||
| D165 | LD A,B | Write the flags back to memory. | ||
| D166 | LD ($C874),A | |||
| D169 | LD A,L | Write the height fallen back to memory. | ||
| D16A | LD ($C876),A | |||
| D16D | JR $D1CE | Redraw Dan and do any collision detection. | ||
| Prev: D0DC | Up: Map | Next: D16F |