![]() |
Routines |
| Prev: 934C | Up: Map | Next: 938B |
|
Used by the routines at HandlerPickupItem and HandlerBlank.
Puts the item in the third slot of the inventory (see Inventory_Slot3) back into the room at the position of the player, and makes the sound of dropping. Nothing is done if the slot is empty.
|
||||
| DropItem | 9358 | LD HL,$5E38 | Point HL at the third inventory slot at Inventory_Slot3. | |
| 935B | LD E,(HL) | Fetch the low byte of the address of the entity. | ||
| 935C | INC HL | Move on to the next byte. | ||
| 935D | LD D,(HL) | Fetch the high byte of the address of the entity. | ||
| 935E | INC HL | Move on to the next byte. | ||
| 935F | LD A,D | Return if the slot is empty (the address of the entity is zero). | ||
| 9360 | OR E | |||
| 9361 | RET Z | |||
| 9362 | PUSH DE | Stash the address of the entity on the stack. | ||
| 9363 | LD A,(HL) | Fetch the sprite ID in the slot. | ||
| 9364 | INC HL | Move on to the next byte. | ||
| 9365 | LD (DE),A | Update the sprite ID of the entity. | ||
| 9366 | INC DE | Move on to the room of the entity. | ||
| 9367 | LD A,($EA91) | Fetch the room of the player from PlayerRoom. | ||
| 936A | LD (DE),A | Update the room of the entity. | ||
| 936B | INC DE | Move on to offset 02 of the entity. | ||
| 936C | LD A,$80 | Write 80 to offset 02 of the entity. | ||
| 936E | LD (DE),A | |||
| 936F | INC DE | Move on to the X position of the entity. | ||
| 9370 | LD A,($EA93) | Fetch the X position of the player from EA93. | ||
| 9373 | LD (DE),A | Update the X position of the entity. | ||
| 9374 | INC DE | Move on to the Y position of the entity. | ||
| 9375 | LD A,($EA94) | Fetch the Y position of the player from EA94. | ||
| 9378 | LD (DE),A | Update the Y position of the entity. | ||
| 9379 | INC DE | Move on to the attribute of the entity. | ||
| 937A | LD A,(HL) | Fetch the attribute in the slot. | ||
| 937B | LD (DE),A | Update the attribute of the entity. | ||
| 937C | POP DE | Restore the address of the entity from the stack. | ||
| 937D | CALL SoundsDropItem | Call SoundsDropItem to make the sound of dropping. | ||
| 9380 | PUSH IX | Stash IX on the stack. | ||
| 9382 | PUSH DE | Copy DE into IX, as the entity to draw. | ||
| 9383 | POP IX | |||
| 9385 | CALL DrawEntity | Call DrawEntity to draw the entity. | ||
| 9388 | POP IX | Restore IX from the stack. | ||
| 938A | RET | Return. | ||
| Prev: 934C | Up: Map | Next: 938B |