Prev: 8407 Up: Map Next: 8418
8408: Left-right movement table
Used by the routine at 8BDD. The entries in this table are used to map the existing value (V) of Willy's direction and movement flags at 806A 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.
8408 DEFB $00 V=0 (facing right, no movement) + no movement: V'=0 (no change)
8409 DEFB $01 V=1 (facing left, no movement) + no movement: V'=1 (no change)
840A DEFB $00 V=2 (facing right, moving) + no movement: V'=0 (facing right, no movement) (i.e. stop)
840B DEFB $01 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.
840C DEFB $01 V=0 (facing right, no movement) + move left: V'=1 (facing left, no movement) (i.e. turn around)
840D DEFB $03 V=1 (facing left, no movement) + move left: V'=3 (facing left, moving)
840E DEFB $01 V=2 (facing right, moving) + move left: V'=1 (facing left, no movement) (i.e. turn around)
840F DEFB $03 V=3 (facing left, moving) + move left: V'=3 (no change)
One of the next four entries is used when Willy is moving right.
8410 DEFB $02 V=0 (facing right, no movement) + move right: V'=2 (facing right, moving)
8411 DEFB $00 V=1 (facing left, no movement) + move right: V'=0 (facing right, no movement) (i.e. turn around)
8412 DEFB $02 V=2 (facing right, moving) + move right: V'=2 (no change)
8413 DEFB $00 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 806A unchanged (so Willy carries on moving in the direction he's already moving, or remains stationary).
8414 DEFB $00 V=V'=0 (facing right, no movement)
8415 DEFB $01 V=V'=1 (facing left, no movement)
8416 DEFB $02 V=V'=2 (facing right, moving)
8417 DEFB $03 V=V'=3 (facing left, moving)
Prev: 8407 Up: Map Next: 8418