The Penetrator - ZX Spectrum game by Mark Foley

Description:
The Penetrator is a maze game where the object is to guide a spaceship 
through chambers in what is supposed to be a much larger spaceship. The
view is from the side in the style of "Lunar Lander", and so controls 
are left, right, up and down.  There is a fake gravity system which 
slowly drags your spaceship downwards, so you have to use the "up"
control to counteract this as you navigate the mazes.

Like other arcade games, you get 3 "lives" - each time the ship touches
a wall or obstacle it is destroyed and the game is over when there are
no ships left, or when you successfully navigate through all mazes
in the game.

Development notes:

Loading Screen:
The image displayed while the game is being loaded from tape was drawn
using a home-grown graphic painter/editor.  The image was initially 
traced from a hand drawing on cling film stuck to the TV screen, then
some simple Print, Plot and Draw BASIC statements run to add the text,
spaceship and planets.  The image occupies the the full screen, including
the lower 16 lines which are usually not retained in BASIC mode -- this 
was achieved by doing the drawing in the upper third of the screen, then 
assembling the image off-screen in RAM and saving to tape as a binary 
image using some machine code instructions.

Anti-piracy system:
One of the exercises in writing this game was to experiment with the 
features commonly found in Spectrum games at the time, including copy 
protection using a challenge-response system.  In this case there are
60 numbers to choose from which are actually just bytes picked from the
Spectrum's 16kb ROM -- starting at a more or less random point, the actual
range selected because it held a good-ish spread of values from 0 to 255.
The user is given three chances to get the response right.  If no 
correct response is made then the Spectrum is reset.
Another "hacking protection" system implemented was to change the
break interrupt handler so that a system reboot is invoked when the
break key (Shift and Space) is pressed. Sprinkled throughout the BASIC
code are POKEs setting the ERR SP system variable at 23613 to 0.

Menu and Instructions:
The font/typeface used in the game come from Alan Grier's "fonts" tape 
which was purchased from him. This font was selected to suit the storyline
behind the game.
Another feature of games emerging at this time was that players could
select the control keys, so this was implemented for The Penetrator too.
When the player wants to change their control keys, the words prompting
for each direction (up, down, left, right) are scrolled into the screen 
in the direction each control indicates i.e. left scrolls in from the left,
up scrolls up from the bottom and so on.
While the menu is being displayed music is played -- this is the tune to
"Dixie". Keyboard selections are only sampled in the pauses between 
notes. 
A friend, Stuart, showed interest in looking at the game's internals, so
an extra menu option was added to drop the user into Sinclair BASIC mode
if they knew the password "CLOUD".

Game coding:
The game itself is mostly written in BASIC with some supporting machine 
code.  All screen "wipes" or "clears" are little machine code routines
which scroll the contents in the display file bytes left or right (filling
with zeroes to clear the screen), or cycle the colour attributes from 
yellow to black to "fade out" the screen.  The mazes are drawn in BASIC
while the screen is black, then the machine code fader is called to 
bring the colours back up to yellow.  When the little spaceship is 
destroyed the "explosion" may disrupt the pixels in the underlying maze
so rather than repaint the maze (which takes a few seconds in BASIC)
the screen is faded to black, the "explosion" is redrawn in negative to
restore the pixels, then the screen lighted up again.
At the bottom of the screen there are a number of "available lives" 
shown as copies of the players spaceship.  When the last life is in play
there are no spaceships left underneath.
Every movement is interleaved with a "tick" sound, and when no movement 
key is pressed the tick frequency increases.  At every 3rd tick the
"gravity" feature kicks in and the ship is dropped a pixel, unless the 
up key is being pressed.
Collision detection is rudimentary - not every intersection between ship
pixels and the maze pixels are tested -- just a spread of pixels around 
the perimeter, so it is possible (especially when travelling down) to
"spike" the ship on a vertical line which does not destroy the ship at 
first.  This was a compromise to avoid slowing down the game too much.
As each screen starts the "entry" is closed off so the player can't go 
back. When the ship finishes each maze the screen fades to black, the
next maze is drawn and the ship position is set to the start of the 
screen, then the maze and ship colours are raised from black to yellow.
The final screen is not a maze at all -- but is a simple drop to the exit.
When the game is completed successfully a machine code "reward" is 
called which looks more impressive on a TV than in most Spectrum
emulators -- the display colour file is filled with random "paper"
colours then each quarter of the screen's colour file is scrolled in
one of four directions to give a psychodelic display.  Each sweep of the
screen colours is synchronised to the 50Hz screen refresh interrupt. 
The machine code routine tests for the '1' key and returns when this
is pressed.  Finally the congratulations message is displayed to the 
player and the "Dixie" music is played.
The mazes were designed on 1mm pitch graph paper and the coordinates
coded into DATA lines by hand.

To sum up:
The game was coded mostly in BASIC, some machine code was written to
provide visual effects and to support some of the construction of the
loading screen.  The Hisoft Devpac 3 Assembler was used to compile the
machine code.  The font used in the game was supplied from Alan Grier's 
font collection.
Sadly the assembler source is no longer available, nor the drawing tool
hacked together to do the loading screen.
The intent was to ultimately replace all the BASIC code with machine
code, and hopefully improve upon gameplay and vision as time went on
but pressures of study intervened.

Mark Foley, Canberra 2009
