Every planet is the same map
When the rocket has risen, level_done and planet_secured take the player on to the next of five planets, and the map does not change: the planet's number, in the player's record, is read only for the planet's name and for its landscape's two colours, which start_landscape takes from planet_ground_colours. The map, the objects in it and the places the parts are dealt from are the same; the objects the player took or destroyed come back; rocket parts 0-5 stand built, the empty ore tank hangs under the ship and the nose cone is dealt a new place. After the fifth the first comes round again. Read from the snapshot at build time:
PlanetNameAbove the cavernsThe caverns
1TITAN 4bright magentayellow
2GAMMA 27bright greenbright yellow
3PROTONIUMbright whitebright magenta
4MEGALON PRIMEbright yellowbright white
5ZARTAN PENDULOSbright cyanbright green
Watched in SkoolKit's simulator: a new life by the game's own restart inside the finished rocket docked, the rocket rose, 50,000 points were added and the next life began on GAMMA 27, in its colours, with six parts built, the tank aboard and the map's bytes unchanged.
Extra lives come faster when losing
The spiky mounds (6 of the objects in the world) throw bullets, now and then a shield ball, and now and then an extra life. extra_life_countdown counts the bullet throws down and, at nought, makes that throw the extra life and starts again from the current lives times four (fire_from, which throws for ground_object_fires):
LivesBullet throws that are an extra life
1one in 4
2one in 8
3one in 12
4one in 16
5one in 20
6one in 24
7one in 28
8one in 32
9one in 36
So a player down to the last ship sees a life every fourth throw, five times as often as a player with five. contact_extra_life adds it, to nine at most. Read; no trial here met a mound throwing.
The ship never moves on the screen
The ship stays at x $60, in the middle of the play area: steering and thrust become this pass's scroll, 2 or 4 pixels (move_ship, scroll_landscape), the world moves the other way, and the ship's record moves through the world with the view. So it can be drawn over itself with OR on every other pass and rubbed out only when its picture changes -- a turn, an add-on, a part (draw_ship). Read.
The background is never cleared, so the scroll is 2 pixels
Nothing clears the play area during play. The landscape is drawn again every pass, straight onto the screen (draw_landscape), but only its pieces: the sky is black and the inside of the ground a checker of $55 and $AA bytes, and both look the same after a move of 2 pixels across or 2 lines up or down, so only the thin strips a moving edge uncovers need painting. That is why every scroll step is 2 pixels, or 4, two at once (measured in the emulator), and why every life starts with a fly-in that paints the play area into a known state.
Nine graphics draw sixteen directions at four shifts
A landscape piece runs in one of 16 directions -- flat, three slopes each way, the same as ceilings, two walls -- and is drawn at one of four fine shifts. The shift-0 table (piece_blitters_shift0) draws all sixteen from nine stored graphics, and the other three shifts' tables from nine more, each holding one graphic's three shifted copies, made at start-up (build_shifted_pieces) -- counted from the four tables in the snapshot at build time. A slope climbing left is the right-climbing graphic started a row later: the graphics are stored in zig-zag rows, so that reverses each row's bytes, and a bit-reversal table, which build_bit_reverse writes over the start-up code once it has run, reverses the bits.
Two players are two swapped records
Everything that belongs to a player is in one 105-byte record, the current player's always at score, the other's at other_player_record; at a change of turn swap_players swaps the two byte for byte, and the two score lines on the panel with them, so no other code asks who is playing. The one thing the players share is the world's table of objects (map_object_kinds), a byte an object with a gone bit for each player, and play patches the one BIT and the two SETs that use it at the start of every life (the opcode bytes read from the snapshot at build time):
ByteInForPlayer 1Player 2
$E118spawn_objects_from_listis it gone?BIT 7,(HL), $7EBIT 6,(HL), $76
$A9B8ship_hits_ground_objectsa refuel pad used upSET 7,(HL), $FESET 6,(HL), $F6
$ABDEbeam_hits_ground_objectdestroyed by the special beamSET 7,(HL), $FESET 6,(HL), $F6
A refuel pad repairs through the damage routine
damage_ship (in contact_damage) counts a hit in hit_count and colours the panel's ship icon by the new count: yellow after one, magenta after two, black and the death after three, and white for nought. A refuel pad (ship_hits_ground_objects) repairs by setting the count to $FF and calling damage_ship, which counts it on to nought: one routine both damages and repairs. The pad also fills the tank and is used up, for that player, until the planet is secured. Read, and run in the simulator (see the bugs for what the shield does to it).
The shield lasts 510 passes
The shield ball, one bullet throw in eight, sets shield_timer to $FF, and ship_pass counts it down on odd passes, so it lasts 510 passes -- about 23 seconds at the 22.3 passes a second the simulator's flying ran at. While it runs no hit counts, an attacker that touches the ship is destroyed instead, and colour_ship paints the ship cyan, flashing over its last 32 counts. Measured in the simulator: set to $FF at the end of a pass, it reached nought 509 passes later.
Meteor showers
Once a pass, spawn_tick starts a meteor shower when one random byte is $6A and two bits of another are nought -- one pass in 1024, under a minute at the pass rate -- and meteor_shower then counts 128 passes. While it runs and the view is above the caverns, start_attacker puts a rock or a comet near the ship instead of an attacker, aimed across it from the top of the play area; they damage the ship and die on touching it. Watched in the simulator: one shower in the 62 seconds of the attackers trial, its 9 rocks and comets among the things started.
Where the next ship starts
Every fourth pass save_restart_point saves the view's place in the player's record as the next life's start -- but only at a safe place: the play area's bottom pixel row nothing but the ground's checker, or all four on-screen map cells empty sky or beam tiles. At the next life start_landscape flies the landscape in to that place. A new game starts from start_position. The trials on these pages stage their scenes the same way: the place is written at the end of a death sequence, after the last save, and the game builds the rest.
Every key read writes to port $FD first
Each of the game's 15 keyboard reads -- counted in the listing at build time -- writes the half-rows it is about to read to port $FD before reading port $FE (read_keyboard is one). A 48K ignores the write, and why it is there is not known; on a 128K it pages memory, and the game crashes (see the bugs).
No interrupts, no frame sync
The game runs with interrupts off from its first instruction: its code, from game_entry up, has one DI, no EI and no HALT (counted in the listing at build time), so there is no interrupt routine and nothing waits for a frame. A pass takes as long as its work -- the landscape, up to fifteen sprites, sounds that are timing loops -- about two or three frames: 22.3 passes a second in the simulator's flying, about 20 measured in the emulator. Everything counted in passes -- the shield, the death sequence, the fuel's grace -- lasts longer on a busy screen.
A tank lasts about three minutes of steering
The gauge has 124 steps from full to empty, and read_controls burns 8/256 of a step on each pass the ship steers or thrusts (twice that for both at once, half with add-on 6); coasting and falling cost nothing. So a full tank is 3,968 passes of steering, about 3 minutes at 22.3 passes a second, and an empty gauge kills after up to 128 passes' grace (check_fuel_empty). Measured in the simulator: the round of keys, which steers or thrusts nearly all the time, emptied the tank and killed the ship 155.4 seconds in.
What lies in the world
290 objects lie at fixed places in the world, in tables sorted by map column (map_object_kinds). Counted from them at build time: 18 refuel pads; 24 ore deposits -- 9 and 5 of the two kinds that give one unit, 10 of the kind that gives two -- 34 units in all for a tank of 18; and 6 spiky mounds. The map has 76 cells of tile $A6, the flickering beams', which the beams' generators switch off, a map row and half the world at a time, once the special beam has destroyed them.
The missiles go for what is worth most
A homing missile (add-on 8) without a target takes the best of the objects drawn in the first seven records by missile_target_values (find_missile_target). The code adds one to the type to test for a free record ($FF) and then subtracts $14 from that, so the table is read by the type less $13, as type_points is -- and so read, it ranks the attackers by their points, the tough attacker, which takes many hits, last. Clouds, debris, bullets and falling parts are never chosen. Read from the snapshot at build time:
TypeWhatMissile valuePoints
$1Drock or comet9350
$14rotor craft8250
$16saucer7200
$17eye pod6150
$18pillar5100
$1Adome490
$19tough attacker275 a hit
$13cloudnever-
$15debrisnever-
$1B(ground objects only)never-
$1Cbullets, pick-ups, wreck piecesnever-
$1Ea rocket part falling into placenever-
Watched in the simulator: 120 seconds of flying with fire held and add-on 8, and 120 more with add-ons 4 and 5 as well, which bring the rotor craft and the saucer. Every one of the 285 targets chosen was the best there by this ranking, rotor craft, saucers, eye pods, pillars, tough attackers, domes and meteor-shower rocks among them; clouds, debris and bullets were there and passed over.
Docking borrows the death byte
When the ship flies into the finished rocket, draw_rocket sets death_count to 10 for the length of two calls -- draw_ship_image and the trail, which rub the ship out at 10 -- and puts it back to nought at once, so update_objects, which would start the wreck and the death sound, never sees it. Then launch_state is set and the rocket rises. Read, and run in the simulator's planet trial (see the first fact).
The tough attacker ignores seven hits in eight
The tough attacker (type $19, update_tough_attacker) counts a laser hit only on a pass whose pass counter has its low three bits clear: seven laser hits in eight are thrown away. It flashes white from ten counted hits and explodes at fourteen, scoring 75 for each. A missile's hit counts at once, and the special beam kills it only once worn down, when it also gives a carried ore tank one or two units. Read.