Prev: 8405 Up: Map Next: 8492
8464: ALL: find the next object
For a command with ALL, looks through the frames that follow (the exceptions, marked with bit 6) and checks that the target found is not one of the objects excluded by EXCEPT. Returns with Z reset if it is excluded.
8464 PUSH IY Save IY, DE and HL
8466 PUSH DE
8467 PUSH HL
8468 LD DE,$FFE8 Step back to the frame BEFORE the current one (24 bytes higher), since ALL EXCEPT exceptions are listed there
846B ADD IY,DE
846D BIT 6,(IY+$01) Is that an ALL EXCEPT exception frame?
8471 JR Z,$848D No (we have run out of exceptions): give up, there is nothing more to try
8473 LD IX,$BF50 Otherwise search every object...
8477 PUSH IY IY = the exception's own words
8479 POP HL
847A LD DE,$0008
847D ADD HL,DE
847E CALL $9D2E ...for one that fits THIS exception
8481 CP $FF
8483 JR Z,$8468 None does: try the exception before that one
8485 LD HL,$B5D9 Found one - but is it the very object we were about to use as the target?
8488 CP (HL)
8489 JR NZ,$8477 No: that is fine, look for another match to this exception instead
848B OR $01 It IS the one we were about to use: reject it (make A non-zero, so the caller skips this object)
848D POP HL Restore HL, DE and IY
848E POP DE
848F POP IY
8491 RET
Prev: 8405 Up: Map Next: 8492