| The Hobbit (v1.0) | Routines |
| Prev: 8865 | Up: Map | Next: 8895 |
|
Pushes the particle and the preposition of the current action (from the action table entry at $834F) on the stack, as parameters for a message such as 'take what?' or 'unlock the door with what?'. Words that should not appear are replaced by 0.
This routine modifies itself: it writes A (the opcode for either JR NZ or JR Z) into the two conditional jumps at 887F and 888E before running them, so that the same code can test flag bits for either the target or the instrument. It then returns by jumping to its return address, which it had to move out of the way under the pushed words (the EX (SP),HL instructions).
|
||||
| 8869 | LD A,$20 | The opcode for JR NZ instead (the target version) | ||
|
This entry point is used by the routine at 8865.
|
||||
| 886B | LD ($887F),A | Poke it into the first conditional jump below... | ||
| 886E | LD ($888E),A | ...and the second, so the very same code can test either the target's or the instrument's own flags | ||
| 8871 | LD IX,($834F) | IX = the current action table entry | ||
| 8875 | LD L,(IX+$04) | HL = its particle word | ||
| 8878 | LD H,(IX+$05) | |||
| 887B | BIT 7,(IX+$07) | Does this action even have a particle worth mentioning? | ||
| 887F | JR NZ,$8884 | (rewritten JR NZ or JR Z, as poked in above) | ||
| 8881 | LD HL,$0000 | No: push 0 instead, so nothing gets printed for an empty word | ||
| 8884 | EX (SP),HL | Push the particle (or 0) as a message parameter | ||
| 8885 | PUSH HL | |||
| 8886 | LD L,(IX+$02) | HL = the action's own preposition word | ||
| 8889 | LD H,(IX+$03) | |||
| 888C | BIT 5,H | Does this action have a preposition worth mentioning? | ||
| 888E | JR NZ,$8893 | (rewritten JR NZ or JR Z) | ||
| 8890 | LD HL,$0000 | No: push 0 instead | ||
| 8893 | EX (SP),HL | Push the preposition as a message parameter | ||
| 8894 | JP (HL) | Return to whichever routine called this one | ||
| Prev: 8865 | Up: Map | Next: 8895 |