| Routines

31960: Take the hook and budgie from Sam

Used by the routine at 64338. Removes the hook and the budgie from Sam's possession if he has either one.
31960 | LD HL,32028 | Point HL at the object location table at 32028
31963 | LD A,(HL) | Pick up the first byte of an entry
31964 | INC A | Have we reached the end of the table?
31965 | RET Z | Return if so
31966 | INC HL | Point HL at the last byte of the entry
31967 | INC HL
31968 | INC HL
31969 | RRCA | Is the entry active?
31970 | JR C,31995 | Jump to the next entry if not
31972 | AND 32 | Is the entry for the hook or budgie?
31974 | JR Z,31995 | Jump to the next entry if not
31976 | LD A,(32745) | Collect the object inventory flags from 32745
31979 | AND (HL) | Does Sam have this object?
31980 | JR Z,31995 | Jump if not
31982 | LD A,(32745) | Take the object from Sam by resetting the appropriate bit at 32745
31985 | XOR (HL)
31986 | LD (32745),A
31989 | DEC HL | Point HL at the first byte of the entry
31990 | DEC HL
31991 | DEC HL
31992 | DEC (HL) | Activate the entry by resetting bit 0 of the first byte
31993 | JR 31963 | Jump back to scan the remaining entries
31995 | INC HL | Move HL along to the first byte of the next entry
31996 | JR 31963 | Jump back to scan this entry