Prev: 50469 Up: Map Next: 50632
50577: Update Special Objects
Used by the routine at BuildRoomObjects.
Copies the graphic number and the current position of each special object of the room back to the table of special objects, so that they are not lost when the player leaves the room.
Copy each special object of the room back to the table.
UpdateSpecialObjects 50577 LD IY,23624 Point IY at the first special object of the room, ObjectsTable_FirstSpecial.
UpdateSpecialObjects_Next 50581 LD A,(IY+0) Fetch the graphic number of the object.
50584 AND A Test whether there is an object.
50585 JR Z,UpdateSpecialObjects_NextSlot Jump to UpdateSpecialObjects_NextSlot if there is not.
50587 LD E,(IY+16) Fetch the low byte of the address of the entry in the table of special objects.
50590 LD D,(IY+17) Fetch the high byte.
50593 LD A,(IY+0) Fetch the graphic number of the object.
50596 LD (DE),A Store it in the entry.
50597 INC DE Point DE at the current X coordinate of the entry.
50598 INC DE
50599 INC DE
50600 INC DE
50601 INC DE
50602 PUSH IY Copy IY to HL (using the stack).
50604 POP HL
50605 INC HL Point HL at the X coordinate of the object.
50606 LD BC,3 Set the number of bytes to copy to 3.
50609 LDIR Copy the position of the object to the entry.
50611 LD A,(IY+8) Fetch the room of the object.
50614 LD (DE),A Store it in the entry.
UpdateSpecialObjects_NextSlot 50615 LD BC,32 Set BC to the size of an object.
50618 ADD IY,BC Point IY at the next object.
50620 PUSH IY Copy IY to HL (using the stack).
50622 POP HL
50623 LD BC,23688 Point BC at the end of the special objects of the room, ObjectsTable_RoomObjects.
50626 AND A Subtract the address of the end.
50627 SBC HL,BC
50629 JR C,UpdateSpecialObjects_Next Jump to UpdateSpecialObjects_Next until both of the objects have been done.
50631 RET Return.
View the equivalent code in;
Prev: 50469 Up: Map Next: 50632