Prev: 9DDE Up: Map Next: 9E10
9DE9: Find the next room that fits some words
Searches the exits of the actor's room for one whose destination room has the words at HL, so that rooms can be named as targets ('go into the tunnel'). Returns the room number in A, or $FF.
9DE9 PUSH IY Save the caller's IY and DE
9DEB PUSH DE
9DEC LD DE,$0002 DE = 2: the offset, from the start of a room's record, to its own name words
9DEF CALL $9AEE Look at the next exit of the actor's room; A = its direction, Z set once there are no more
9DF2 JR Z,$9E0C No more exits to try: give up
9DF4 LD A,(IX+$02) A = this exit's destination room
9DF7 PUSH IX Save the exit-table pointer for a moment
9DF9 CALL $9B0C IX = the destination room's own record
9DFC PUSH IX Copy that into IY as well...
9DFE POP IY
9E00 POP IX ...then restore IX, back to the exit we are examining
9E02 ADD IY,DE IY = the destination room's name words
9E04 CALL $71EA Do the noun and adjectives at HL match that room's name?
9E07 JR NZ,$9DEF No: try the next exit
9E09 LD A,(IX+$02) Yes: A = this exit's destination room, the answer we want
9E0C POP DE Restore the caller's DE and IY
9E0D POP IY
9E0F RET
Prev: 9DDE Up: Map Next: 9E10