Prev: 926C Up: Map Next: 9286
9273: Is the player carrying this?
Used by the routines at MOVE_DRACULA, MOVE_FRANKENSTEIN and DOOR_NEEDS_KEY.
Walks the three slots of the inventory looking for one that matches on both bytes: the sprite in E and the drawing mode -- which for a key is its colour -- in D. It starts at $5E32 rather than $5E30 because the first two bytes of a slot are the object's address; the sprite and the mode are the third and fourth, which is exactly what REMEMBER_CARRIED put there.
Input
E The sprite to look for
D The colour it has to be
F Zero flag set if it is being carried
FIND_CARRIED 9273 LD B,$03 Three slots, four bytes each, starting at the sprite byte of the first.
9275 LD HL,$5E32
FIND_CARRIED_0 9278 LD A,(HL) Wrong sprite: on to the next slot.
9279 CP E
927A INC HL
927B JR NZ,FIND_CARRIED_1
927D LD A,(HL) Right sprite, right colour: found.
927E CP D
927F RET Z
FIND_CARRIED_1 9280 INC HL Step over the rest of the slot.
9281 INC HL
9282 INC HL
9283 DJNZ FIND_CARRIED_0
9285 RET
Prev: 926C Up: Map Next: 9286