Jet Set Willy: Game status buffer

| Game status buffer

Address | Length | Description
--- | --- | ---
8000 | 128 | Room layout Initialised upon entry to a room and then used by the routine at 8912, and also used by the routine at 8D6B.
8080 | 32 | Room name Initialised upon entry to a room and then used by the routine at 8912.
80A0 | 54 | Room tiles Initialised upon entry to a room by the routine at 8912.
80D6 | 4 | Conveyor definition Initialised upon entry to a room by the routine at 8912.
80DA | 4 | Ramp definition Initialised upon entry to a room by the routine at 8912.
80DE | 1 | Border colour Initialised upon entry to a room and then used by the routine at 8912, and also used by the routines at 8B07, 8DD3, 91BE and 93D1.
80E1 | 8 | Item graphic Initialised upon entry to a room by the routine at 8912, and used by the routine at 93D1.
80E9 | 4 | Room exits Initialised upon entry to a room by the routine at 8912.
80F0 | 16 | Entity specifications Initialised upon entry to a room and then used by the routine at 8912. There are eight pairs of bytes here that hold the entity specifications for the current room. The first byte in each pair identifies one of the entity definitions at A000. The meaning of the second byte depends on the entity type: it determines the base sprite index and x-coordinate of a guardian, the y-coordinate of an arrow, or the x-coordinate of the top of a rope.
8100 | 65 | Entity buffers Initialised by the routine at 8912, and used by the routines at 90C0 and 91BE. There are eight buffers here, each one eight bytes long, used to hold the state of the entities (rope, arrows and guardians) in the current room. For a horizontal guardian, the eight bytes are used as follows:
Byte | Contents
--- | ---
0 | Bit 7: direction (0=left, 1=right)
Bits 5-6: animation frame index
Bits 3-4: unused
Bits 0-2: entity type (001)
1 | Bits 5-7: animation frame index mask
Bit 4: unused
Bit 3: BRIGHT value
Bits 0-2: INK colour
2 | Bits 5-7: base sprite index
Bits 0-4: x-coordinate
3 | Pixel y-coordinate x2 (index into the table at 8200)
4 | Unused
5 | Page containing the sprite graphic data (see AB00)
6 | Minimum x-coordinate
7 | Maximum x-coordinate
For a vertical guardian, the eight bytes are used as follows:
Byte | Contents
--- | ---
0 | Bits 5-7: animation frame index
Bits 3-4: animation frame update flags (see 917F)
Bits 0-2: entity type (010)
1 | Bits 5-7: animation frame index mask
Bit 4: unused
Bit 3: BRIGHT value
Bits 0-2: INK colour
2 | Bits 5-7: base sprite index
Bits 0-4: x-coordinate
3 | Pixel y-coordinate x2 (index into the table at 8200)
4 | Pixel y-coordinate increment
5 | Page containing the sprite graphic data (see AB00)
6 | Minimum y-coordinate
7 | Maximum y-coordinate
For an arrow, the eight bytes are used as follows:
Byte | Contents
--- | ---
0 | Bit 7: direction (0=left, 1=right)
Bits 3-6: unused
Bits 0-2: entity type (100)
1 | Unused
2 | Pixel y-coordinate x2 (index into the table at 8200)
3 | Unused
4 | x-coordinate
5 | Collision detection byte (0x00=off, 0xFF=on)
6 | Top/bottom pixel row (drawn either side of the shaft)
7 | Unused
The rope uses the second and fourth bytes of the following buffer in addition to its own; these ten bytes are used as follows:
Byte | Contents
--- | ---
0 | Bit 7: direction (0=left, 1=right)
Bits 3-6: unused
Bits 0-2: entity type (011)
1 | Animation frame index
2 | x-coordinate of the top of the rope
3 | x-coordinate of the segment of rope being drawn
4 | Length (0x20)
5 | Segment drawing byte
6 | Unused
7 | Animation frame at which the rope changes direction (0x36)
9 | Index of the segment of rope being drawn (0x00-0x20)
11 | Bits 1-7: unused
Bit 0: Willy is on the rope (set), or not (reset)
Note that if a rope were the eighth entity specified in a room, its buffer would use the first and third bytes in the otherwise unused area at 8141.
8420 | 1 | Current room number Initialised to 0x21 (The Bathroom) by the routine at 87CA, checked by the routines at 8912, 91BE, 93D1, 9534, 9584, 959A and 9637, and updated by the routines at 8B07, 948A, 949E, 94B0 and 94D2.
857C | 3 | Number of items collected Initialised by the routine at 87CA, printed by the routine at 89AD, and updated by the routine at 93D1.
857F | 6 | Current time Initialised by the routine at 88FC, and printed and updated by the routine at 89AD.
85CB | 1 | Minute counter Initialised by the routine at 87CA; incremented on each pass through the main loop by the routine at 89AD (which moves the game clock forward by a minute when the counter reaches 0); reset to zero by the routine at 9584 when Willy sticks his head down the toilet; and used by the routines at 93D1 (to cycle the colours of the items in the room), 9534 (to determine Maria's animation frame in Master Bedroom) and 959A (to determine the animation frame for the toilet in The Bathroom).
85CC | 1 | Lives remaining Initialised to 7 by the routine at 87CA, decremented by the routine at 8C01, and used by the routines at 898B (when drawing the remaining lives) and 8B07 (to adjust the speed and pitch of the in-game music).
85CD | 1 | Screen flash counter Initialised to zero by the routine at 87CA, but never used; the code at 8A0B makes the screen flash in Manic Miner fashion if this address holds a non-zero value.
85CE | 1 | Kempston joystick indicator Initialised by the routine at 87CA, and checked by the routines at 8ED4 and 96C9. Holds 1 if a joystick is present, 0 otherwise.
85CF | 1 | Willy's y-coordinate Initialised to 208 by the routine at 87CA, and used by the routines at 89AD, 8B07, 8DD3, 8ED4, 8FBC, 91BE, 94B0, 94D2, 9534, 95C8 and 9637. Holds the LSB of the address of the entry in the screen buffer address lookup table at 8200 that corresponds to Willy's pixel y-coordinate; in practice, this LSB is twice Willy's actual pixel y-coordinate. Note that when Willy is standing on a ramp, this holds his y-coordinate rounded down to the nearest multiple of 16 (8x2).
85D0 | 1 | Willy's direction and movement flags
Bit(s) | Meaning | Used by
--- | --- | ---
0 | Direction Willy is facing (reset=right, set=left) | 8ED4, 8FBC, 9637
1 | Willy's left/right movement flag (set=moving) | 8DD3, 8ED4, 8FBC, 91BE
2-7 | Unused (always reset) |
85D1 | 1 | Airborne status indicator Initialised by the routine at 87CA, checked by the routines at 8B07, 8FBC and 95C8, updated by the routines at 90B6, 91BE and 94B0, and checked and updated by the routines at 8DD3, 8ED4 and 94D2. Possible values are:
Value | Meaning
--- | ---
0x00 | Willy is neither falling nor jumping
0x01 | Willy is jumping
0x02-0x0B | Willy is falling, and can land safely
0x0C-0x0F | Willy is falling, and has fallen too far to land safely
0xFF | Willy has collided with a nasty, an arrow, a guardian, or Maria (see 90B6)
85D2 | 1 | Willy's animation frame Used by the routines at 95C8 and 9637, and updated by the routines at 89AD, 8FBC and 91BE. Possible values are 0, 1, 2 and 3.
85D3 | 2 | Address of Willy's location in the attribute buffer at 5C00 Initialised by the routine at 87CA, and used by the routines at 8DD3, 8FBC, 91BE, 948A, 949E, 94B0, 94D2, 9534, 9584, 95C8 and 9637.
85D5 | 1 | Jumping animation counter Used by the routines at 8DD3 and 8ED4.
85D6 | 1 | Rope status indicator Initialised by the routine at 8912, checked by the routines at 8DD3 and 8FBC, and checked and updated by the routines at 8ED4 and 91BE. Possible values are:
Value | Meaning
--- | ---
0x00 | Willy is not on the rope
0x03-0x20 | Willy is on the rope, with the centre of his sprite anchored at this segment
0xF0-0xFF | Willy has just jumped or fallen off the rope
85D7 | 7 | Willy's state on entry to the room Initialised by the routine at 8912, and copied back into 85CF-85D5 by the routine at 8C01.
85DE | 1 | 256 minus the number of items remaining Initialised by the routine at 87CA, and updated by the routine at 93D1 when an item is collected.
85DF | 1 | Game mode indicator Initialised by the routine at 87CA, checked by the routines at 89AD, 8ED4 and 959A, and updated by the routines at 93D1, 9534 and 9584.
Value | Meaning
--- | ---
0 | Normal
1 | All items collected
2 | Willy is running to the toilet
3 | Willy's head is down the toilet
85E0 | 1 | Inactivity timer Initialised by the routine at 87CA, and updated by the routines at 89AD, 8B07 and 8ED4.
85E1 | 1 | In-game music note index Initialised by the routine at 87CA, used by the routine at 898B, and used and updated by the routine at 8B07.
85E2 | 1 | Music flags The keypress flag in bit 0 is initialised by the routine at 87CA; bits 0 and 1 are checked and updated by the routine at 8B07.
Bit(s) | Meaning
--- | ---
0 | Keypress flag (set=H-ENTER being pressed, reset=no key pressed)
1 | In-game music flag (set=music off, reset=music on)
2-7 | Unused
85E3 | 1 | WRITETYPER key counter Checked by the routine at 89AD, and updated by the routine at 8B07.
85E4 | 1 | Temporary variable Used by the routines at 86C3 and 873C to hold the entry code, by the routine at 87CA to hold the index into the message scrolled across the screen after the theme tune has finished playing, and by the routine at 8C4A to hold the distance of the foot from the top of the screen as it descends onto Willy.