Routines |
Prev: 50663 | Up: Map | Next: 50747 |
|
||||
Generate the initial tunnel position/movement:
|
||||
50712 | LD A,(60087) | Get room number | ||
50715 | SUB 224 | Tunnels are from room number 224 onwards, so subtract this to get tunnel number (0-31) | ||
This section uses the tunnel number byte (1-32, stored in the A register) to generate an offset address somewhere in the ROM - base address + ( [1-31] * 32 ).
|
||||
50717 | LD HL,4660 | Base ROM address | ||
50720 | LD DE,32 | |||
50723 | LD B,A | |||
50724 | ADD HL,DE | Base ROM address + (tunnel number [0-31] x 32) | ||
50725 | DJNZ 50724 | |||
However, the generated result in HL is immediately overwritten in the call at 50734, making the previous calculation unnecessary.
Store generated tunnel data:
|
||||
50727 | LD (60228),DE | Store the 32 from earlier - see notes above. | ||
50731 | LD (60230),A | Store tunnel number (room number minus 224) | ||
50734 | CALL 57520 | Copy 16 bytes of game data from the data buffer at 60227 to the room item data sets at 31744. | ||
50737 | LD (HL),255 | Set end-of-data byte at start of next 16 bytes data bank at 31744 | ||
50739 | LD (60274),HL | Store the data set address pointer for the next bank. | ||
50742 | LD A,1 | |||
50744 | LD (60286),A | Temporary counter that holds the number of tunnel boundary walls visible on screen |
Prev: 50663 | Up: Map | Next: 50747 |