Prev: C5E7 Up: Map Next: C63B
C618: Start of tunnel data setup
Generate the initial tunnel position/movement:
C618 LD A,($EAB7) Get room number
C61B SUB $E0 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 ).
C61D LD HL,$1234 Base ROM address
C620 LD DE,$0020
C623 LD B,A
C624 ADD HL,DE Base ROM address + (tunnel number [0-31] x 32)
C625 DJNZ $C624
However, the generated result in HL is immediately overwritten in the call at C62E, making the previous calculation unnecessary.
Store generated tunnel data:
C627 LD ($EB44),DE Store the 32 from earlier - see notes above.
C62B LD ($EB46),A Store tunnel number (room number minus 224)
C62E CALL $E0B0 Copy 16 bytes of game data from the data buffer at EB43 to the room item data sets at 7C00.
C631 LD (HL),$FF Set end-of-data byte at start of next 16 bytes data bank at 7C00
C633 LD ($EB72),HL Store the data set address pointer for the next bank.
C636 LD A,$01
C638 LD ($EB7E),A Temporary counter that holds the number of tunnel boundary walls visible on screen
Prev: C5E7 Up: Map Next: C63B