![]() |
Routines |
| Prev: 44694 | Up: Map | Next: 44805 |
|
Used by the routine at BuildRoomObjects.
Copies each of the special objects at SpecialObjects which is in the room of the object at IX into the slots from SpecialObjectSlots, then clears the slots which are left over (up to RoomObjects). The address of the entry is kept in the new object so that UpdateSpecialObjects can copy its position back. Each special object is given a width and depth of 5, a height of 12 and flags of 20.
|
||||||||
|
Copy each special object that is in this room.
|
||||||||
| PlaceSpecialObjectsInRoom | 44697 | LD DE,23496 | Point DE at SpecialObjectSlots. | |||||
| 44700 | EXX | Switch to the shadow registers. | ||||||
| 44701 | LD IY,30435 | Point IY at SpecialObjects. | ||||||
| 44705 | LD B,(IX+8) | Fetch the room number into the high byte of BC'. | ||||||
| PlaceSpecialObjectsInRoom_TestEntry | 44708 | LD A,(IY+0) | Fetch the special object number. | |||||
| 44711 | AND A | Jump to PlaceSpecialObjectsInRoom_NextEntry if the entry is not in use. | ||||||
| 44712 | JR Z,PlaceSpecialObjectsInRoom_NextEntry | |||||||
| 44714 | LD A,(IY+8) | Fetch the room of the special object. | ||||||
| 44717 | CP B | Jump to PlaceSpecialObjectsInRoom_NextEntry if it is not this room. | ||||||
| 44718 | JR NZ,PlaceSpecialObjectsInRoom_NextEntry | |||||||
| 44720 | PUSH IY | Stash the entry address on the stack. | ||||||
| 44722 | EXX | Switch back to the main registers. | ||||||
| 44723 | POP HL | Restore the entry address from the stack. | ||||||
| 44724 | PUSH HL | Stash it on the stack again. | ||||||
| 44725 | LD A,(HL) | Copy the object number to the slot. | ||||||
| 44726 | INC HL | |||||||
| 44727 | LD (DE),A | |||||||
| 44728 | INC DE | |||||||
| 44729 | INC HL | Skip to the current position. | ||||||
| 44730 | INC HL | |||||||
| 44731 | INC HL | |||||||
| 44732 | INC HL | |||||||
| 44733 | LD BC,3 | Set BC to 0003. | ||||||
| 44736 | LDIR | Copy the x, y and z coordinates to the slot. | ||||||
| 44738 | EX DE,HL | Point HL at the slot and DE at the room. | ||||||
| 44739 | LD (HL),5 | Write 5 as the width. | ||||||
| 44741 | INC HL | |||||||
| 44742 | LD (HL),5 | Write 5 as the depth. | ||||||
| 44744 | INC HL | |||||||
| 44745 | LD (HL),12 | Write 12 as the height. | ||||||
| 44747 | INC HL | |||||||
| 44748 | LD (HL),20 | Write 20 as the flags. | ||||||
| 44750 | INC HL | Move on to the room. | ||||||
| 44751 | EX DE,HL | Point HL at the entry and DE at the slot. | ||||||
| 44752 | LD A,(HL) | Copy the room to the slot. | ||||||
| 44753 | INC HL | |||||||
| 44754 | LD (DE),A | |||||||
| 44755 | INC DE | |||||||
| 44756 | LD B,7 | Set a counter of seven. | ||||||
| 44758 | CALL ClearBytes | Call ClearBytes. | ||||||
| 44761 | POP BC | Restore the entry address from the stack. | ||||||
| 44762 | LD A,C | Store the low byte of the address in the slot. | ||||||
| 44763 | LD (DE),A | |||||||
| 44764 | INC DE | |||||||
| 44765 | LD A,B | Store the high byte of the address in the slot. | ||||||
| 44766 | LD (DE),A | |||||||
| 44767 | INC DE | |||||||
| 44768 | LD B,14 | Set a counter of 14. | ||||||
| 44770 | CALL ClearBytes | Call ClearBytes. | ||||||
| 44773 | EXX | Switch to the shadow registers. | ||||||
| PlaceSpecialObjectsInRoom_NextEntry | 44774 | LD DE,9 | Set DE to 0009. | |||||
| 44777 | ADD IY,DE | Move on to the next entry. | ||||||
| 44779 | PUSH IY | Copy IY to HL (using the stack). | ||||||
| 44781 | POP HL | |||||||
| 44782 | LD DE,30759 | Point DE at SpritePointers. | ||||||
| 44785 | AND A | Subtract SpritePointers from HL. | ||||||
| 44786 | SBC HL,DE | |||||||
| 44788 | JR C,PlaceSpecialObjectsInRoom_TestEntry | Jump to PlaceSpecialObjectsInRoom_TestEntry if there are more entries. | ||||||
| 44790 | EXX | Switch back to the main registers. | ||||||
|
Clear any slots that were not filled.
|
||||||||
| PlaceSpecialObjectsInRoom_ClearSlots | 44791 | LD HL,23560 | Point HL at RoomObjects. | |||||
| 44794 | AND A | Subtract the next slot from HL. | ||||||
| 44795 | SBC HL,DE | |||||||
| 44797 | RET Z | Return if all of the slots have been done. | ||||||
| 44798 | LD B,32 | Set a counter of 32. | ||||||
| 44800 | CALL ClearBytes | Call ClearBytes. | ||||||
| 44803 | JR PlaceSpecialObjectsInRoom_ClearSlots | Jump to PlaceSpecialObjectsInRoom_ClearSlots. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 44694 | Up: Map | Next: 44805 |