Sherlock: annotated disassembly

Data

Prev: 994D Up: Map Next: 99FC
9965: The case: statements about the crime, and the evidence each needs
Eleven groups. Each starts with a statement record: +0 a thing or person, +1 a relation number, +2 another thing; +3 flags; and, with bit 4 or 5 of the flags, +4/+5 a routine run when it is proven. Bit 2 of the flags opens a group of evidence records (+0 and +2 are things, +1 is 0) and bit 3 closes it; BE5A steps over one record and BE72 over a whole group. In the state bits, bit 0 means the statement is waiting to be proven and bit 1 that it has been (BCC9 sets bit 1 and runs the routine once the evidence checks out through BF08; 9A74 does the same from a routine).
With the relation words filled in (994D) the statements read as sentences: MAJOR PERCIVAL FFOULKES IS INNOCENT, MRS BROWN KILLED HERSELF, MRS JONES KILLED TRICIA FENDER, PHIPPS HAS PLANS, SALE LOCATION IS OLD MILL ROAD, TRICIA FENDER HAD PLANS, TRICIA FENDER BLACKMAILED MRS BROWN, and four with no evidence and no routine (flags $B4: bit 5 set) saying that Tricia Fender or Phipps killed one of the two victims. The order is as stored (first thing, verb, second thing), which is also the order the player's words are matched in (BD69). Some groups also hold a statement as evidence (MAJOR PERCIVAL FFOULKES VISITED OPIUM DEN, under the Major's innocence). An evidence record with relation 0 is a pair of things that the player must have seen (BE91: flags $00, both things' +6 bit 7) or examined (flags $40, +6 bit 6).
So nothing visible yet separates the bit-5 statements.
How a piece of evidence is checked: the top two bits of its flags choose the test. $00: both things seen (+6 bit 7); $40: both examined (+6 bit 6); $80: never true by itself - it only counts once something else has marked it done (bit 1), as the statement routines do through 9A74, so a nested statement such as MAJOR PERCIVAL FFOULKES VISITED OPIUM DEN ($8C) has to be established first; $C0: no test of its own, only its group. A record with children (bit 2) also needs all of them (BF08). Once a piece of evidence passes it is marked done and stays so.
With bit 1 of $9972 set first - as F103 does when the Major confesses - the opium-den statement is proven, the waiting innocence statement is proven with it ($9968 $A5 -> $A6), 9A3D sets $9E88 and Lestrade says 'Very good Holmes, I shall return to Leather head tomorrow to have another look around.'
This is what Lestrade's 'WELL CAN YOU PROVE THAT ...
9965 DEFB $07,$04,$62,$A4,$3D,$9A Statement: 7 major percival ffoulkes / IS / 98 innocent; flags $A4; when proven 9A3D
996B DEFB $07,$06,$63,$8C Evidence statement: 7 major percival ffoulkes / VISITED / 99 opium den; flags $8C (last of the group)
996F DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
9973 DEFB $5E,$05,$60,$A4,$4B,$9A Statement: 94 mrs brown / KILLED / 96 herself; flags $A4; when proven 9A4B
9979 DEFB $2E,$00,$39,$40 Evidence: 46 female corpse / 57 sandstone bridge; flags $40
997D DEFB $5D,$00,$5D,$08 Evidence: 93 large rock / 93 large rock; flags $08 (last of the group)
9981 DEFB $5F,$05,$0D,$A4,$59,$9A Statement: 95 mrs jones / KILLED / 13 tricia fender; flags $A4; when proven 9A59
9987 DEFB $48,$00,$42,$40 Evidence: 72 body / 66 bookcase; flags $40
998B DEFB $43,$00,$43,$40 Evidence: 67 bloodstained clothes / 67 bloodstained clothes; flags $40
998F DEFB $00,$00,$00,$00 (empty; flags $00)
9993 DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
9997 DEFB $06,$03,$61,$A4,$13,$9A Statement: 6 phipps / HAS / 97 plans; flags $A4; when proven 9A13
999D DEFB $57,$00,$58,$40 Evidence: 87 unfinished note / 88 folder; flags $40
99A1 DEFB $5A,$00,$53,$40 Evidence: 90 letters / 83 ripped coded baker note; flags $40
99A5 DEFB $51,$00,$51,$48 Evidence: 81 torn coded ?0f8 note / 81 torn coded ?0f8 note; flags $48 (last of the group)
99A9 DEFB $6A,$04,$69,$A4,$FC,$99 Statement: 106 sale location / IS / 105 old mill road; flags $A4; when proven 99FC
99AF DEFB $00,$00,$00,$00 (empty; flags $00)
99B3 DEFB $55,$00,$55,$40 Evidence: 85 burning note / 85 burning note; flags $40
99B7 DEFB $00,$00,$00,$0A (empty; flags $0A) (last of the group)
99BB DEFB $0D,$05,$5E,$B4,$00,$00 Statement: 13 tricia fender / KILLED / 94 mrs brown; flags $B4
99C1 DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
99C5 DEFB $0D,$05,$5F,$B4,$00,$00 Statement: 13 tricia fender / KILLED / 95 mrs jones; flags $B4
99CB DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
99CF DEFB $06,$05,$5E,$B4,$00,$00 Statement: 6 phipps / KILLED / 94 mrs brown; flags $B4
99D5 DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
99D9 DEFB $06,$05,$5F,$B4,$00,$00 Statement: 6 phipps / KILLED / 95 mrs jones; flags $B4
99DF DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
99E3 DEFB $0D,$02,$61,$A4,$05,$9A Statement: 13 tricia fender / HAD / 97 plans; flags $A4; when proven 9A05
99E9 DEFB $40,$00,$41,$40 Evidence: 64 bank account ?01d book / 65 note; flags $40
99ED DEFB $57,$00,$58,$48 Evidence: 87 unfinished note / 88 folder; flags $48 (last of the group)
99F1 DEFB $0D,$01,$5E,$A4,$0A,$9A Statement: 13 tricia fender / BLACKMAILED / 94 mrs brown; flags $A4; when proven 9A0A
99F7 DEFB $00,$00,$00,$08 (empty; flags $08) (last of the group)
99FB DEFB $FF End marker
Prev: 994D Up: Map Next: 99FC