Running, and why a running jump goes higher

The jump lesson’s square with B to run. Running is faster, and a jump taken while running starts faster and pulls harder, so it goes higher and still comes down in good time. The program is 276 instructions in 616 bytes, built and checked the same way.

Play it here The cartridge, to play anywhere that plays NES cartridges: run.nes

On the screen

frame 150
frame 150
frame 170
frame 170
frame 430
frame 430
frame 445
frame 445

Two jumps, chosen by the speed

Holding B in Super Mario Bros. raises the top speed and the speed-up toward it. Jumping at different speeds showed that there are two jumps, not one that grows with speed: up to walking speed, one; any faster, the other, which starts faster and pulls harder on the way up and down. So a running jump is not a walking jump pushed further; it is a different set of numbers, picked at the moment of the jump. This cartridge picks the same way.

this cartridgeSuper Mario Bros.
top walking speed, pixels a frame1.51.5
top running speed, and frames of B to reach it2.5, 452.5, 45
walking jump: first speed up, pull with A held, pull after4, 30/256, 96/2564, 30/256, 96/256
running jump: the same5, 40/256, 144/2565, 40/256, 144/256
rise with A held 20 frames: walking, running63, 7563, 75
speed before the jump (sixteenths): the fastest light jump, the slowest strong one24.5, 25.3824, 25

As written

The part of the program this lesson is about. The whole program is a plain text file: run.s

;; Up and down: a new press of A on the ground starts a jump.
jump:
    LDA $03
    BNE air
    LDA $02
    EOR #$FF
    AND $01
    AND #$80
    BEQ done
;; How fast it was going chooses the jump: $18 is 0 for the light one,
;; 1 for the strong one (speed 25/16 or more).
    LDA #$00
    STA $18
    STA $16
    LDA $13
    CMP #$01
    BCC light
    BNE strong
    LDA $12
    CMP #$90
    BCC light
strong:
    INC $18
    LDA #$FB
    STA $17
    JMP leapt
light:
    LDA #$FC
    STA $17
leapt:
    LDA #$01
    STA $03

All the lessons