Prev: 44959 Up: Map Next: 44999
44983: Parser: Validate Any Direct Object
Used by the routines at Action_Jump, Action_Climb, Action_Go and Action_Swim.
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
A The number of valid direct objects in the user input tokens
F The carry flag is set when the command is malformed
F The zero flag is set when there are no valid direct objects present in the input tokens
The first token is the verb, so target the second token for the direct object.
Parser_ValidateAnyDirectObject 44983 LD A,(43045) Fetch the second token from the user input and store it in A.
44986 CP 255 Jump forward to ValidateAnyDirectObject if the token is anything other than the terminator character (255).
44988 JR NZ,ValidateAnyDirectObject
The token was the terminator character (255), so the sentence is malformed.
E.g. They tried "TAKE" but didn't write anything after it.
Print "Please be more specific.".
44990 CALL Response_PleaseBeMoreSpecific Call Response_PleaseBeMoreSpecific.
44993 SCF Set the carry flag to indicate this call was a failure.
44994 RET Return.
The user input tokens have a direct object, return how many are in the command buffer.
ValidateAnyDirectObject 44995 CALL Parser_CountItems Call Parser_CountItems.
44998 RET Return.
View the equivalent code in The Jewels Of Babylon.
Prev: 44959 Up: Map Next: 44999