Prev: CAA2 Up: Map Next: CAF1
CAD2: Set Room Attributes
Used by the routine at InitialiseGame.
Goes through the data for all of the rooms, which is held from RoomData to ObjectTypes, and copies the second colour in the size and colours byte of each into the first so that both colours are the same.
Copy the second colour over the first.
SetRoomAttributes CAD2 LD HL,$6469 Point HL at RoomData.
CAD5 LD BC,$73C8 Point BC at ObjectTypes.
CAD8 INC HL Increment HL.
SetRoomAttributes_Next CAD9 LD E,(HL) Fetch the length of the data.
CADA INC HL Increment HL.
CADB LD A,(HL) Fetch the size and colours.
CADC RRCA Rotate the second colour into bits 0-2.
CADD RRCA
CADE RRCA
CADF AND %00000111 Keep only bits 0-2.
CAE1 LD D,A Copy it to D.
CAE2 LD A,(HL) Fetch the size and colours.
CAE3 AND %11111000 Keep only bits 3-7.
CAE5 OR D Merge D.
CAE6 LD (HL),A Store the size and colours.
CAE7 LD D,$00 Set D to 00.
CAE9 ADD HL,DE Add DE to HL.
CAEA AND A Return if the end of the room data has been reached.
CAEB SBC HL,BC
CAED RET NC
CAEE ADD HL,BC Add BC to HL.
CAEF JR SetRoomAttributes_Next Jump to SetRoomAttributes_Next.
Prev: CAA2 Up: Map Next: CAF1