Prev: 52374 Up: Map Next: 52432
52391: 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 52391 LD HL,29640 Point HL at ObjectTypes.
52394 LD (23328),HL Set ObjectTypeTableAddress.
52397 XOR A Write 0 to PositionOffset and BlockScratch.
52398 LD (23321),A
52401 LD (23333),A
52404 LD DE,23560 Point DE at RoomObjects.
52407 LD BC,29640 Point BC at ObjectTypes.
52410 LD HL,25705 Point HL at RoomData.
RetrieveRoom_Find 52413 LD A,(HL) Fetch the room number and compare it with the player's room.
52414 INC HL
52415 CP (IX+8)
52418 JR Z,MakeRoomObjects Jump to MakeRoomObjects if they match.
52420 LD A,(HL) Fetch the length of the entry.
52421 CALL AddAToHL Call AddAToHL.
52424 AND A Jump to ClearRemainingObjects if HL has reached BC.
52425 SBC HL,BC
52427 JR NC,ClearRemainingObjects
52429 ADD HL,BC Add BC to HL.
52430 JR RetrieveRoom_Find Jump to RetrieveRoom_Find.
View the equivalent code in;
Prev: 52374 Up: Map Next: 52432