Prev: 6972 Up: Map Next: 6992
697D: 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 697D LD A,($6292) Fetch the second token from the user input into A.
6980 CP $FF Jump forward to Parser_ValidateDirectObject_Step1 if the token is anything other than the terminator (FF).
6982 JR NZ,Parser_ValidateDirectObject_Step1
The token was the terminator (FF), so the sentence is malformed.
E.g. They tried "TAKE" but didn't write anything after it.
6984 CALL ResponsePleaseBeMoreSpecific Call ResponsePleaseBeMoreSpecific.
6987 SCF Set the carry flag to indicate this call was a failure.
6988 RET Return.
Process the direct object.
Parser_ValidateDirectObject_Step1 6989 CALL Parser_FindPhrase Call Parser_FindPhrase.
698C RET NZ Return if at least one noun was named.
698D CALL ResponsePleaseRephraseThat Call ResponsePleaseRephraseThat.
6990 SCF Set the carry flag to indicate the command is malformed.
6991 RET Return.
Prev: 6972 Up: Map Next: 6992