Prev: 50288 Up: Map Next: 50320
50299: Parser: Validate Direct Object
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 50299 LD A,(48487) Fetch the second token from the user input and store it in A.
50302 CP 255 Jump forward to DirectObject_Process if the token is anything other than the terminator character (255).
50304 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.
50306 CALL Response_PleaseBeMoreSpecific Call Response_PleaseBeMoreSpecific.
50309 SCF Set the carry flag to indicate this call was a failure.
50310 RET Return.
Process the direct object.
DirectObject_Process 50311 CALL Parser_CountItems Call Parser_CountItems.
50314 RET NZ Return if A is not equal to 255.
50315 CALL Response_PleaseRephraseThat Call Response_PleaseRephraseThat.
50318 SCF Set the carry flag to indicate the command is malformed.
50319 RET Return.
Prev: 50288 Up: Map Next: 50320