1985 · Mastertronic

Hunter Patrol

This minisite awaits a maintainer’s check. A model this site has not proven yet worked on it (claude-sonnet-5-5), so a maintainer will measure its listing on one it has (how the check works).

Nothing is scaled: every enemy is stored at ten sizes, and the screen is split so eight sprites can serve both the sky and the ground.

01 · Every moving thing

The cast, drawn from the game's own bytes

The game has no 3D arithmetic. A tank far away is a small picture of a tank, and the same tank near the plane is a bigger one, so every enemy is stored as a run of sizes. Each row below runs from the farthest size to the nearest.

Loading the shapes…

Every sprite shape and the four targets, drawn from the bytes on the Source tab in the game's own colours, each labelled with the number the game stores for it. The moving ones play at the game's own speed.

The plane never moves sideways, so all it needs is a picture for each bank: move_plane ($1990) picks one of five from the scroll speed as the stick is held left or right. Its shadow (plane_shadow, $22B0) has the same five banks at five sizes, smaller the higher the plane flies, and the crash test uses it: a low plane whose shadow touches a ground object is lost.

Distance is nothing but size. An enemy aircraft starts big, near the plane, and steps down through ten pictures as it flies away ($8570). A ground object does the opposite: it appears as a speck on the horizon and steps up through ten pictures as it comes on, speeding up as it nears ($8400). The tanks, the lorries, the guns, and the buildings all share the same steps, each kind ten pictures further along. The shot shrinks as it flies away, and the flak climbs as a dot and then bursts.

A hit swaps the picture for an explosion that flickers between two shapes every four passes. A ground object's explosion keeps the size the object had, and grows with it as it comes on; an aircraft's is always the same pair. When the plane itself is lost, plane_crash ($2400) plays ten pictures, from a fireball to a ring that breaks up.

The targets of the strafing runs are too wide for one sprite, so each is three sprites side by side, in ten sizes. Before each run start_run copies the level's set of shapes into the sprite area, so all four targets share the same 32 slots.

02 · Reusing the sprites

Three raster bands, two sets of sprite positions

The video chip has eight sprites, and the game needs more: the plane, its shot, the flak, the shadow, four aircraft and four ground objects. The raster interrupt splits the screen so the sky and the ground each have their own.

The interrupt (game_irq, $13AB) runs three times a frame and counts the band in $20. At the top of the screen it copies the sky's register image, all 47 bytes from $8060, into the video chip at $D000, and the sky's sprite pointers from $8520. Further down it copies the ground's image from $8090, but only from the byte for $D008 on, so sprites 0 to 3 (the plane, the shot, the flak and the shadow) keep the positions the sky gave them, and sprites 4 to 7 move from the aircraft to the ground objects or the target. The third band sets the dark grey background of the status panel. Each band also latches the sprite collisions it saw, in $3D for the sky and $3E for the ground, which is how the game knows what the shot hit.

Four aircraft records need four sprites, and so do the four ground records. sort_ground, sort_aircraft and the shot's sort at $1F90 order each family by height and write each object's position, size and picture into the band's image, so the main loop never touches the video chip itself.

03 · The ground and the hills

Hills that scroll by characters, furrows that roll by bytes

The landscape is text in the multicolour character mode, and the illusion of flying forward comes from redrawing a few characters, not from moving the screen.

The 256 characters of the set at $4800, drawn from the listing's bytes in white on blue. The ground and hill characters are multicolour in play; here every set bit is white.

Three rows of hills (from row 5) slide sideways as the plane turns. Every eighth pass scroll_ground steps the fine scroll, and when it runs out scroll_left or scroll_right moves the rows a whole character and fills the new edge from the 40-column panorama at $8D00, which wraps round. The ground below the hills does not scroll forward at all. move_stripes keeps twelve stripes running down the bytes of the ground characters at $4907, each drawn as a line of $55, $AA or $FF and speeding up as it nears the bottom, so the furrows seem to pass under the plane.

04 · The loading picture

The picture the disk shows while the game unpacks

A multicolour bitmap, drawn from its 10,000 bytes (the bitmap at $E000, the screen at $DC00 and the colour memory), as they stand while the picture is up. They come from the packed program HUNTER PATROL+, which the cracker's unpacker writes over once fire is pressed, so the game's own listing does not hold them. The picture is signed "Jim" in the lower right corner.