Prev: C95B Up: Map Next: C9CD
C962: Configure room connection and enemies of the room
Copy the values of room connection and enemy entry from B1A7 and corresponent enemy configuration data to the status variables. Used by the routine at A939.
C962 LD A,($A251) Set DE to the room number to diplay
C965 LD E,A
C966 LD D,$00
C968 LD B,$06 Set B to the length in bytes of the room connections data for every room at B1A7
C96A CALL $C95B Multiple room number by length of byte of the room connections
C96D LD DE,$B1A7 Set HL to the point to the first byte into the room connection data for the corresponent room number
C970 ADD HL,DE
C971 LD A,(HL) Set #$A227 to the number of the top room
C972 LD ($A227),A
C975 INC HL Point to the next byte
C976 LD A,(HL) Set #$A226 to the number of the right room
C977 LD ($A226),A
C97A INC HL Point to the next byte
C97B LD A,(HL) Set #$A228 to the number of the bottom room
C97C LD ($A228),A
C97F INC HL Point to the next byte
C980 LD A,(HL) Set #$A229 to the number of the left room
C981 LD ($A229),A
C984 INC HL Point to the next byte
C985 LD E,(HL) Copy to DE the address pointer for the enemy configuration of this room
C986 INC HL
C987 LD D,(HL)
C988 LD A,(DE) Set A22B to the max number of enemies in the room
C989 AND $1F
C98B LD ($A22B),A
C98E XOR A Set A=0
C98F LD ($A1C7),A Initialise Enemy Entry From indicator, so by default no enemy enters the room
C992 LD ($A1C6),A
C995 LD ($A1C5),A
C998 LD A,(DE) Reads bit 7 of first byte of the enemy configuration data
C999 BIT 7,A
C99B CALL NZ,$C9BB If bit set, configure that enemy enters from the top
C99E BIT 6,A Reads bit 6 of first byte of the enemy configuration data
C9A0 CALL NZ,$C9C1 If bit set, configure that enemy enters from the right
C9A3 BIT 5,A Reads bit 5 of first byte of the enemy configuration data
C9A5 CALL NZ,$C9C7 If bit set, configure that enemy enters from the left
C9A8 INC DE Point to the next byte
C9A9 LD A,(DE) Set A1DC and A1DD to the counter for enemy enters the room
C9AA LD ($A1DC),A
C9AD LD ($A1DD),A
C9B0 INC DE Point to the next byte
C9B1 LD A,(DE) Set A221 to the type of enemy
C9B2 LD ($A221),A
C9B5 INC DE Point to the next byte
C9B6 LD ($A1B9),DE Point A1B9 to the address where begins the configuration for static enemies
C9BA RET
Enemy enters the room from the top
C9BB LD HL,$A1C7
C9BE LD (HL),$FF
C9C0 RET
Enemy enters the room from the right
C9C1 LD HL,$A1C6
C9C4 LD (HL),$FF
C9C6 RET
Enemy enters room from the left
C9C7 LD HL,$A1C5
C9CA LD (HL),$FF
C9CC RET
Prev: C95B Up: Map Next: C9CD