Prev: 9E40 Up: Map Next: 9E95
9E7A: What is this object shut inside?
Used by the routines at TOO_DARK and IN_REACH_OF.
Follows byte 1 of the object's record -- what holds it -- up through holders whose flags have $28 set, which can be seen into, and returns the first that cannot, or $FF if it runs out. The player's own record has $28 set, so a thing the player carries is not shut in anything by being carried.
Byte 1 is watched as well as read: the map is held by Gandalf ($3E) on the tape and by the player (0) at the first prompt, the turn the game says Gandalf gives it to you; and the large key is held by the hideous troll, as the trolls' clearing says it is.
Input
IX The object's record
Output
A What it is shut in, or $FF
SHUT_IN 9E7A PUSH IX
SHUT_IN_0 9E7C LD A,(IX+$01) Held by nothing? Then it is not shut in anything: A = $FF
9E7F CP $FF
9E81 JR Z,SHUT_IN_1
9E83 EX AF,AF' Go up to the holder, keeping its number
9E84 LD A,(IX+$01)
9E87 CALL GET_OBJECT
9E8A LD A,(IX+$07) Can the holder be seen into (flags $28)? Then keep climbing
9E8D AND $28
9E8F JR NZ,SHUT_IN_0
9E91 EX AF,AF' A = the first holder that cannot be seen into
SHUT_IN_1 9E92 POP IX
9E94 RET
Prev: 9E40 Up: Map Next: 9E95