Prev: 26994 Up: Map Next: 27026
27005: Parser: Validate Direct Object
In most adventure games, the structure for a command is "verb + direct object". The verb describes the action, and the direct object is what the action is performed on. For example; "TAKE KEY" uses the verb "TAKE" on the direct object "KEY".
Output
F The carry flag is set when the command is malformed
The first token is the verb, so target the second token for the direct object.
Parser_ValidateDirectObject 27005 LD A,(25234) Fetch the second token from the user input into A.
27008 CP 255 Jump forward to Parser_ValidateDirectObject_Step1 if the token is anything other than the terminator (255).
27010 JR NZ,Parser_ValidateDirectObject_Step1
The token was the terminator (255), so the sentence is malformed.
E.g. They tried "TAKE" but didn't write anything after it.
27012 CALL ResponsePleaseBeMoreSpecific Call ResponsePleaseBeMoreSpecific.
27015 SCF Set the carry flag to indicate this call was a failure.
27016 RET Return.
Process the direct object.
Parser_ValidateDirectObject_Step1 27017 CALL Parser_FindPhrase Call Parser_FindPhrase.
27020 RET NZ Return if at least one noun was named.
27021 CALL ResponsePleaseRephraseThat Call ResponsePleaseRephraseThat.
27024 SCF Set the carry flag to indicate the command is malformed.
27025 RET Return.
Prev: 26994 Up: Map Next: 27026