Prev: 44912 Up: Map Next: 44944
44923: Parser: Validate Direct Object
Used by the routines at 44959, 63571, 63730, 63861, 64041, 64106, ParseVerb_Drink, 64349, 64441, 64451, 64478, 64528, 64559 and 64587.
In most adventure games, the structure for a command is "verb + direct object". This is usually how the player interacts with the game world. The verb describes the action, and the direct object is what the action is performed on. For example; "TAKE SHOE" uses the verb "TAKE" on the direct object "SHOE".
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 44923 LD A,(43045) Fetch the second token from the user input and store it in A.
44926 CP 255 Jump forward to DirectObject_Process if the token is anything other than the terminator character (255).
44928 JR NZ,DirectObject_Process
The token was the terminator character (255), so the sentence is malformed.
E.g. They tried "TAKE" but didn't write anything after it.
44930 CALL Response_PleaseBeMoreSpecific Call Response_PleaseBeMoreSpecific.
44933 SCF Set the carry flag to indicate this call was a failure.
44934 RET Return.
Process the direct object.
DirectObject_Process 44935 CALL Parser_CountItems Call Parser_CountItems.
44938 RET NZ Return if A is not equal to 255.
44939 CALL Response_PleaseRephraseThat Call Response_PleaseRephraseThat.
44942 SCF Set the carry flag to indicate the command is malformed.
44943 RET Return.
Prev: 44912 Up: Map Next: 44944