Prev: 9A71 Up: Map Next: 9AC7
9A9F: Is the action sensible?
Returns with Z set if the action cannot make sense: the target is the actor, or the instrument is the target, or the instrument is the actor. A missing target ($FF) is always fine.
Output
F Z set if the objects are not sensible
9A9F LD A,($B5D9) Is there actually no target at all?
9AA2 INC A
9AA3 JR NZ,$9AA7
9AA5 INC A If so, that always makes sense: A becomes non-zero (Z reset)
9AA6 RET
9AA7 LD A,($B5EF) Is the target actually a room (rather than an object)?
9AAA AND A
9AAB JR NZ,$9ABA Yes: a room can never be "the same as the actor", so skip that check
9AAD LD HL,$B5D9 No: is the target the same as the actor?
9AB0 LD A,($B5DB)
9AB3 CP (HL)
9AB4 RET Z Yes: that makes no sense (Z set)
9AB5 LD A,($B5DA) Is the instrument the same as the target?
9AB8 CP (HL)
9AB9 RET Z Yes: that makes no sense either
9ABA LD A,($B5F0) Is the instrument actually a room too?
9ABD AND A
9ABE RET NZ Yes: skip the last check
9ABF LD A,($B5DA) No: is the instrument the same as the actor?
9AC2 LD HL,$B5DB
9AC5 CP (HL)
9AC6 RET Z set means it is, and so makes no sense
Prev: 9A71 Up: Map Next: 9AC7