Sherlock: annotated disassembly

Routines

Prev: AC94 Up: Map Next: ACCC
ACA6: Copy the noun-phrase pattern into the node: first or second object
Ten bytes from $AAA8 to IY+4 (if E bit 6, which it clears) or to IY+$0E (if E bit 7); returns NZ, or Z if neither bit was set.
Input
E Bit 6: first object waiting; bit 7: second object
IY The sentence node
Output
F NZ when stored; Z when neither was waiting
E The bit cleared
ACA6 BIT 6,E Test bit 6 of E - E bit 6 (a first object is waiting to be stored)?
ACA8 JR Z,$ACB2 If bit 6 of E is clear, skip ahead to ACB2
ACAA RES 6,E Clear bit 6 of E - Yes: clear it; the pattern goes to the node's +4 (first object)
ACAC PUSH DE Save DE on the stack
ACAD LD DE,$0004 Load DE with $0004
ACB0 JR $ACBB Skip ahead to ACBB
ACB2 BIT 7,E Test bit 7 of E - Otherwise E bit 7 (a second object)? If neither, return
ACB4 RET Z If bit 7 of E is clear, return
ACB5 RES 7,E Clear bit 7 of E - Clear it; the pattern goes to the node's +14
ACB7 PUSH DE Save DE on the stack
ACB8 LD DE,$000E Load DE with $000E
ACBB PUSH IY Save IY on the stack - HL = node + offset; copy the ten-byte pattern from $AAA8
ACBD POP HL Restore HL from the stack
ACBE ADD HL,DE Add DE to HL
ACBF LD DE,$AAA8 Point DE at $AAA8
ACC2 EX DE,HL Swap DE and HL
ACC3 LD BC,$000A Load BC with $000A
ACC6 LDIR Copy BC bytes from where HL points to where DE points, counting up
ACC8 POP DE Restore DE from the stack
ACC9 OR $01 Make A non-zero, which clears the zero flag, and hand that back to the caller - NZ: stored
ACCB RET Return to the caller
Prev: AC94 Up: Map Next: ACCC