| The Hobbit (v1.0) | Routines |
| Prev: A69E | Up: Map | Next: A708 |
|
When anyone other than Elrond (object 65) examines the curious map, it is an ordinary EXAMINE (9344). When Elrond does (because the player gave it to him and asked him to read it), the hidden route chosen at the start of the game (970B) is revealed: the three bytes of the exit that were blanked out are restored from the table at C6F7 (the address of the entry was written into the LD IY instruction at A6C3), and Elrond says 'go <direction> from <room> to get to <room>'. $B5E2 records that it has been done.
|
||||
| A6B8 | LD A,($B5DB) | Pick up the number of the character doing the examining | ||
| A6BB | CP $41 | Is it Elrond (object 65)? | ||
| A6BD | JP NZ,$9344 | No: treat it as an ordinary EXAMINE (you see the curious map) | ||
| A6C0 | CALL $9C99 | Elrond: during a dry run, record that this would work and stop here | ||
| A6C3 | LD IY,$0000 | IY = the hidden-route entry chosen at the start of the game (this operand is written by 970B) | ||
| A6C7 | LD L,(IY+$01) | HL = the address of the blanked-out exit in the room record... | ||
| A6CA | LD H,(IY+$02) | ...(bytes 1 and 2 of the entry) | ||
| A6CD | LD A,($B5E2) | Has the map already been read? | ||
| A6D0 | CP $00 | |||
| A6D2 | JR NZ,$A6E3 | Yes: the exit is already open, so skip straight to what Elrond says | ||
| A6D4 | LD B,$03 | Three bytes to restore: direction, door and destination | ||
| A6D6 | LD A,(IY+$03) | Fetch one byte of the exit from the entry (bytes 3-5)... | ||
| A6D9 | LD (HL),A | ...and put it back into the room record | ||
| A6DA | INC HL | Next byte of the room record | ||
| A6DB | INC IY | Next byte of the entry | ||
| A6DD | DJNZ $A6D6 | Repeat for all three bytes: the hidden way is now open | ||
| A6DF | LD IY,($A6C5) | Point IY back at the start of the entry (the INCs moved it on) | ||
| A6E3 | LD A,(IY+$05) | A = the destination room (byte 5 of the entry) | ||
| A6E6 | CALL $9B0C | IX = its room record | ||
| A6E9 | INC IX | Skip the two flag bytes... | ||
| A6EB | INC IX | ...to reach the room's name words | ||
| A6ED | PUSH IX | Push them as the third parameter of the message ("...to get to <room>") | ||
| A6EF | LD A,(IY+$00) | A = the room that has the exit (byte 0 of the entry) | ||
| A6F2 | CALL $9B0C | IX = its room record | ||
| A6F5 | INC IX | Skip the two flag bytes... | ||
| A6F7 | INC IX | ...to reach the room's name words | ||
| A6F9 | PUSH IX | Push them as the second parameter ("...from <room>...") | ||
| A6FB | LD A,(IY+$03) | A = the direction of the exit (byte 3 of the entry) | ||
| A6FE | CALL $9FEA | DE = the word for that direction (NORTH, EAST...) | ||
| A701 | PUSH DE | Push it as the first parameter ("go <direction>...") | ||
| A702 | LD HL,$B0C2 | HL = the message "go <direction> from <room> to get to <room>" | ||
| A705 | JP $A113 | Elrond says it: 'elrond says "go north from beorns house to get to the great river".' | ||
| Prev: A69E | Up: Map | Next: A708 |