Prev: AC1D Up: Map Next: AC4D
AC2F: Parser: Validate Two Direct Objects
Output
F The carry flag is set when the command is malformed
Parser_ValidateTwoDirectObjects AC2F CALL Parser_ValidateDirectObject Call Parser_ValidateDirectObject.
AC32 RET C Return if there is no direct object in the user input (so the command is malformed).
A now contains the count of the number of valid direct objects.
AC33 CP $01 Jump to ValidateTwoDirectObjects if the number of valid direct objects in the user input is not 01.
AC35 JR NZ,ValidateTwoDirectObjects
There is only one valid direct object in the user input and the command needs two...
AC37 LD HL,$0017 Call PrintCompressedStringAndNewline to print "Please be more specific." and start a new line.
AC3A CALL PrintCompressedStringAndNewline
AC3D SCF Set the carry flag; the command needs another object.
AC3E RET Return.
There are two or more valid direct objects in the user input.
ValidateTwoDirectObjects AC3F CP $03 Jump to ValidateTwoDirectObjects_TooMany if the number of valid direct objects in the user input is greater than or equal to 03.
AC41 JR NC,ValidateTwoDirectObjects_TooMany
AC43 AND A Clear the carry flag (AND A) to signal that both objects were accepted.
AC44 RET Return.
There are more than two valid direct objects in the user input.
ValidateTwoDirectObjects_TooMany AC45 LD HL,$0018 Call PrintCompressedStringAndNewline to print "Please rephrase that." and start a new line.
AC48 CALL PrintCompressedStringAndNewline
AC4B SCF Set the carry flag; there are too many objects.
AC4C RET Return.
Prev: AC1D Up: Map Next: AC4D