C64 Spaceflight

An orbital flight sim written in 6502 assembly for the Commodore 64, running here on a small JavaScript C64. Burn to climb, coast to orbit, warp time to watch the orbit come round, and fly on to the moon.

Starting…

Joystick
Keys

On a keyboard: ← → turn, ↑ ↓ throttle, Space burns, and the keys above work as typed (+ − zoom too). On a phone, hold the keycaps.

Reading the HUD

ALT
Height above the surface of the body you are at, in world units (1234K: thousands)
AP / PE
Highest and lowest point of the predicted orbit around it (the yellow crosses)
ZOOM
0 is closest, 14 furthest
W
Time warp, ×1 to ×256 (held back near the ground, while burning, or when moving fast)
VX VY
Velocity relative to that body, as 8.8 hex: whole part, then fraction; FF.. is just below zero
THR
Throttle in percent, 16 steps: joystick up and down. It starts at 50, like Kerbal Space Program
CAM
SHIP follows you, PLNT centres the planet, MOON the moon
PLANET / MOON
Whose pull you are in (LANDED on the ground)

How it flies

Physics runs 50 times a second in the raster interrupt, in fixed point: 24.16 positions, 8.24 velocities, 0.32 accelerations, and gravity of exactly −GM/r³ · position from an exact r². The dotted line is a leapfrog predictor flying a ghost copy of the ship ahead, one orbit at a time.

The moon goes round on rails (its orbit is the grey dotted circle; O hides it). Within 2910 u of it you are in its zone of influence: positions are then relative to the moon and only the moon pulls, as with the spheres of influence in Kerbal Space Program.

Press P to see the cost: the border turns red while the physics runs.

Planet radius 512 u · surface gravity 0.02 u/frame² · engine up to 0.05 u/frame² · moon radius 128 u, 15 360 u out, ¼ the surface gravity · warp up to 256 frames per step