![]() |
Routines |
Prev: AF9F | Up: Map | Next: AFC7 |
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".
|
||||||||||||
The first token is the verb, so target the second token for the direct object.
|
||||||||||||
AFB7 | LD A,($A825) | Fetch the second token from the user input and store it in A. | ||||||||||
AFBA | CP $FF | Jump forward to AFC3 if the token is anything other than the terminator character (FF). | ||||||||||
AFBC | JR NZ,$AFC3 | |||||||||||
The token was the terminator character (FF), so the sentence is malformed.
E.g. They tried "TAKE" but didn't write anything after it.
Print "Please be more specific.".
|
||||||||||||
AFBE | CALL Response_PleaseBeMoreSpecific | Call Response_PleaseBeMoreSpecific. | ||||||||||
AFC1 | SCF | Set the carry flag to indicate this call was a failure. | ||||||||||
AFC2 | RET | Return. | ||||||||||
The user input tokens have a direct object, return how many are in the command buffer.
|
||||||||||||
AFC3 | CALL Parser_CountItems | Call Parser_CountItems. | ||||||||||
AFC6 | RET | Return. |
Prev: AF9F | Up: Map | Next: AFC7 |