| Character buffers

The character buffers occupy bytes 0x00-0x18 in pages 0xD7-0xDD and bytes 0x00-0x1F in pages 0xDE-0xE6.

The buffers in pages 0xD7-0xDD are each shared by a group of five minor characters. Which one of the five characters 'owns' the buffer at any one time depends on the portion of the play area that is currently on screen. When the screen scrolls left or right, ownership of one of the buffers switches to the next or previous character in the group. See the routines at F18E and F1BA.

The buffers in pages 0xDE-0xE6 are used mostly by the principal characters, depending on the current game mode (0-4).

Page | Address | Character |  | Page | Address | Character |  | Page | Address | Character
0xD7 | D700 | Various |  | 0xDD | DD00 | Various |  | 0xE3 | E300 | Sniper (modes 1-4)
0xD8 | D800 | Various |  | 0xDE | DE00 | Policeman (modes 0-3) |  | 0xE4 | E400 | Banknote
0xD9 | D900 | Various |  | 0xDF | DF00 | Policeman (modes 1-3) |  | 0xE5 | E500 | Banknote; hook
0xDA | DA00 | Various |  | 0xE0 | E000 | Gangster |  | 0xE6 | E600 | Sam
0xDB | DB00 | Various |  | 0xE1 | E100 | Fat Man (mode 2); Lana (mode 3)
0xDC | DC00 | Various |  | 0xE2 | E200 | Daisy (modes 0-3)

The bytes in each character buffer are used as follows:

Byte(s) | Contents
--- | ---
0x00 | Animatory state
0x01,0x02 | Location (x, y)
0x03 | Various flags:
Bit(s) | Meaning if set
--- | ---
0-3 | Unused
4 | Unused (always reset, but checked by F1FC)
5 | Unused
6 | Character should be moved (see F1FC)
7 | Character is running (see F1FC)
0x04 | z-coordinate: 1=indoors; 2=outside, behind people on the sidewalk; 4=on the sidewalk or road; 8=invisible
0x05 | Post-midstride animatory state (see EBBB, EC5A)
0x06 | Post-midstride x-coordinate (see EBBB, EC5A)
0x07 | Post-midstride y-coordinate (see EBBB, EC5A, ECE1, FB52)
0x08 | LSB of the primary command routine address (see F1FC)
Sam's main action timer (see 6100, 64BD, 71DD, 74D8, 77D3, ECE1, F02B, FB52)
0x09 | MSB of the primary command routine address (see F1FC)
Sam's midstride/mid-action timer (see 71DD, ECE1, F02B)
0x0A | Destination x-coordinate (see 7083, 7190, 72B1, 7996, 7C40, 7CC8, ED8C, F600)
Walkabout origin x-coordinate (see F748, F82A)
Counter used by the sniper to decide when to appear (see 62DB)
1 if the banknote has just been landed on by Sam, 0 otherwise (see 634C, 63C3)
0x0B | Destination y-coordinate (see 7190, 72B1, 7996, 7CC8, ED8C, F600)
Walkabout destination x-coordinate for a cat (see F82A)
LSB of the address of the door knock status flags for the door (if any) that the character is on duty for (see 7A6A, F748, F820)
0x0C | Roll/somersault animation phase table entry address LSB (see 64BD)
Destination location identifier (see 7083, 7190, 72B1, 7996, 7C40, 7CC8, ED8C, F600)
Walkabout duration indicator (0x00=indefinite, 0xFF=finite) (see 7A6A, F748, F820)
0x0D | Roll/somersault animation phase table entry address MSB (see 64BD)
0 if Sam has only just met Lana, 1 otherwise (see 6100)
Pre-knockout animatory state (see FA05, FA83)
Number of mini-walkabouts remaining (see 7A6A, F748)
Location/destination indicator: 2 if the character is not on the sidewalk or the road, and is not in the same region as his destination; 1 if the character is not on the sidewalk or the road, and is in the same region as his destination; 0 if the character is on the sidewalk or the road, or on the front steps of the hotel but heading somewhere other than the hotel (see 7C40, ED8C, F600)
1 if Sam has stepped off or been dropped off the the roof of a building to the ground from a great enough height that he could be knocked out when he lands; 0 otherwise (see FAE3, FB52)
0x0E,0x0F | Interruptible subcommand routine address (see F1FC)
0x10 | Walkabout destination x-coordinate (see F6E9, F748)
Intermediate destination x-coordinate (see F5CE, F600)
Intermediate destination y-coordinate (see F5AC, F600)
Counter used by the sniper to decide when to duck and when to shoot (see 621E, 62DB)
LSB of the address of the door knock status flags (see 7FAA) for the door the character has knocked on (see F346, F359)
Counter that determines how much longer a policeman will keep knocking on a door before busting it open (see F375, F383)
0x11 | Delay counter used by the sniper after firing a bullet (see 621E, 62DB)
Counter that determines how much longer the character will wait for a door to be opened before giving up (see F346, F359)
Counter that determines the delay until the character will consider flipping a light switch or raising or lowering a window blind (see F6E9)
0x12,0x13 | Uninterruptible subcommand routine address (see F1FC)
0x14 | Telephone dialling sound effect counter (see 77D3)
Distance remaining for the hook to fly (see 7BE1)
Knockout and recovery delay counter (see FA05)
Animation phase counter used when a character has just stepped off the roof of a building (see FAE3, FB52)
0x15 | Pre-knockout x-coordinate (see FA05, FA83)
Landing y-coordinate (see FB52)
0x16 | Offset of the point reached in the current command list (relative to the start) (see F15F)
0x17,0x18 | Start address of the command list (see F15F, F1FC)
0x19,0x1A | Unused (but see F1FC)
0x1B,0x1C | Unused (but checked by F1FC for a continual subcommand routine address)
0x1D | ID of Sam's disguise (bits 5-7) when he was last spotted (but not recognised) by the policeman, and the corresponding disguise timeout counter (bits 0-4) (see 71AC, 7222, 72B1, 7377)
0x1E | Sam's x-coordinate when he was last spotted by the policeman while wearing a disguise unknown to the police (see 71AC, 7222)
0x1F | Sam's y-coordinate (bits 0-5) and z-coordinate (bits 6-7) when he was last spotted by the policeman while wearing a disguise unknown to the police (see 71AC, 7222)