Sherlock: annotated disassembly

Routines

Prev: BB67 Up: Map Next: BC74
BC46: Check every statement that is waiting to be proven
Walks the case table (9965) and, for each statement with bit 0 set and bit 5 clear, tries to prove it (BCC9).
How it works:
1. Push every statement of the case table at 9965 that is waiting (bit 0 of +3 set) and is not one of the bit-5 kind, ending the list with a 0.
2. Pop them one at a time and try to prove each (BCC9).
Output
Each waiting statement of the case table checked and, if provable, marked
BC46 LD IX,$9965 Point IX at "The case: statements about the crime, and the..." (9965)
BC4A LD HL,$0000 Load HL with $0000 - A 0 on the stack marks the end of the list
BC4D PUSH HL Save HL on the stack
BC4E LD A,(IX+$00) Read the first byte of the record at IX into A - Walk the case table; $FF ends it
BC51 CP $FF Compare A with $FF
BC53 JR Z,$BC68 If A equals $FF, skip ahead to BC68
BC55 BIT 0,(IX+$03) Test bit 0 of byte +3 of the record at IX - Push each statement that is waiting (bit 0) and not of the bit-5 kind
BC59 JR Z,$BC63 If bit 0 of byte +3 of the record at IX is clear, skip ahead to BC63
BC5B BIT 5,(IX+$03) Test bit 5 of byte +3 of the record at IX
BC5F JR NZ,$BC63 If bit 5 of byte +3 of the record at IX is set, skip ahead to BC63
BC61 PUSH IX Save IX on the stack
BC63 CALL $BE5A Call the routine "Step IX over one case record (4 bytes, or 6 with a..." (BE5A) - Next statement (BE5A)
BC66 JR $BC4E Go back to BC4E
BC68 POP HL Restore HL from the stack - Then pop them one by one and try to prove each (BCC9)
BC69 LD A,H Copy H into A
BC6A OR L Set in A the bits that are set in L
BC6B RET Z If the result is zero, return
BC6C PUSH HL Save HL on the stack
BC6D POP IX Restore IX from the stack
BC6F CALL $BCC9 Call the routine "Try to prove statement IX" (BCC9)
BC72 JR $BC68 Go back to BC68
Prev: BB67 Up: Map Next: BC74