Prev: 8781 Up: Map Next: 87AD
8789: Decide about the instrument
The instrument's counterpart of 87AD, using the flags at $832F: no noun given goes to 883E ('unlock the door with what?'), a noun that matched nothing widens the search as for the target, and if exactly one instrument would work the action is simply carried out.
8789 LD HL,$832F Was any noun at all given for the instrument?
878C BIT 0,(HL)
878E JP Z,$883E No: go and ask "with what?" or say there was nothing suitable
8791 BIT 1,(HL) Are we still in the middle of searching (rather than already knowing the answer)?
8793 LD HL,$8339
8796 LD DE,$B5DA
8799 LD BC,$B5F0
879C JR Z,$87EF Not searching yet: go and search properly, exactly as for the target
879E LD A,($8332) Already searched: did EXACTLY one instrument candidate work?
87A1 AND A
87A2 JP Z,$87E6 None worked at all: let the action's own handler explain why
87A5 LD A,($8346) (the frame offset, though not needed again here)
87A8 LD A,($8339) A = the instrument's own noun word
87AB JR $877A More than one worked: ask "which one?"
Prev: 8781 Up: Map Next: 87AD