| Dynamite Dan | Routines | 
| Prev: CB9C | Up: Map | Next: CC36 | 
| 
 | ||||||||
| CBBD | LD ($CFCA),A | Get the current room. (CFCA). | ||||||
| CBC0 | ADD A,A | Multiply it by 4 and put it in HL. | ||||||
| CBC1 | ADD A,A | |||||||
| CBC2 | LD L,A | |||||||
| CBC3 | LD H,$00 | |||||||
| CBC5 | LD C,L | Copy HL to BC. | ||||||
| CBC6 | LD B,H | |||||||
| CBC7 | ADD HL,HL | Multiply the address by 4 to get a suitable offset. | ||||||
| CBC8 | ADD HL,BC | |||||||
| CBC9 | LD DE,$69E6 | Add the base address for room offsets (69E6) | ||||||
| CBCC | ADD HL,DE | |||||||
| CBCD | PUSH HL | Put the pointer to the actual room in IX. | ||||||
| CBCE | POP IX | |||||||
| CBD0 | LD A,(IX+$04) | Get the flags for this room? | ||||||
| CBD3 | AND $C0 | Get bits 6-7 (wall information). | ||||||
| CBD5 | RRCA | Shift this three bits to the right to get a suitable offset and put it in BC. | ||||||
| CBD6 | RRCA | |||||||
| CBD7 | RRCA | |||||||
| CBD8 | LD C,A | |||||||
| CBD9 | LD HL,$6C26 | Add the base address for wall data. (6C26). | ||||||
| CBDC | ADD HL,BC | |||||||
| CBDD | LD BC,$0008 | 8 bytes to copy. | ||||||
| CBE0 | LD DE,$CFD1 | Copy to the working buffer. (CFD1) | ||||||
| CBE3 | LDIR | |||||||
| CBE5 | EXX | Store the shadow set of HL, DE and BC. | ||||||
| CBE6 | PUSH HL | |||||||
| CBE7 | PUSH DE | |||||||
| CBE8 | PUSH BC | |||||||
| CBE9 | EXX | |||||||
| CBEA | CALL $E820 | Clear the screen. | ||||||
| CBED | CALL $ED00 | Print the room's UDGs. | ||||||
| CBF0 | CALL $DCC1 | Draw any food. | ||||||
| CBF3 | CALL $CC36 | Draw the river if it's here. | ||||||
| CBF6 | CALL $E544 | Display moving objects. | ||||||
| CBF9 | CALL $CE76 | Draw any additional objects if relevant. | ||||||
| CBFC | LD A,($CFCA) | Put the current room in B. | ||||||
| CBFF | LD B,A | |||||||
| CC00 | CALL $F3EC | Draw any special objects. | ||||||
| CC03 | CALL $C8FF | Put Dan in the right place. | ||||||
| CC06 | LD HL,$C87C | Get the lift co-ordinate. | ||||||
| CC09 | LD A,(HL) | |||||||
| CC0A | CP $1C | If it's greater than the maximum 1C then set it to that. | ||||||
| CC0C | JR NC,$CC10 | |||||||
| CC0E | LD (HL),$1C | |||||||
| 
Handle if the room has been visited, and if not, increment the running total.
 | ||||||||
| CC10 | BIT 7,(IX+$0B) | Has the room been visited? | ||||||
| CC14 | JR NZ,$CC30 | Jump forward if it has. | ||||||
| CC16 | SET 7,(IX+$0B) | Set the "room visited" flag. | ||||||
| CC1A | LD HL,$CE56 | Set HL to the relevant part of the "screens visited" message (CE53). | ||||||
| CC1D | LD A,(HL) | Is the current digit 9? | ||||||
| CC1E | CP $09 | |||||||
| CC20 | JR Z,$CC25 | If so, need to accomodate decimal overflow. | ||||||
| CC22 | INC (HL) | Otherwise increment number of screens visited and move on. | ||||||
| CC23 | JR $CC30 | |||||||
| 
Accomodate decimal overflow in the number of screens visited.
 | ||||||||
| CC25 | LD (HL),$00 | Set the digit to 0. | ||||||
| CC27 | DEC HL | Move to the previous digit (ie: more significant) | ||||||
| CC28 | INC (HL) | Increment that. | ||||||
| CC29 | LD A,(HL) | Have we reached the maximum of 0280? | ||||||
| CC2A | CP $28 | |||||||
| CC2C | JR NZ,$CC30 | Jump forward if we haven't. | ||||||
| CC2E | LD (HL),$01 | Otherwise something's gone wrong, either a bug or hacking, so set back to 1. | ||||||
| 
All done with setting up the room.
 | ||||||||
| CC30 | EXX | Restore the shadow registers and return. | ||||||
| CC31 | POP BC | |||||||
| CC32 | POP DE | |||||||
| CC33 | POP HL | |||||||
| CC34 | EXX | |||||||
| CC35 | RET | |||||||
| Prev: CB9C | Up: Map | Next: CC36 |