![]() |
Routines |
| Prev: 9DBD | Up: Map | Next: 9E25 |
|
Used by the routines at EXCEPTED and TARGET_TROUBLE.
Walks OBJECT_INDEX from IX, three bytes at a time with the iterator the exits use, which leaves each object's record in IY. An object is passed over if its name does not match (NAME_MATCHES against the record's bytes 8-13), if a mode in FIND_MODE asks only for objects whose byte 7 has, or lacks, bit 6 set with bit 3 clear, or -- unless PATTERN_OPTION says otherwise -- if IN_REACH finds it is not within the actor's reach.
|
||||||||||||||
| FIND_NAMED_OBJECT | 9DD9 | PUSH BC | ||||||||||||
| 9DDA | PUSH DE | |||||||||||||
| 9DDB | PUSH IY | |||||||||||||
| 9DDD | LD IY,(ACTOR) | IY = the actor; D = where the actor is | ||||||||||||
| 9DE1 | LD D,(IY+$10) | |||||||||||||
| 9DE4 | LD A,(FIND_MODE) | E = the mode: 0 only things, 1 only characters, 2 either | ||||||||||||
| 9DE7 | LD E,A | |||||||||||||
| FIND_NAMED_OBJECT_0 | 9DE8 | CALL NEXT_EXIT | Next object in the index -- IY is its record -- or stop at the end | |||||||||||
| 9DEB | JR Z,FIND_NAMED_OBJECT_3 | |||||||||||||
| 9DED | LD A,$02 | Mode 2: take anything | ||||||||||||
| 9DEF | CP E | |||||||||||||
| 9DF0 | JR Z,FIND_NAMED_OBJECT_2 | |||||||||||||
| 9DF2 | LD A,(IY+$07) | A = 1 for a character (flags bit 6 set, bit 3 clear), else 0... | ||||||||||||
| 9DF5 | AND $48 | |||||||||||||
| 9DF7 | CP $40 | |||||||||||||
| 9DF9 | LD A,$00 | |||||||||||||
| 9DFB | JR NZ,FIND_NAMED_OBJECT_1 | |||||||||||||
| 9DFD | INC A | |||||||||||||
| FIND_NAMED_OBJECT_1 | 9DFE | CP E | ...and pass it over if that is not the kind wanted | |||||||||||
| 9DFF | JR NZ,FIND_NAMED_OBJECT_0 | |||||||||||||
| FIND_NAMED_OBJECT_2 | 9E01 | LD BC,$0008 | Compare the typed name with the object's, at bytes 8-13 of its record | |||||||||||
| 9E04 | PUSH IY | |||||||||||||
| 9E06 | ADD IY,BC | |||||||||||||
| 9E08 | CALL NAME_MATCHES | |||||||||||||
| 9E0B | POP IY | |||||||||||||
| 9E0D | JR NZ,FIND_NAMED_OBJECT_0 | |||||||||||||
| 9E0F | LD A,(PATTERN_OPTION) | Asked not to check reach? | ||||||||||||
| 9E12 | AND A | |||||||||||||
| 9E13 | JR NZ,FIND_NAMED_OBJECT_3 | |||||||||||||
| 9E15 | LD A,(IX+$00) | Pass over anything out of the actor's reach | ||||||||||||
| 9E18 | CALL IN_REACH | |||||||||||||
| 9E1B | JR Z,FIND_NAMED_OBJECT_0 | |||||||||||||
| FIND_NAMED_OBJECT_3 | 9E1D | LD A,(IX+$00) | A = this object's number, or $FF from the end of the index | |||||||||||
| 9E20 | POP IY | |||||||||||||
| 9E22 | POP DE | |||||||||||||
| 9E23 | POP BC | |||||||||||||
| 9E24 | RET | |||||||||||||
| Prev: 9DBD | Up: Map | Next: 9E25 |