Prev: 7CC8 Up: Map Next: 7CFE
7CD8: Take the hook and budgie from Sam
Used by the routine at FB52. Removes the hook and the budgie from Sam's possession if he has either one.
7CD8 LD HL,$7D1C Point HL at the object location table at 7D1C
7CDB LD A,(HL) Pick up the first byte of an entry
7CDC INC A Have we reached the end of the table?
7CDD RET Z Return if so
7CDE INC HL Point HL at the last byte of the entry
7CDF INC HL
7CE0 INC HL
7CE1 RRCA Is the entry active?
7CE2 JR C,$7CFB Jump to the next entry if not
7CE4 AND $20 Is the entry for the hook or budgie?
7CE6 JR Z,$7CFB Jump to the next entry if not
7CE8 LD A,($7FE9) Collect the object inventory flags from 7FE9
7CEB AND (HL) Does Sam have this object?
7CEC JR Z,$7CFB Jump if not
7CEE LD A,($7FE9) Take the object from Sam by resetting the appropriate bit at 7FE9
7CF1 XOR (HL)
7CF2 LD ($7FE9),A
7CF5 DEC HL Point HL at the first byte of the entry
7CF6 DEC HL
7CF7 DEC HL
7CF8 DEC (HL) Activate the entry by resetting bit 0 of the first byte
7CF9 JR $7CDB Jump back to scan the remaining entries
7CFB INC HL Move HL along to the first byte of the next entry
7CFC JR $7CDB Jump back to scan this entry
Prev: 7CC8 Up: Map Next: 7CFE