The ship never moves on the screen. Steering and thrust become this pass's scroll, 2 or 4 pixels, and the world moves the other way. Its picture is rebuilt in RAM from the add-ons it carries whenever one is fitted.

The record

ship_record is 32 bytes in the objects' layout (see the objects), reset each life from ship_record_start. Because the ship stays put on the screen, its world position is the view's: +1 to +3 the map column and x in the page, +4 to +6 the row and y; ship_facing its facing (bit 7 left); ship_across_speed and ship_down_speed its two speeds, 8.8 numbers high byte first, in units of 2 pixels a pass; ship_screen_x and ship_screen_y its place on the screen; part_being_fitted an add-on or rocket part being fitted. The byte after it, ore, is the ore aboard.

One pass

ship_pass counts the pass, saves a restart point every fourth, and unless the ship is dying calls move_ship: read_controls reads the controls (and burns fuel), the speed across goes through accelerate_across and speed_to_scroll into scroll_across, and the climb through clamp_climb and climb_fraction into scroll_down. Then the record is moved against the scroll (ship_speed_from_scroll), tested against the landscape (collide_with_landscape, see collision) and the ground objects (ship_hits_ground_objects), and the landscape scrolls.

The constants

Read from the game, in 256ths of a speed unit a pass (a unit being 2 pixels a pass):

LabelValueUnits a passWhat
gravity-$40-0.2500added to the climb speed each pass when not thrusting
thrust+$50+0.3125added instead while thrusting
push_right-$40-0.2500steering right (the speed is kept in the scroll's sense, so negative)
push_left+$40+0.2500steering left
no_push+$00+0.0000not steering
drag_going_left-$0C-0.0469against a ship going left
drag_going_right+$0C+0.0469against a ship going right

Thrust replaces gravity rather than adding to it, so thrust beats gravity by only $10 a pass. Across, the drag is ignored when steering the way the ship already goes and added when steering against it, so reversing is quicker than speeding up; with nothing held the drag alone slows the ship, and accelerate_across turns a speed that would change sign into 0. clamp_speed_across keeps the speed across to half the top speed (top_speed: 2, or 4 with add-on 4) one way and one more the other; clamp_climb keeps the climb to -3 down and half the top climb (top_climb: 2, or 4 with add-on 5) up. speed_to_scroll adds the speed to ship_position_across and the step is twice the change in its high byte: the screen moves in 2-pixel steps, and a 4-pixel step only from a fine scroll of 0 or 4, so that it stays even.

The keyboard never sets down: the ship comes down by gravity alone. No thrust is read while the view is on map row 5 (row 0 with add-on 5) and its line in the page is above $60, so without the lift jet the ship cannot climb into the top of the sky; while the special beam is out the ship hangs still; docked with the finished rocket, nothing is read at all.

Worked example: from the start of a game, the simulator stopped at $C3E0 each pass (the speeds after the landscape test, the steps this pass scrolls), first with thrust held, then thrust and right, then nothing:

KeysPassClimb speedStep upSpeed acrossStep across
thrust (A held)1+0.3120+0.0470
2+0.6250+0.0470
3+0.9382+0.0470
4+1.2502+0.0470
5+1.5622+0.0470
6+1.8752+0.0470
7+1.1882+0.0470
8+1.5002+0.0470
9+1.8122+0.0470
10+1.1252+0.0470
11+1.4382+0.0470
12+1.7502+0.0470
thrust and right (A, X)1+1.0622-0.2030
2+1.3752-0.453-2
3+1.6882-0.7030
4+1.0002-0.953-2
5+1.3122-1.203-2
6+1.6252-1.453-2
7+1.9382-1.703-2
8+1.2502-1.953-2
9+1.5622-1.203-2
10+1.8752-1.453-2
11+1.1882-1.703-2
12+1.5002-1.953-2
nothing held1+1.2502-1.906-2
2+1.0002-1.859-2
3+0.7500-1.812-2
4-1.000-2-0.266-2
5-0.875-2-0.5940
6-1.688-2-0.0310
7-1.938-2-0.0310
8-2.188-4-0.0310
9-2.438-4-0.0310
10-2.688-4-0.0310
11-2.938-4-0.0310
12-2.188-4-0.031-2

The climb speed grows by $50/256 a pass, but clamp_climb holds only its whole part, to 1 (half the top climb of 2), and leaves the fraction alone, so held thrust saws between 1 and +1.938; the speed across does the same under its own clamp. With nothing held, gravity takes the climb down past -2 and the drag wears the speed across away a little each pass -- but the drag goes by last pass's step, so once the step is 0 a small speed is left over. The steps are always 0, 2 or 4 pixels, never the speed itself. Where a speed jumps in the last run, the change came between the ship's passes (the landscape test changed nothing then), which points to a touch by an object: contact_push adds an object's speed to the ship's. That is inferred, not traced.

The picture and the add-ons

The ship is drawn from ship_picture, a buffer of 6-byte rows, built by build_ship_sprite: the bare ship (bare_ship, 14 rows) goes into the buffer's last 14 rows, and each fitted add-on is drawn in by fit_addon at its place from addon_places, its mask ANDed on first and its picture ORed on (addon_mask_and_draw). Each add-on's graphic in addon_graphics is preceded by the picture height it needs; the highest wins, into ship_height, and ship_graphic is where drawing starts. Since the buffer is drawn bottom row first, its last rows are the top of the picture: the bare ship sits at the top and the add-ons hang below, the ship's top staying where it was on the screen.

Each picture below was made by setting one add-on's slot in the player record (add-on n's slot holds n), calling build_ship_sprite in the simulator, and reading the rows it left; the last has all nine. The add-ons' names are by appearance; their effects are read from the code:

The bare ship

The bare ship.

The ship's picture with each add-on

Add-on 1 (with add-on 2, which always comes with it), add-ons 3 to 9 one at a time, then all nine.

Add-onSlotGraphicPlace in the bufferPicture heightTop speed, climbEffect
1addon_slotsaddon_hook_graphicrow 5, byte 0352, 2the hook: needed to pick up a rocket part
2addon_twoaddon_hook_b_graphicrow 5, byte 4with add-on 1never lies anywhere: fitted with add-on 1 (its slot is set to twice add-on 1's); stops a floor box below hiding the lift jet
3$F5F0rocket_tank_graphicrow 0, byte 1402, 2never fitted: its place is never dealt (the ore tank comes as rocket part 6)
4addon_fouraddon_block_graphicrow 24, byte 0164, 2the side jet; top speed across 4
5addon_fiveaddon_arches_graphicrow 19, byte 1212, 4the lift jet; top climb 4; the ceiling moves from map row 5 to row 0
6addon_sixaddon_mound_graphicrow 24, byte 1162, 2fuel burnt at half the rate
7addon_sevenaddon_post_graphicrow 23, byte 4172, 2the special beam
8addon_eightaddon_bar_graphicrow 33, byte 4142, 2every other shot a homing missile
9addon_nineaddon_figure_graphicrow 36, byte 2252, 2stands on top, 11 more rows; lifts the two-piece load; no extra 4 lines in the landscape box

Add-on 9 is the one that grows upwards: it adds 11 rows above the bare ship, and the picture runs past the end of the buffer into the bytes after it.

The jets and the trail

Drawn by the direct drawer like the ship (see drawing), on alternate passes: the side jet (side_jet, add-on 4) flickers behind the ship while it steers; the lift jet (lift_jet, add-on 5) hangs under it, mirrored every other draw so that it seems to spin; the trail (draw_trail) is a one-byte-wide line behind the ship whose bend follows the speed across, from trail_images.

Confirmed and inferred