![]() |
Routines |
| Prev: AE99 | Up: Map | Next: AF3F |
|
Used by the routines at GameOver and BuildRoomObjects.
Copies the number, position and room of each valve in SpecialObjectSlots back to its entry in SpecialObjects, so that they are remembered when the player leaves the room. Other special objects, such as extra lives, are not copied.
|
||||
|
Copy each valve back to the table.
|
||||
| UpdateSpecialObjects | AF05 | LD IY,$5BC8 | Point IY at SpecialObjectSlots. | |
| UpdateSpecialObjects_TestSlot | AF09 | LD A,(IY+$00) | Fetch the object number. | |
| AF0C | SUB $60 | Subtract 60. | ||
| AF0E | CP $08 | Jump to UpdateSpecialObjects_NextSlot unless the object is a valve. | ||
| AF10 | JR NC,UpdateSpecialObjects_NextSlot | |||
| AF12 | LD E,(IY+$10) | Fetch the low byte of the entry address. | ||
| AF15 | LD D,(IY+$11) | Fetch the high byte of the entry address. | ||
| AF18 | LD A,(IY+$00) | Fetch the object number. | ||
| AF1B | LD (DE),A | Store it in the entry. | ||
| AF1C | INC DE | Move on to the current x position. | ||
| AF1D | INC DE | |||
| AF1E | INC DE | |||
| AF1F | INC DE | |||
| AF20 | INC DE | |||
| AF21 | PUSH IY | Copy IY to HL (using the stack). | ||
| AF23 | POP HL | |||
| AF24 | INC HL | Move on to the x position of the object. | ||
| AF25 | LD BC,$0003 | Set BC to 0003. | ||
| AF28 | LDIR | Copy the x, y and z coordinates to the entry. | ||
| AF2A | LD A,(IY+$08) | Fetch the room. | ||
| AF2D | LD (DE),A | Store it in the entry. | ||
| UpdateSpecialObjects_NextSlot | AF2E | LD BC,$0020 | Set BC to 0020. | |
| AF31 | ADD IY,BC | Move on to the next slot. | ||
| AF33 | PUSH IY | Copy IY to HL (using the stack). | ||
| AF35 | POP HL | |||
| AF36 | LD BC,$5C08 | Point BC at RoomObjects. | ||
| AF39 | AND A | Subtract RoomObjects from HL. | ||
| AF3A | SBC HL,BC | |||
| AF3C | JR C,UpdateSpecialObjects_TestSlot | Jump to UpdateSpecialObjects_TestSlot if there are more slots. | ||
| AF3E | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: AE99 | Up: Map | Next: AF3F |