Dynamite Dan | Routines |
Prev: D2BF | Up: Map | Next: D378 |
Used by the routine at D895.
|
||||
D2F0 | LD A,($C872) | Put Dan's Y co-ordinate (C872) in A. | ||
D2F3 | AND $07 | |||
D2F5 | AND A | |||
D2F6 | JP NZ,$D950 | |||
D2F9 | LD A,($C876) | Put the height fallen by (C876) in L. | ||
D2FC | LD L,A | |||
D2FD | LD A,($C874) | Put some flags (C874) in B. | ||
D300 | LD B,A | |||
D301 | LD A,L | Has Dan fallen less than 3 lines? | ||
D302 | CP $03 | |||
D304 | JR NC,$D319 | Jump if so. | ||
D306 | LD A,($C874) | Turn off all flags except bit 1 (facing right) and 5 (safe). | ||
D309 | AND $22 | |||
D30B | LD ($C874),A | |||
D30E | XOR A | Set the height fallen to 0. | ||
D30F | LD ($C876),A | |||
D312 | CALL $D567 | Propel Dan upwards. | ||
D315 | POP DE | Clean up the stack. | ||
D316 | JP $D1CE | Jump forward to redraw Dan. | ||
Dan has landed on a trampoline, check for input and react accordingly.
|
||||
D319 | PUSH HL | Store the main registers. | ||
D31A | PUSH DE | |||
D31B | PUSH BC | |||
D31C | CALL $E9BC | Get some user input and put it in A. | ||
D31F | LD A,C | |||
D320 | POP BC | Restore the registers. | ||
D321 | POP DE | |||
D322 | POP HL | |||
D323 | LD C,A | Put the user input back in C. | ||
D324 | BIT 0,C | Is Dan jumping? | ||
D326 | JR Z,$D32E | Move forward if he isn't. | ||
Dan is jumping on the trampoline.
|
||||
D328 | SRL L | Double the height to fall and add 1. | ||
D32A | INC L | |||
D32B | LD A,L | Put this in A for the next bit of code. | ||
D32C | JR $D332 | |||
Dan is not jumping on the trampoline.
|
||||
D32E | LD A,L | Halve the height fallen and add the original height. | ||
D32F | SRL A | |||
D331 | ADD A,L | |||
Having determined the height to fall, find out the direction.
|
||||
D332 | LD ($C879),A | |||
D335 | BIT 2,C | Is Dan jumping straight ahead? | ||
D337 | RES 3,B | Reset bit 3 in B (change direction). | ||
D339 | JR NZ,$D361 | Jump foward if Dan is jumping straight ahead. | ||
Dan is jumping or moving in a particular direction.
|
||||
D33B | SET 3,B | Set bit 3 in B (change direction). | ||
D33D | BIT 1,C | Is Dan moving or jumping left? | ||
D33F | JR NZ,$D34A | |||
D341 | BIT 1,B | |||
D343 | JR NZ,$D361 | |||
D345 | CALL $D4B5 | |||
D348 | JR $D351 | |||
D34A | BIT 1,B | |||
D34C | JR Z,$D361 | |||
D34E | CALL $D3EC | |||
D351 | LD A,($C874) | Reset all flags (C874) except "facing right" and "safe". | ||
D354 | AND $22 | |||
D356 | LD ($C874),A | |||
D359 | LD A,$09 | |||
D35B | LD ($C876),A | |||
D35E | JP $D1CE | |||
D361 | SET 4,B | |||
D363 | RES 2,B | |||
D365 | LD A,B | |||
D366 | LD ($C874),A | |||
D369 | XOR A | |||
D36A | LD ($C876),A | |||
D36D | LD A,$0C | |||
D36F | LD ($CFCB),A | |||
D372 | LD A,$0E | |||
D374 | LD ($DBED),A | |||
D377 | RET |
Prev: D2BF | Up: Map | Next: D378 |