| Dynamite Dan | Routines | 
| Prev: DE51 | Up: Map | Next: DE7F | 
| 
Used by the routine at C800.
 | ||||
| DE52 | LD HL,$C87E | Get the flags. (C87E) | ||
| DE55 | BIT 5,(HL) | Is bit 5 (got the aerosol) still active? | ||
| DE57 | RET Z | Return if not. | ||
| DE58 | BIT 7,(HL) | Is bit 7 (game not won) active? | ||
| DE5A | RET NZ | Return if it is - if Dan's completed the game there's no need for aerosol. | ||
| DE5B | EX DE,HL | Put the flags in DE. | ||
| DE5C | LD HL,$DE51 | Point HL at the time left for the aerosol. | ||
| DE5F | DEC (HL) | Decrement it by one. | ||
| DE60 | LD A,(HL) | Is there any left? | ||
| DE61 | AND A | |||
| DE62 | JR NZ,$DE67 | Yes, so move forward. | ||
| 
The aerosol has run out.
 | ||||
| DE64 | EX DE,HL | Swap DE and HL. | ||
| DE65 | RES 5,(HL) | Reset flag 5 (got the aerosol) | ||
| DE67 | AND $07 | Put bits 0-2 of the time left in C to use as a border colour. | ||
| DE69 | LD C,A | |||
| DE6A | LD A,($E800) | Get the last read state of port FE. | ||
| DE6D | AND $F8 | Keep the top 5 bits. | ||
| DE6F | OR C | Add in the new border. | ||
| DE70 | OUT ($FE),A | Set the border and remember this state. | ||
| DE72 | LD ($E800),A | |||
| DE75 | LD A,C | Get bit 4 of the time left to use as a tune. | ||
| DE76 | AND $04 | |||
| DE78 | RRA | |||
| DE79 | ADD A,$05 | |||
| DE7B | CALL $DB01 | Play the sound running while the aerosol is active. | ||
| DE7E | RET | Reset | ||
| Prev: DE51 | Up: Map | Next: DE7F |