| Data

33800: Left-right movement table

Used by the routine at 35805. The entries in this table are used to map the existing value (V) of Willy's direction and movement flags at 32874 to a new value (V'), depending on the direction Willy is facing and how he is moving or being moved (by 'left' and 'right' keypresses and joystick input, or by a conveyor). One of the first four entries is used when Willy is not moving.
33800 | DEFB 0 | V=0 (facing right, no movement) + no movement: V'=0 (no change)
33801 | DEFB 1 | V=1 (facing left, no movement) + no movement: V'=1 (no change)
33802 | DEFB 0 | V=2 (facing right, moving) + no movement: V'=0 (facing right, no movement) (i.e. stop)
33803 | DEFB 1 | V=3 (facing left, moving) + no movement: V'=1 (facing left, no movement) (i.e. stop)
One of the next four entries is used when Willy is moving left.
33804 | DEFB 1 | V=0 (facing right, no movement) + move left: V'=1 (facing left, no movement) (i.e. turn around)
33805 | DEFB 3 | V=1 (facing left, no movement) + move left: V'=3 (facing left, moving)
33806 | DEFB 1 | V=2 (facing right, moving) + move left: V'=1 (facing left, no movement) (i.e. turn around)
33807 | DEFB 3 | V=3 (facing left, moving) + move left: V'=3 (no change)
One of the next four entries is used when Willy is moving right.
33808 | DEFB 2 | V=0 (facing right, no movement) + move right: V'=2 (facing right, moving)
33809 | DEFB 0 | V=1 (facing left, no movement) + move right: V'=0 (facing right, no movement) (i.e. turn around)
33810 | DEFB 2 | V=2 (facing right, moving) + move right: V'=2 (no change)
33811 | DEFB 0 | V=3 (facing left, moving) + move right: V'=0 (facing right, no movement) (i.e. turn around)
One of the final four entries is used when Willy is being pulled both left and right; each entry leaves the flags at 32874 unchanged (so Willy carries on moving in the direction he's already moving, or remains stationary).
33812 | DEFB 0 | V=V'=0 (facing right, no movement)
33813 | DEFB 1 | V=V'=1 (facing left, no movement)
33814 | DEFB 2 | V=V'=2 (facing right, moving)
33815 | DEFB 3 | V=V'=3 (facing left, moving)