Sherlock: annotated disassembly

Routines

Prev: C491 Up: Map Next: C4B2
C493: Set the direct object's requirement from the parsed words
For a command that has not reached an action record yet: $A00F becomes 0, 4, 5 (a number) or 7 from the parser's word-class flags in $A01D/$A01E. C4B2 does the same for the indirect object ($A010).
Input
$A01D, $A01E The verb's flags
Output
$A00F The direct object's requirement: 0 none, 4, 5 a number or 7 an ordinary thing
C493 XOR A Clear A to zero (and the carry flag) - Requirement 0: no direct object
C494 LD HL,$A01D Point HL at $A01D in "Game variables"
C497 BIT 3,(HL) Test bit 3 of the byte at $A01D in "Game variables" - $A01D bit 3 (a direct object) clear: store 0
C499 JR Z,$C4AE If bit 3 of the byte at $A01D in "Game variables" is clear, skip ahead to C4AE
C49B LD A,$04 Requirement 4...
C49D BIT 7,(HL) Test bit 7 of the byte at $A01D in "Game variables" - ...if bit 7 is set
C49F JR NZ,$C4AE If bit 7 of the byte at $A01D in "Game variables" is set, skip ahead to C4AE
C4A1 LD A,($A01E) Read $A01E in "Game variables" into A - Else: both of $A01E's bits 2-3 set (a number)?
C4A4 AND $0C Keep only bits 2, 3 of A (mask $0C)
C4A6 CP $0C Compare A with $0C
C4A8 LD A,$05 Load A with $05 - Yes: requirement 5
C4AA JR Z,$C4AE If A equals $0C, skip ahead to C4AE
C4AC LD A,$07 No: 7, an ordinary thing
C4AE LD ($A00F),A Store A in $A00F in "Game variables" - Store at $A00F
C4B1 RET Return to the caller
Prev: C491 Up: Map Next: C4B2