Prev: CC96 Up: Map Next: CCD0
CCA7: Retrieve Room
Used by the routine at BuildRoomObjects.
Builds the objects of the room that the player is in from the room data. It looks for the room in the room data (see RoomData), which has a variable length entry for each room. The objects are put in the objects table from RoomObjects, which is the first one after the player and the special objects. If the room is not in the data, none are made.
Input
IX Address of the player
Point at the room data, then find the entry for this room.
RetrieveRoom CCA7 LD HL,$73C8 Point HL at ObjectTypes.
CCAA LD ($5B20),HL Set ObjectTypeTableAddress.
CCAD XOR A Write 00 to PositionOffset and BlockScratch.
CCAE LD ($5B19),A
CCB1 LD ($5B25),A
CCB4 LD DE,$5C08 Point DE at RoomObjects.
CCB7 LD BC,$73C8 Point BC at ObjectTypes.
CCBA LD HL,$6469 Point HL at RoomData.
RetrieveRoom_Find CCBD LD A,(HL) Fetch the room number and compare it with the player's room.
CCBE INC HL
CCBF CP (IX+$08)
CCC2 JR Z,MakeRoomObjects Jump to MakeRoomObjects if they match.
CCC4 LD A,(HL) Fetch the length of the entry.
CCC5 CALL AddAToHL Call AddAToHL.
CCC8 AND A Jump to ClearRemainingObjects if HL has reached BC.
CCC9 SBC HL,BC
CCCB JR NC,ClearRemainingObjects
CCCD ADD HL,BC Add BC to HL.
CCCE JR RetrieveRoom_Find Jump to RetrieveRoom_Find.
View the equivalent code in;
Prev: CC96 Up: Map Next: CCD0