Sherlock: annotated disassembly

State bits: asleep, dead and the rest

Almost everything that can change about a person or object in Sherlock is a bit in its record. This page lists them: what each bit means, which things have it, and what the game does with it. The bytes below are offsets in an entity record (the things listed by the index at 8B6F).

Asleep, unconscious, dead

These are not three bits. Each is a combination of three parts of the record:

StateWho and whenWhat changes
AsleepThe gardener, the cook and Strachan at 9pm (9ED1, 9EC1); Phipps in the night script (EFB3).The state word becomes SLEEPING ($07F0), the article nibble becomes 1, and the person bit is cleared. The gardener and cook also go off stage, and Strachan is moved to Daphne's room (74). Waking puts the person bit back and clears the word.
UnconsciousThe local police man, when the Major knocks him out (F1A8).The state word becomes UNCONSCIOUS ($0910), the article nibble becomes 2, and the person bit is cleared. Straker reviving him (ED39) puts back LOCAL ($050B), nibble 1 and the person bit.
DeadThe female corpse (46) and the body (72).The thing is not a person: bit 6 is clear. A check that needs the person bit and does not find it prints the word DEAD from the flag table at C471.
Burning, singed, burntThe note Phipps burns (85).BURNING ($0157) is replaced by SINGED ($07D5) when it is taken, or BURNT ($015B) when the countdown at 9CA1 runs out (9CA2).

The flag byte, +5

Eight bits of condition. The flag-word tables at C471 (a bit that is needed but missing) and C481 (a bit that is present but forbidden) give the words that "THE ... IS ..." messages print.

BitMaskMeaningDetails
7$80Revealed (visible)Set on everything the player can see. A thing with this bit clear is hidden: C821 says it cannot be seen, and EXAMINE needs it set. 9C56 sets it and 9C60 clears it. The torn note, the false bottom and the large rock start hidden and are revealed by examining the place that holds them; the steam trains are hidden until 9C41 moves one, which sets the bit.
6$40Person (alive and able to act)Set on every character who is in play. What a person holds is introduced with "<name> IS CARRYING", and a person can be talked to. Clearing it is how the game makes someone asleep or unconscious (EFB3, 9ED1, F1A8). The flag-word table at C471 names the missing bit DEAD, so a check that needs a living person and finds the bit clear would say "IS DEAD". There is no separate "dead" bit: the dead are things with this bit clear, such as the female corpse (46) and the body (72).
5$20OpenSet when a door, window, drawer or similar thing is open. OPEN sets it and CLOSE clears it (the two shared actions at DE9D and DEAF); OPEN refuses a thing that has it set ("IS OPEN") and CLOSE refuses one that has it clear ("IS CLOSED"). The containment walk at C86E lets what is inside a holder be seen only when the holder has this bit or bit 3 set. The cabs and trains have it set, and so do the large rock and the burning note.
4$10On (alight)Set on the oil lamp when it is lit; the flag-word tables call the opposite OFF and this ON. The cabs and trains have it set. The light test at D078 needs a thing in reach that is on and full.
3$08Contents can be seenThe second way, besides bit 5, that a holder lets the things inside it be seen (C86E). It is not set on any thing at the start of the game, and there is no word for it in the flag tables.
2$04FullSet on the oil lamp, the cabs, the trains and the deep stream. The flag-word tables call the opposite EMPTY and this FULL. The lamp must be both on and full to give light.
1$02Not used by any check foundSet only on the deep stream (59). No verb record, flag table or light test reads it.
0$01LockedSet on the doors and windows that start locked (the front doors, the windows). The flag tables call the opposite UNLOCKED and this LOCKED. OPEN refuses a thing that has it set ("IS LOCKED"); the script helpers at F203 and F210 clear and set it.

Common values: $80 an ordinary visible thing, $A0 a visible thing that is open (or a person who is asleep or unconscious), $E0 a person in play, $81 a locked door, $B4 a cab (visible, open, on and full), $34 a train that is out of sight.

How a verb tests these bits

A verb's action record can carry a pair of masks and modes for the direct and indirect objects' +5 bytes (C74E). Mode 0 needs every mask bit set, 1 needs at least one, 2 needs none, 3 not all. EXAMINE needs bit 7; OPEN needs bits 5 and 0 clear; CLOSE needs bit 5 set. On failure the offending bits go to CB79 and CB7B prints "THE ... IS ..." with the word from the table.

The second flag byte, +6

BitMaskMeaningDetails
7$80SeenSet on every thing that has been listed in a room description (D526 sets it as it names each one). A piece of case evidence of the plain kind needs both of its things seen (BE91).
6$40ExaminedSet by EXAMINE (DF5B). Evidence of the second kind needs both things examined.
5$20CountableSet on the money things (27, 28, 32 and 35). COUNT needs it (E31C).

The type byte, +4

BitsMaskMeaningDetails
7$80Needs lightSet on the player, the china man, the old man and the cabbies; an actor with it set can be "too dark to see" (D078). It is also set on the oil lamp and the vehicles.
6-4$70Kind of passengerGET INTO a cab needs the thing at the cab's +3 and the actor to share one of these three bits (E3B8): Lestrade, Watson, Straker, the police men, Tricia Fender and Mrs Jones have $10; the Major, Strachan, Phipps, the gardener, the cook, the maid and the German agent have $40; the player has $10 too, and the china man and the old man have $20.
2-0$07How it holds things0: cannot hold things. 1 IN, 2 ON, 3 BEHIND, 4 UNDER, 5 TIED TO: the word printed by D5D3 when it lists what a thing holds. PUT IN refuses a thing whose bits 0-2 are all clear (DED9).

The case table, +3 of a statement

The statements and evidence of the case (the table at 9965) are four- or six-byte records; their byte 3 is a set of flags.

BitMaskMeaningDetails
0$01WaitingHolmes has told this statement and it has not yet been proven; Lestrade asks about it (BC46, 9DD8). Cleared when it is proven.
1$02Proven (done)The statement or piece of evidence has been established. Routines such as 9A74 set it. Once set it stays set.
2$04Has childrenThe evidence records that follow it, up to one with bit 3, are its sub-evidence; all must pass (BF08).
3$08Last in its groupCloses a level of sub-evidence (BE72).
4-5$30A routine followsThe record is six bytes, not four: the last two are the address of the routine that runs when it is proven (the Lestrade and Watson replies, 9A3D and so on). Bit 5 also marks the three "killed" statements: Watson matches those outright, while others he accepts only on a 50 per cent roll, and the waiting-statement check skips them.
6-7$C0Kind of test00: both things seen; 01: both examined; 10: only true once something else has marked it done; 11: no test of its own, only its group (BE91).