Prev: C8E8 Up: Map Next: C95A
C8EF: Configure room connection and enemies of the room
Copy the values of room connection and enemy entry from B133 and corresponent enemy configuration data to the status variables. Used by the routine at A89D.
C8EF LD A,($A0B8) Set DE to the room number to diplay
C8F2 LD E,A
C8F3 LD D,$00
C8F5 LD B,$06 Set B to the length in bytes of the room connections data for every room at B133
C8F7 CALL $C8E8 Multiple room number by length of byte of the room connections
C8FA LD DE,$B133 Set HL to the point to the first byte into the room connection data for the corresponent room number
C8FD ADD HL,DE
C8FE LD A,(HL) Set #$A08E to the number of the top room
C8FF LD ($A08E),A
C902 INC HL Point to the next byte
C903 LD A,(HL) Set #$A08D to the number of the right room
C904 LD ($A08D),A
C907 INC HL Point to the next byte
C908 LD A,(HL) Set #$A08F to the number of the bottom room
C909 LD ($A08F),A
C90C INC HL Point to the next byte
C90D LD A,(HL) Set #$A08F to the number of the left room
C90E LD ($A090),A
C911 INC HL Point to the next byte
C912 LD E,(HL) Copy to DE the address pointer for the enemy configuration of this room
C913 INC HL
C914 LD D,(HL)
C915 LD A,(DE) Set A092 to the max number of enemies in the room
C916 AND $1F
C918 LD ($A092),A
C91B XOR A Set A=0
C91C LD ($A02E),A Initialise Enemy Entry From indicator, so by default no enemy enters the room
C91F LD ($A02D),A
C922 LD ($A02C),A
C925 LD A,(DE) Reads bit 7 of first byte of the enemy configuration data
C926 BIT 7,A
C928 CALL NZ,$C948 If bit set, configure that enemy enters from the top
C92B BIT 6,A Reads bit 6 of first byte of the enemy configuration data
C92D CALL NZ,$C94E If bit set, configure that enemy enters from the right
C930 BIT 5,A Reads bit 5 of first byte of the enemy configuration data
C932 CALL NZ,$C954 If bit set, configure that enemy enters from the left
C935 INC DE Point to the next byte
C936 LD A,(DE) Set A043 and A044 to the counter for enemy enters the room
C937 LD ($A043),A
C93A LD ($A044),A
C93D INC DE Point to the next byte
C93E LD A,(DE) Set A088 to the type of enemy
C93F LD ($A088),A
C942 INC DE Point to the next byte
C943 LD ($A020),DE Point A020 to the address where begins the configuration for static enemies
C947 RET
Enemy enters the room from the top
C948 LD HL,$A02E
C94B LD (HL),$FF
C94D RET
Enemy enters the room from the right
C94E LD HL,$A02D
C951 LD (HL),$FF
C953 RET
Enemy enters room from the left
C954 LD HL,$A02C
C957 LD (HL),$FF
C959 RET
Prev: C8E8 Up: Map Next: C95A