| The Hobbit (v1.0) | Routines |
| Prev: 7DB6 | Up: Map | Next: 7DF9 |
|
AND (or a comma) is ambiguous: it may join two objects ('take the key and the sword') or two commands ('take the key and go east'). The parser cannot tell until it sees what follows, so it records where it is: the token pointer (in 7C3E and $B5CD, pointing back at the AND), the state flags E ($7C40), the frame pointer IY ($7C41) and the frame count ($7C43). It then carries on as though a new command had begun (7CC4). If a verb turns up next, the new command stands. If not, the verb handler at 7DFD is never reached and the next frame inherits the verb of this one (7F81).
Bit 3 of E is reset to show that an AND has just been seen.
|
||||
| 7DD5 | RES 3,E | Note that AND has been seen (bit 3 clear) | ||
| 7DD7 | PUSH DE | |||
| 7DD8 | CALL $7F3D | Skip any further ANDs and commas | ||
| 7DDB | CP $A0 | |||
| 7DDD | JR Z,$7DD8 | |||
| 7DDF | DEC HL | Step back so the word after them will be read again | ||
| 7DE0 | DEC HL | |||
| 7DE1 | LD ($7C3E),HL | Save the token pointer... | ||
| 7DE4 | LD ($B5CD),HL | |||
| 7DE7 | POP DE | |||
| 7DE8 | LD A,E | ...the state flags... | ||
| 7DE9 | LD ($7C40),A | |||
| 7DEC | LD ($7C41),IY | ...the frame pointer... | ||
| 7DF0 | LD A,($B5F7) | ...and the frame count, so the parser can backtrack here | ||
| 7DF3 | LD ($7C43),A | |||
| 7DF6 | JP $7CC4 | Then carry on as if a new command were starting | ||
| Prev: 7DB6 | Up: Map | Next: 7DF9 |