| The Hobbit (v1.0) | Routines |
| Prev: 98CF | Up: Map | Next: 99B4 |
|
Checks with 84E6 whether the action would work; returns with Z set if not. Otherwise the action is reported (7122) and performed (946F), and the routine returns with Z reset.
The report is the tricky part, because Bilbo may be able to see only part of what happens. Actions on rooms, and GO THROUGH by a character that did not start in Bilbo's room, are not reported. If the target is a door (something in two places) and the character is on the other side of it from Bilbo, the report is printed with the actor replaced by $FF, so Bilbo reads 'someone opens the door' - he sees the door open but not who opened it.
Afterwards 9A28 prints '<character> enters.' if the character has just come into Bilbo's room, and '<object> appears.' if the target has.
|
||||||||
| 9921 | PUSH IX | |||||||
| 9923 | CALL $84E6 | Would the action work? | ||||||
| 9926 | JP Z,$99B1 | No: return with Z set | ||||||
|
This entry point is used by the routine at 976C.
|
||||||||
| 9929 | LD A,($B5EF) | Is the target a room? | ||||||
| 992C | CP $01 | |||||||
| 992E | JR Z,$998D | Yes: do it without a report | ||||||
| 9930 | LD A,($B5D8) | Is it GO THROUGH (action 30)... | ||||||
| 9933 | CP $1E | |||||||
| 9935 | JR NZ,$9940 | |||||||
| 9937 | LD A,($B5E7) | ...by a character that did not start the turn in Bilbo's room? | ||||||
| 993A | LD HL,$C01B | |||||||
| 993D | CP (HL) | |||||||
| 993E | JR NZ,$998D | Then do it without a report | ||||||
| 9940 | LD A,($B5D9) | Is there a target? | ||||||
| 9943 | CP $FF | |||||||
| 9945 | JR Z,$9986 | No: report normally | ||||||
| 9947 | CALL $9ECB | A = the target's room | ||||||
| 994A | LD ($976B),A | (remember it) | ||||||
| 994D | CP $FF | Is it in one place? | ||||||
| 994F | JR NZ,$9986 | Yes: report normally | ||||||
| 9951 | LD BC,($B5E6) | A door. C = Bilbo's room, B = the character's room | ||||||
| 9955 | LD A,C | |||||||
| 9956 | CP B | The same room? | ||||||
| 9957 | JR Z,$9986 | Yes: report normally | ||||||
| 9959 | LD B,(IX+$00) | Is Bilbo on one side of the door? | ||||||
| 995C | CP (IX+$10) | |||||||
| 995F | JR Z,$9967 | |||||||
| 9961 | INC IX | |||||||
| 9963 | DJNZ $995C | |||||||
| 9965 | JR $9986 | No: report normally | ||||||
| 9967 | LD A,($B5DB) | Yes, and the character is on the other side: | ||||||
| 996A | LD B,A | |||||||
| 996B | LD A,$FF | the actor becomes "someone"... | ||||||
| 996D | LD ($B5DB),A | |||||||
| 9970 | LD A,$01 | ...output is switched on... | ||||||
| 9972 | LD ($B5F3),A | |||||||
| 9975 | PUSH IY | |||||||
| 9977 | CALL $7122 | ...and Bilbo reads "someone opens the door" | ||||||
| 997A | POP IY | |||||||
| 997C | SUB A | Output off again | ||||||
| 997D | LD ($B5F3),A | |||||||
| 9980 | LD A,B | Restore the actor | ||||||
| 9981 | LD ($B5DB),A | |||||||
| 9984 | JR $998D | |||||||
| 9986 | PUSH IY | |||||||
| 9988 | CALL $7122 | Report the action | ||||||
| 998B | POP IY | |||||||
| 998D | CALL $946F | Do it | ||||||
| 9990 | LD A,($B5DB) | Has the character just come into Bilbo's room? | ||||||
| 9993 | LD HL,$B5E7 | |||||||
| 9996 | LD DE,$AF09 | "<character> enters." | ||||||
| 9999 | CALL $9A28 | |||||||
| 999C | LD A,($B5EF) | Unless the target is a room... | ||||||
| 999F | CP $01 | |||||||
| 99A1 | JR Z,$99AF | |||||||
| 99A3 | LD A,($B5D9) | ...has the target just appeared in Bilbo's room? | ||||||
| 99A6 | LD HL,$976B | |||||||
| 99A9 | LD DE,$AF0E | "<object> appears." | ||||||
| 99AC | CALL $9A28 | |||||||
| 99AF | OR $01 | Return with Z reset: the action worked | ||||||
| 99B1 | POP IX | |||||||
| 99B3 | RET | |||||||
| Prev: 98CF | Up: Map | Next: 99B4 |