| The Hobbit (v1.0) | Routines |
| Prev: 71D9 | Up: Map | Next: 7225 |
|
Compares the verb, particle and preposition in an action table entry (at HL) with those of the parsed command (at IY) using 7225. The verb must match. The particle and preposition may match in the same order, or crossed over, so that for example both 'take off the ring' and 'take the ring off' find the TAKE OFF action.
Returns with Z set for a match; A is 0 if the words matched in order and 1 if they were crossed over, and $B5D0 is set to 1 once the verb alone has matched (so the caller can tell 'wrong verb' from 'right verb, wrong words').
|
||||||||||||||||
| 71EA | PUSH DE | Save the caller's DE, HL and IY | ||||||||||||||
| 71EB | PUSH HL | |||||||||||||||
| 71EC | PUSH IY | |||||||||||||||
| 71EE | CALL $7225 | Do the verbs match? (this also moves both pointers on to their next word) | ||||||||||||||
| 71F1 | JR NZ,$7220 | No: there is no match at all - give up straight away | ||||||||||||||
| 71F3 | LD A,$01 | Record that at least the verb has matched... | ||||||||||||||
| 71F5 | LD ($B5D0),A | ...so a later failure can be blamed on "the wrong words", not "an unknown verb" | ||||||||||||||
| 71F8 | CALL $7225 | Do the particles match, in the same order? | ||||||||||||||
| 71FB | JR NZ,$7204 | No: they might just be the wrong way round - go and check that below | ||||||||||||||
| 71FD | CALL $7225 | They do: now do the prepositions match too, in the same order? | ||||||||||||||
| 7200 | LD A,$00 | If so, this is a plain, in-order match | ||||||||||||||
| 7202 | JR Z,$7220 | ...so finish here, with A=0 | ||||||||||||||
| 7204 | POP IY | Not a straightforward match: restore the command's own pointer... | ||||||||||||||
| 7206 | POP HL | ...and the action-entry's pointer, saved right at the very start... | ||||||||||||||
| 7207 | PUSH HL | ...pushing them straight back so they can be recovered again below | ||||||||||||||
| 7208 | PUSH IY | |||||||||||||||
| 720A | LD DE,$0004 | Move the command's pointer on 4 bytes, to its own preposition word... | ||||||||||||||
| 720D | ADD IY,DE | |||||||||||||||
| 720F | INC HL | ...and the action-entry's pointer on 2, to its particle word instead | ||||||||||||||
| 7210 | INC HL | |||||||||||||||
| 7211 | CALL $7225 | Does the entry's PARTICLE match the command's own PREPOSITION? | ||||||||||||||
| 7214 | JR NZ,$7220 | No: there is no match, in either order | ||||||||||||||
| 7216 | LD DE,$FFFC | Move the command's pointer back 4, to its own particle word... | ||||||||||||||
| 7219 | ADD IY,DE | |||||||||||||||
| 721B | CALL $7225 | ...and does THAT match the entry's PREPOSITION? | ||||||||||||||
| 721E | LD A,$01 | Yes: it is a match, but with particle and preposition crossed over | ||||||||||||||
| 7220 | POP IY | Restore the caller's IY, HL and DE | ||||||||||||||
| 7222 | POP HL | |||||||||||||||
| 7223 | POP DE | |||||||||||||||
| 7224 | RET | |||||||||||||||
| Prev: 71D9 | Up: Map | Next: 7225 |