What Logic dictates and what actually happens.
The black squares represent wall tiles
Left block diagram: part 1: willy occupies the red squares and is trying to move upward and left. All checks to the left indicate that the two blues squares are free but the lower square contains a wall (black square). movement left is blocked. Movement vertically is free. So willy moves upward.
Middle block diagram: Part 2: willy at this point is cell aligned and still moving upward and left. The orange squares are checked and found to be free. Willy is moved left and upward into the squares.
The arc of his flight moves onward till we arrive at picture 3
Right block diagram: Part 3: willy is cell aligned and wants to move left and downward. The question here is are the cells/squares in green free to move into. The answer being yes. Willy should be moved across the cell boundary into the green squares.
But in part 3 JSW has a specific check, that affects the outcome:-
Willy is falling and the code (listed) below checks for what is beneath his feet. Even though at this point willy will not actually enter both of the squares that are checked below his feet. Willy is moving diagonally downward, and he moves both vertically and horizontally across cell boundaries. The check below does not move horizontally across the cell boundary and checks directly beneath Willies feet. (this is a bug)
*** Note the problem is due to incorrect horizontal cell checking.
This incorrect cell check, stops the jump and Willy lands on the wall.
The complete Jet Set Willy RAM disassembly 20171113
© 1984 Software Projects Ltd. © 2017 Richard Dymond.
Created using SkoolKit 6.1.
If we get here, then Willy is standing on the floor or a ramp, or he's falling, or his jumping animation counter is 13 (at which point Willy is on his way down and is exactly two cell-heights above where he started the jump) or 16 (at which point Willy is on his way down and is exactly one cell-height above where he started the jump).
8E36 LD A,($85CF) Pick up Willy's pixel y-coordinate from 85CF
8E39 AND $0E Is Willy either on a ramp, or occupying only four cells?
8E3B JR NZ,$8E62 Jump if not
8E3D LD HL,($85D3) Pick up Willy's attribute buffer coordinates from 85D3
8E40 LD DE,$0040 Point HL at the left-hand cell below Willy's sprite
8E43 ADD HL,DE
8E44 BIT 1,H Is this location below the floor of the current room?
8E46 JP NZ,$94D2 If so, move Willy into the room below
8E49 LD A,($80BB) Pick up the attribute byte of the nasty tile for the current room from 80BB
8E4C CP (HL) Does the left-hand cell below Willy's sprite contain a nasty?
8E4D JR Z,$8E62 Jump if so
8E4F INC HL Point HL at the right-hand cell below Willy's sprite
8E50 LD A,($80BB) Pick up the attribute byte of the nasty tile for the current room from 80BB (again, redundantly)
8E53 CP (HL) Does the right-hand cell below Willy's sprite contain a nasty?
8E54 JR Z,$8E62 Jump if so
8E56 LD A,($80A0) Pick up the attribute byte of the background tile for the current room from 80A0
8E59 CP (HL) Set the zero flag if the right-hand cell below Willy's sprite is empty
8E5A DEC HL Point HL at the left-hand cell below Willy's sprite
8E5B JP NZ,$8ED4 >> Jump if the right-hand cell below Willy's sprite is not empty
8E5E CP (HL) Is the left-hand cell below Willy's sprite empty?
8E5F JP NZ,$8ED4 >> Jump if not
8E62 LD A,($85D1) Pick up the airborne status indicator from 85D1
8E65 CP $01 Is Willy jumping?
8E67 JP Z,$8FBC Jump if so
The above logic flaw is why he lands on a wall, that his parabolic arc should have permitted him to cross.
Note also that this flaw extends into the checks for nasties (which kill). And results in Willies inability to jump nasties at head height.
. 2nd diagram might improve clarity. (willy outline is not indicative of animation frame)
Edited by Norman Sword, 09 January 2018 - 03:25 PM.