Skip to navigation


Map of the source code

This page contains a map of all the routines and variables in the original version of Aviator, in the order in which they appear in the original source. The source files are structured like this:

You can click on the links above to jump to the relevant part of the map.

Workspaces
----------

CategoryDetails

Workspaces

Workspace: Zero page

Mainly temporary variables that are used a lot

Workspaces

Workspace: Stack variables

Variables that share page 1 with the stack

Workspaces

Workspace: Main variable workspace

The main block of game variables

Aviator A
---------

CategoryDetails

Setup

Subroutine: SetupScreen

Set up the screen mode and load the dashboard image

Setup

Variable: loadDashboard

The OS command string for loading the dashboard image

Setup

Variable: disableCursor

The VDU command for disabling the cursor

Setup

Variable: pleaseWaitText

The "Please wait" message shown when the game loads

Setup

Subroutine: DrawCanopy

Move code around, clear the edges of the canopy view, draw the canopy edges and rivets, and jump to the main code

Graphics

Subroutine: VduPoint

Draw a point on-screen using the standard VDU routines

Graphics

Subroutine: VduMove

Move the graphics cursor using the standard VDU routines

Graphics

Subroutine: VduDraw

Draw a line using the standard VDU routines

Graphics

Subroutine: VduPlot

Perform a plot command using the standard VDU routines

Graphics

Subroutine: DrawRivet

Draw a square rivet (2 pixels across, 4 pixels high)

Graphics

Subroutine: ClearRows

Clear the specified number of rows on-screen

3D geometry

Subroutine: ProjectPoint (Part 1 of 3)

Project a point onto the screen (i.e. convert from 3D coordinates to screen coordinates)

3D geometry

Subroutine: ProjectPoint (Part 2 of 3)

Calculate the screen coordinates of the projected point

3D geometry

Subroutine: ProjectPoint (Part 3 of 3)

Move the projected coordinates to the centre of the screen and update the point's status byte

Maths

Subroutine: DivideScaled

Divide a 16-bit number by a scaled 16-bit number

Maths

Subroutine: ScaleUp

Scale up a 16-bit number until it doesn't fit into 16 bits any more

Maths

Subroutine: ScaleDown (Part 1 of 4)

Scale down the results of divisions done using the ScaleUp and DivideScaled routines

Maths

Subroutine: ScaleDown (Part 2 of 4)

Balance the scale factors for the x- and y-coordinates

Maths

Subroutine: ScaleDown (Part 3 of 4)

Scale the x-coordinate

Maths

Subroutine: ScaleDown (Part 4 of 4)

Scale the y-coordinate

Drawing lines

Subroutine: DrawClippedLine (Part 1 of 6)

Clip a line to fit on-screen, starting with the line deltas

Drawing lines

Subroutine: DrawClippedLine (Part 2 of 6)

Work out whether the line's start point is on-screen

Drawing lines

Subroutine: DrawClippedLine (Part 3 of 6)

Work out whether the line's end point is on-screen

Drawing lines

Subroutine: DrawClippedLine (Part 4 of 6)

Calculate the starting point and direction for our clipped vector line

Drawing lines

Subroutine: DrawClippedLine (Part 5 of 6)

Calculate the deltas for our clipped vector line

Drawing lines

Subroutine: DrawClippedLine (Part 6 of 6)

Add the clipped line to the line buffer and draw it

Drawing lines

Subroutine: DrawCanopyLine (Part 1 of 9)

Draw a line in the canopy view

Drawing lines

Subroutine: DrawCanopyLine (Part 2 of 9)

Modify the line drawing routine for a shallow horizontal slope

Drawing lines

Subroutine: DrawCanopyLine (Part 3 of 9)

Draw a line as a shallow horizontal slope

Drawing lines

Subroutine: DrawCanopyLine (Part 4 of 9)

Draw a part of the line, working down the screen

Drawing lines

Subroutine: DrawCanopyLine (Part 5 of 9)

Draw a part of the line, working up the screen

Drawing lines

Subroutine: DrawCanopyLine (Part 6 of 9)

Draw a part of the line, working along the screen

Drawing lines

Subroutine: DrawCanopyLine (Part 7 of 9)

Modify the line drawing routine for a steep vertical slope

Drawing lines

Subroutine: DrawCanopyLine (Part 8 of 9)

Draw a line as a steep vertical slope

Drawing lines

Subroutine: DrawCanopyLine (Part 9 of 9)

If the line was clipped, draw a line from the clipped coordinates to the edge of the screen

Drawing lines

Subroutine: ModifyDrawRoutine

Modify the drawing routines to draw in the correct colour for the current colour cycle

Drawing lines

Subroutine: ClipBestEndOfLine

Clip a line at the start or end point, depending on which is best

Drawing lines

Subroutine: ClipStartOfLine (Part 1 of 5)

Check whether the line is completely off-screen

Drawing lines

Subroutine: ClipStartOfLine (Part 2 of 5)

Work out the deltas depending on the direction of slope

Drawing lines

Subroutine: ClipStartOfLine (Part 3 of 5)

Work out the deltas depending on the steepness of slope

Drawing lines

Subroutine: ClipStartOfLine (Part 4 of 5)

Calculate where to clip the line

Drawing lines

Subroutine: ClipStartOfLine (Part 5 of 5)

Move the start point to the clipped position and return it

Drawing lines

Subroutine: SwapLinePoints

Copy an end point into a start point

Aviator B
---------

CategoryDetails

Drawing lines

Subroutine: EraseCanopyLines

Draw all the lines from a line buffer to erase them

Maths

Subroutine: Multiply16x16Mix

Multiply two 16-bit numbers with different sign bits (one in bit 7 of the high byte, the other in bit 0 of the low byte)

Maths

Subroutine: Multiply8x8

Multiply two unsigned 8-bit numbers

3D geometry

Subroutine: ProjectAxisAngle

Convert the rotation angles of the plane into coordinates

Maths

Subroutine: Sine16Bit

Calculate the sine of a 16-bit number

Maths

Subroutine: Multiply4x16

Multiply a 4-bit and a 16-bit number

3D geometry

Subroutine: SetObjPointCoords (Part 1 of 2)

Calculate the coordinate for a point within an object

3D geometry

Subroutine: SetObjPointCoords (Part 2 of 2)

Apply the correct scale factor to the matrix multiplication

3D geometry

Subroutine: AddTempToPoint (Part 1 of 2)

Add the xTemp1 vector to a point, store the result in another point, and set the result to hidden if it overflows

Maths

Subroutine: Add16x16Bit0

Add two 16-bit numbers that have their signs in bit 0

3D geometry

Subroutine: SetMatrices

Set up matrices 1 to 4

3D geometry

Subroutine: SetMatrixEntry

Calculate a matrix entry

Maths

Subroutine: Multiply16x16

Multiply two unsigned 16-bit numbers

Maths

Subroutine: Multiply16x16Bit0

Multiply two 16-bit numbers that have their signs in bit 0

3D geometry

Subroutine: SetPointCoords

Calculate the coordinates for a point

Utility routines

Subroutine: CopyTempToPoint

Set a specified point to (xTemp1, yTemp1, zTemp1)

Dashboard

Subroutine: UpdateIndicator (Part 1 of 15)

Update a single indicator on the dashboard

Dashboard

Subroutine: UpdateIndicator (Part 2 of 15)

Calculations for the compass (indicator 0)

Dashboard

Subroutine: UpdateIndicator (Part 3 of 15)

Calculations for the airspeed indicator (indicator 1)

Dashboard

Subroutine: UpdateIndicator (Part 4 of 15)

Calculations for the altimeter's small "hour" hand (indicator 2)

Dashboard

Subroutine: UpdateIndicator (Part 5 of 15)

Calculations for the altimeter's "minute" hand (indicator 3)

Dashboard

Subroutine: UpdateIndicator (Part 6 of 15)

Logic for checking which indicator to update

Dashboard

Subroutine: UpdateIndicator (Part 7 of 15)

Calculations for the vertical speed indicator (indicator 4)

Dashboard

Subroutine: UpdateIndicator (Part 8 of 15)

Logic for checking which indicator to update

Dashboard

Subroutine: UpdateIndicator (Part 9 of 15)

Calculations for the turn indicator (indicator 5), the bottom part of the slip-and-turn indicator

Dashboard

Subroutine: UpdateIndicator (Part 10 of 15)

Calculations for the slip indicator (indicator 6), the top part of the slip-and-turn indicator

Dashboard

Subroutine: UpdateIndicator (Part 11 of 15)

Calculations for the artificial horizon (indicator 7)

Dashboard

Subroutine: UpdateIndicator (Part 12 of 15)

Logic for checking which indicator to update

Dashboard

Subroutine: UpdateIndicator (Part 13 of 15)

Calculations for the rudder indicator (indicator 9)

Dashboard

Subroutine: UpdateIndicator (Part 14 of 15)

Calculations for the joystick position display (indicator 8 or 10)

Dashboard

Subroutine: UpdateIndicator (Part 15 of 15)

Calculations for the thrust indicator (indicator 11)

Drawing lines

Subroutine: DrawIndicatorBar

Draw a vertical bar on indicator 9 (rudder) or 11 (thrust)

Drawing lines

Subroutine: DrawIndicatorHand

Apply min and max limits to an indicator value and draw a hand on the indicator

Drawing lines

Subroutine: DrawIndicatorLine

Draw a line on indicators 0 to 7, i.e. a dial hand (0-6) or an artificial horizon (7)

Drawing lines

Subroutine: DrawJoystickCross

Draw a cross in the joystick position display (indicator 8 or 10)

Dashboard

Subroutine: GetHandVector

Vector line calculation for a hand on indicators 0 to 6

Drawing lines

Subroutine: DrawVectorLine (Part 1 of 3)

Draw a line: set up pixel bytes and slope variables

Drawing lines

Subroutine: DrawVectorLine (Part 2 of 3)

Calculate the coordinates of the next pixel as we step along the line by one pixel

Drawing lines

Subroutine: DrawVectorLine (Part 3 of 3)

Plot a pixel at (I, J)

Aviator C
---------

CategoryDetails

Dashboard

Subroutine: ArtificialHorizon

Vector line calculation for the artificial horizon on indicator 7

Drawing lines

Subroutine: DrawOrthoLine

Draw an orthogonal line (i.e. vertical or horizontal)

Maths

Subroutine: ScaleSigned

Scale an indicator value by 4 or 16, retaining the sign and adding sensitivity for smaller values

Dashboard

Subroutine: UpdateDashboard

Update two indicators on the dashboard, one from 0-6, one from 7-11, cycling through them with each subsequent call

Flight model

Subroutine: UpdateFlightModel (Part 1 of 4)

Apply any axis control key presses to the current axis values

Flight model

Subroutine: UpdateFlightModel (Part 2 of 4)

Apply any throttle key presses to the current thrust value

Flight model

Subroutine: UpdateFlightModel (Part 3 of 4)

Process the undercarriage, brake, flaps and fire keys

Flight model

Subroutine: UpdateFlightModel (Part 4 of 4)

Set up matrices, apply the flight model and update the dashboard

Keyboard

Subroutine: ProcessOtherKeys

Apply the undercarriage, brakes, flaps and fire keys

Dashboard

Subroutine: IndicatorU

Update the undercarriage indicator ("U") and related variables

Dashboard

Subroutine: IndicatorF

Update the flaps indicator ("F") and related variables

The Theme

Subroutine: FireGuns

Create the bullet objects and send them on their way

Dashboard

Subroutine: IndicatorB

Update the brakes indicator ("B")

Dashboard

Subroutine: IndicatorT

Update the Theme indicator ("T")

Keyboard

Subroutine: ScanKeyboard

Scan the keyboard for a specific key

Keyboard

Subroutine: UpdateKeyLogger

Scan the keyboard for keys in the two key tables and update the key logger

3D geometry

Subroutine: AddPointToObject

Add a point vector to an object's coordinates

3D geometry

Subroutine: SetObjectToOrigin

Set an object's coordinates to (0, 0, 0)

Keyboard

Subroutine: ReadADCChannel

Read the joystick position from one of the ADC channels

Setup

Subroutine: ResetVariables

Reset most variables to prepare for a new flight

Dashboard

Subroutine: ResetRadar

Reset the radar display

Setup

Subroutine: StartGame

Reset the high score, set up the gunfire sound envelope and start a new game

Setup

Subroutine: NewGame

Start a new game

Main loop

Subroutine: MainLoop (Part 1 of 15)

Start the main loop by processing gunfire and bullets

Main loop

Subroutine: MainLoop (Part 2 of 15)

Reset object statuses and related points

Main loop

Subroutine: MainLoop (Part 3 of 15)

Make the sound of firing, if appropriate

Main loop

Subroutine: MainLoop (Part 4 of 15)

Check whether aliens have invaded Acornsville

Main loop

Subroutine: MainLoop (Part 5 of 15)

Update lines, check flying skills, increment main loop counter, update the radar

Main loop

Subroutine: MainLoop (Part 6 of 15)

Check whether any aliens have been hit

Main loop

Subroutine: MainLoop (Part 7 of 15)

Process the terminate key

Main loop

Subroutine: MainLoop (Part 8 of 15)

If we fire the guns on the runway, enable the Theme

Main loop

Subroutine: MainLoop (Part 9 of 15)

Fill up the tank if the engine is switched off, and process the volume keys

Main loop

Subroutine: MainLoop (Part 10 of 15)

Award points for a successful landing

Main loop

Subroutine: MainLoop (Part 11 of 15)

Process engine start and stop

Main loop

Subroutine: MainLoop (Part 12 of 15)

Spend at least 9 centiseconds processing lines from the linesToHide list

Main loop

Subroutine: MainLoop (Part 13 of 15)

Process more lines and update the view out of the canopy

Main loop

Subroutine: MainLoop (Part 14 of 15)

Handle the score display

Main loop

Subroutine: MainLoop (Part 15 of 15)

Update the status of any new line points

Visibility

Subroutine: UpdateLinesToShow

Update the linesToShow list, moving any lines that aren't visible into the linesToHide list

Visibility

Subroutine: ProcessLinesToShow

Process the linesToShow list, projecting all the lines onto the screen and moving any that aren't visible to the linesToHide list

Visibility

Subroutine: ProcessLinesToHide

Process an unprocessed line from the linesToHide list

Visibility

Subroutine: ShowOrHideLine

Process a line, working out its visibility and adding it to the linesToShow or linesToHide list

Visibility

Subroutine: ProcessLine (Part 1 of 7)

Process a line, rotating and transforming it to the correct coordinates and calculating its visibility

Visibility

Subroutine: ProcessLine (Part 2 of 7)

Process runway lines

Visibility

Subroutine: ProcessLine (Part 3 of 7)

If a line is part of a multi-point object, extract the other points in the line so we can check them all

Visibility

Subroutine: ProcessLine (Part 4 of 7)

Process bullet lines

Visibility

Subroutine: ProcessLine (Part 5 of 7)

Calculate the object's coordinates and visibility

Visibility

Subroutine: ProcessLine (Part 6 of 7)

Check the visibility of all the object's points on the stack

Visibility

Subroutine: ProcessLine (Part 7 of 7)

Check distance and z-coordinates and return the final result

3D geometry

Subroutine: SetObjectCoords (Part 1 of 11)

Calculate the coordinates for an object's location

3D geometry

Subroutine: SetObjectCoords (Part 2 of 11)

Pre-process the bullets (objects 12, 13, 14 or 15)

3D geometry

Subroutine: SetObjectCoords (Part 3 of 11)

Logic for checking which objects to pre-process

3D geometry

Subroutine: SetObjectCoords (Part 4 of 11)

Pre-process the object groups (objects 6, 7, 8 or 9)

3D geometry

Subroutine: SetObjectCoords (Part 5 of 11)

Logic for checking which objects to pre-process

3D geometry

Subroutine: SetObjectCoords (Part 6 of 11)

Pre-process dormant aliens (object group 30)

3D geometry

Subroutine: SetObjectCoords (Part 7 of 11)

Pre-process feeding and flying aliens (objects 31, 32 and 33)

3D geometry

Subroutine: SetObjectCoords (Part 8 of 11)

Process the object

3D geometry

Subroutine: SetObjectCoords (Part 9 of 11)

Process the next object in the group, if applicable, or return from the subroutine if not

3D geometry

Subroutine: SetObjectCoords (Part 10 of 11)

Process the next dormant alien (object group 30)

3D geometry

Subroutine: SetObjectCoords (Part 11 of 11)

Update the object status and return from the subroutine

Visibility

Subroutine: CheckObjDistance

Check whether an object is within the visible distance for that object, along just one axis

Visibility

Subroutine: ResetLineLists

Reset the line lists at linesToShow and linesToHide

Graphics

Subroutine: FlipColours

Flip the values of colourCycle and colourLogic to cycle to the next colour state

Graphics

Subroutine: SetColourToWhite

Set a logical colour to white

Graphics

Subroutine: SetColourToBlack

Set a logical colour to black

Graphics

Subroutine: SetLogicalColour

Set a logical colour to a physical colour

Graphics

Subroutine: DrawCanopyView

Draw the main view out of the canopy

Visibility

Subroutine: ProcessHorizonLine

Calculate coordinates for the horizon's start and end points

Dashboard

Subroutine: UpdateRadarBlip

Update a blip on the radar (runway or alien)

Dashboard

Subroutine: DrawRadarBlip

Draw a blip on the radar (runway or alien)

Aviator D
---------

CategoryDetails

The Theme

Subroutine: AlienInAcornsville

Move an alien towards Acornsville and check whether it has reached it yet (and if so, end the game)

Dashboard

Subroutine: GetRadarVector

Calculate the radar line vector for a line (the runway) or a dot (an alien)

Drawing lines

Variable: colour1L2R

Pixel bytes for drawing canopy lines left to right in colour 1

Drawing lines

Variable: colour1R2L

Pixel bytes for drawing canopy lines right to left in colour 1

Drawing lines

Variable: colour2L2R

Pixel bytes for drawing canopy lines left to right in colour 2

Drawing lines

Variable: colour2R2L

Pixel bytes for drawing canopy lines right to left in colour 2

Drawing lines

Variable: colour1Row

Pixel bytes for erasing canopy lines in colour 1

Drawing lines

Variable: colour2Row

Pixel bytes for erasing canopy lines in colour 2

Dashboard

Variable: previousCompass

Stores the value of the compass heading when we draw the runway on the radar, so we can erase the line later

Main loop

Variable: previousTime

Stores the current time (low byte only), so we can process lines in a timely fashion during the main loop

Graphics

Subroutine: ClearCanopy

Clear the canopy to black, leaving the canopy edges alone

Graphics

Subroutine: FillCanopy

Fill the canopy with a specified colour, leaving the canopy edges alone

Graphics

Subroutine: FillCanopyRows

Fill multiple screen rows with a particular colour, avoiding the canopy edges

Utility routines

Subroutine: Delay

Delay for a specified number of loops

The Theme

Subroutine: UpdateBullets

Move the bullets through the air

The Theme

Subroutine: SpawnAlien

If the Theme is enabled and the current wave does not yet have eight aliens in it, spawn a new alien

The Theme

Subroutine: UpdateAliens (Part 1 of 5)

Update the aliens so they progress through their feeding or attack cycles

The Theme

Subroutine: UpdateAliens (Part 2 of 5)

Manage alien slots 31 and 32, and if there's a vacancy, wake up a dormant alien, move it into the slot and start its feeding cycle

The Theme

Subroutine: UpdateAliens (Part 3 of 5)

If alien slot 33 is free and there's an alien waiting to take off, promote it into slot 33

The Theme

Subroutine: UpdateAliens (Part 4 of 5)

When an alien reaches the next feeding stage, double its size

The Theme

Subroutine: UpdateAliens (Part 5 of 5)

Check whether the whole wave has been destroyed, and award points accordingly

The Theme

Subroutine: ResizeFeedingAlien

Change the size of an alien so it grows bigger as it feeds

The Theme

Subroutine: CheckIfAlienIsHit (Part 1 of 2)

Extract the alien's feeding stage, ready for the hit calculations in part 2

The Theme

Subroutine: CheckIfAlienIsHit (Part 2 of 2)

Check to see whether the alien has been hit, and if so, initiate the explosion

The Theme

Subroutine: GetAlienWeakSpot

Calculate the coordinates of an alien's weak spot

The Theme

Subroutine: CheckAlienWeakSpot

Check whether an object is close enough to an alien's weak spot to be hitting it

The Theme

Subroutine: GetTrailVectorStep

Calculate 1/32 of the vector for a bullet trail

Dashboard

Subroutine: ShowUpsideDownBar

Show or hide the upside down bar in the artificial horizon indicator

Visibility

Subroutine: ProcessRunwayLine (Part 1 of 5)

Calculate coordinates and visibility for a runway line

Visibility

Subroutine: ProcessRunwayLine (Part 2 of 5)

Calculate coordinates and visibility for the runway outline

Visibility

Subroutine: ProcessRunwayLine (Part 3 of 5)

Calculate visibility for the runway dashes

Visibility

Subroutine: ProcessRunwayLine (Part 4 of 5)

Construct the dashes down the middle of the runway

Visibility

Subroutine: ProcessRunwayLine (Part 5 of 5)

Clip any portion of the runway outline that's behind us

3D geometry

Subroutine: SetPointVisibility

Set the status byte for multiple points to indicate that their coordinates and visibility have been calculated

Drawing lines

Subroutine: DrawHalfHorizon

Draw half of the horizon line

Flight model

Subroutine: FillUpFuelTank

Fill up the fuel tank by 1/65th of a full tank every four iterations of the main loop

Dashboard

Subroutine: UpdateFuelGauge

Update the fuel gauge every 16 iterations of the main loop

Dashboard

Subroutine: DrawFuelPixel

Draw or erase a pixel on the fuel gauge on the dashboard

Sound

Subroutine: ProcessVolumeKeys

Adjust the volume when the volume keys are pressed

Flight model

Subroutine: RetractFlapsIfFast

Retract the flaps if we are going faster than 150 mph

3D geometry

Variable: xObjectPoint

Scaled x-coordinates of the points that make up objects, relative to the object's anchor point

3D geometry

Variable: yObjectPoint

Scaled y-coordinates of the points that make up objects, relative to the object's anchor point

3D geometry

Variable: zObjectPoint

Scaled z-coordinates of the points that make up objects, relative to the object's anchor point

Dashboard

Variable: xRadarBuffer

The x-coordinates of the runway and alien on the radar

Dashboard

Variable: yRadarBuffer

The y-coordinates of the runway and alien on the radar

The Theme

Variable: distanceFromHit

The distance from the alien we just hit, so we can work out whether we get hit by turbulence

The Theme

Variable: feedingStage

The feeding stage of the alien we are currently processing

The Theme

Variable: hitObjectId

The object ID of the alien we just hit (30 to 33)

The Theme

Variable: hitTimer

The time since we hit an alien, so we can time its explosion

Flight model

Variable: fuelUsedLo

The low byte of the current batch of fuel used

Flight model

Variable: fuelUsedHi

The high byte of the current batch of fuel used

Flight model

Variable: fuelLevel

The current fuel level

The Theme

Variable: explodeTo

The end point ID for exploding each of the four alien slots

The Theme

Variable: explodeFrom

The starting point ID for exploding each of the four alien slots

Scoring

Variable: scoreLo

Score (low byte)

Scoring

Variable: scoreHi

Score (high byte)

Scoring

Variable: highScoreLo

High score (high byte)

Scoring

Variable: highScoreHi

High score (low byte)

Flight model

Subroutine: SetEngine

Set the engine status

Scoring

Variable: skillZoneLo

Low byte of the skill zone coordinates for testing flying skills

Scoring

Variable: skillZoneHi

High byte of the skill zone coordinates for testing flying skills

Scoring

Variable: skillZoneSize

Sizes of the skill zones for testing flying skills

Maths

Variable: shift4Right

Lookup table for shifting a byte four places to the right, to extract the high nibble

Maths

Variable: shift4Left

Lookup table for shifting a byte four places to the left, to extract the low nibble

Maths

Variable: divisionHi

Division lookup table

Maths

Variable: timesTable

Lookup table for multiplication times tables

Visibility

Variable: maxLineDistance

The furthest distance at which each line is visible

Visibility

Variable: maxObjDistance

The furthest distance at which each object is visible

Aviator E
---------

CategoryDetails

Drawing lines

Variable: lineBufferR

Line buffer storage for the start x-coordinate (R)

Drawing lines

Variable: lineBufferW

Line buffer storage for the max/min x-coordinate (W)

Drawing lines

Variable: lineBufferS

Line buffer storage for the start y-coordinate (S)

Drawing lines

Variable: lineBufferG

Line buffer storage for the max/min y-coordinate (G)

Drawing lines

Variable: lineBufferT

Line buffer storage for the line's |x-delta| (T)

Scoring

Variable: scoreText

The high score text

3D geometry

Variable: lineEndPointId

The point ID for a line's end point

3D geometry

Variable: objectGroup

The current group number for object IDs 6, 7, 8 and 9

3D geometry

Variable: groupStart

The starting value for each object's group number

3D geometry

Variable: xGroupObjectHi

High byte of the x-coordinate for objects in a group (6 to 9)

3D geometry

Variable: zGroupObjectHi

High byte of the z-coordinate for objects in a group (6 to 9)

Utility routines

Subroutine: CheckTimePassed

Flag whether 9 centiseconds have passed since the last call

3D geometry

Variable: lineStartPointId

The point ID for a line's start point

The Theme

Variable: alienScore

The scores for killing aliens in the various feeding stages

The Theme

Variable: dormantAlienScore

The score for killing a dormant alien

Maths

Variable: sinLo

Low byte of the sine lookup table

Maths

Variable: sinHi

High byte of the sine lookup table

The Theme

Variable: alienSlot

Slots for up to three aliens that are ready to start moving towards the town

The Theme

Variable: alienToMove

The number of the alien to move towards Acornsville in this iteration of the main loop

Main loop

Variable: mainLoopCounter

The main loop counter

3D geometry

Variable: numberOfLines

The total number of lines in Aviator's 3D world

The Theme

Variable: alienObjectId

Object IDs for each of the eight aliens

The Theme

Variable: alienState

The state of each of the eight aliens

The Theme

Variable: alienStatus

Storage for the object status bytes for the four alien objects

Maths

Variable: matrix1Lo

The low bytes of matrix 1

Maths

Variable: matrix2Lo

The low bytes of matrix 2

Maths

Variable: matrix3Lo

The low bytes of matrix 3

Maths

Variable: matrix4Lo

The low bytes of matrix 4

Scoring

Subroutine: CheckFlyingSkills (Part 1 of 2)

Check whether we are performing one of the tests of flying skill

Maths

Variable: matrix1Hi

The high bytes of matrix 1

Maths

Variable: matrix2Hi

The high bytes of matrix 2

Maths

Variable: matrix3Hi

The high bytes of matrix 3

Maths

Variable: matrix4Hi

The high bytes of matrix 4

Scoring

Subroutine: CheckFlyingSkills (Part 2 of 2)

Perform finer checks to see if we are flying under the bridge or along the main street of the town

Flight model

Variable: scaleFactor

Scale factors for the flight forces (in signed powers of 2)

Maths

Variable: lowNibble

Lookup table for the low nibble of a value

3D geometry

Variable: xObjectLo

Low byte of the x-coordinate for an object

3D geometry

Variable: yObjectLo

Low byte of the y-coordinate for an object

3D geometry

Variable: zObjectLo

Low byte of the z-coordinate for an object

3D geometry

Variable: xObjectHi

High byte of the x-coordinate for an object

3D geometry

Variable: yObjectHi

High byte of the y-coordinate for an object

3D geometry

Variable: zObjectHi

High byte of the z-coordinate for an object

Utility routines

Variable: randomNumbers

A list for keeping a list of random numbers

Maths

Variable: highNibble

Lookup table for the high nibble of a value

3D geometry

Variable: objectPoints

Sequences of related points that together make up objects

Keyboard

Subroutine: ReadJoystick

Read the joystick axes and fire button and update the aileron, elevator and fire key values accordingly

Maths

Variable: divisionLo

Division lookup table

Graphics

Variable: yLookupLo

Lookup table for converting pixel y-coordinate to low byte of screen address

Graphics

Variable: yLookupHi

Lookup table for converting pixel y-coordinate to high byte of screen address

Graphics

Subroutine: DrawCanopyCorners

Draw the diagonal corners at the top of the canopy

Scoring

Subroutine: RemoveScore

Remove the score display from the screen

Drawing lines

Variable: lineBufferV

Line buffer storage for the line direction (V)

3D geometry

Variable: zPointHi

High byte of the z-coordinate for a point

3D geometry

Variable: xPointHi

High byte of the x-coordinate for a point

3D geometry

Variable: xLinearHi

High byte of point 252 (x-coordinate)

3D geometry

Variable: xGravityHi

High byte of point 253 (x-coordinate)

3D geometry

Variable: xTempPoint1Hi

High byte of point 254 (x-coordinate)

3D geometry

Variable: xTempPoint2Hi

High byte of point 255 (x-coordinate)

Utility routines

Subroutine: CopyWorkToPoint

Copy a point from the variable workspace to the point tables

Utility routines

Subroutine: CopyPointToWork

Copy a point from the point tables to the variable workspace

3D geometry

Subroutine: SetPointToOrigin

Set a point's coordinates to the origin at (0, 0, 0)

3D geometry

Subroutine: SetPoint

Set a point's coordinates to the value (a, a, a)

Visibility

Subroutine: CheckLineDistance

Check whether a point on a line is within the visible distance for the line

3D geometry

Subroutine: AddTempToPoint (Part 2 of 2)

Check whether the vector addition overflowed and set the point's visibility accordingly

Scoring

Subroutine: CheckBridgeAndTown

Check whether we are safely flying under the bridge or down the main street in Acornsville

Scoring

Subroutine: ScorePoints

Increase the score and make a beep

Scoring

Subroutine: UpdateScore

Increase the score by a specified number of points

Scoring

Subroutine: UpdateHighScore

If this is a high score, update the high score

Scoring

Subroutine: DisplayScore

Print the scores on-screen

Scoring

Subroutine: PrintScore

Print a score

Scoring

Subroutine: PrintScoreText

Print text when showing the scores on-screen

Flight model

Subroutine: Crash

Make a crashing sound, flash the canopy and start a new game

3D geometry

Subroutine: NextObjectGroup

Cycle to the next object group

The Theme

Subroutine: ExplodeAlien

Explode an alien, making the alien split apart

Scoring

Subroutine: ScoreHitPoints

Award points for destroying an alien, and remove the alien from its slot and the radar, if required

Utility routines

Subroutine: SetRandomNumber

Set the next item in the randomNumbers list to a new random number and update the pointer to point to it

Utility routines

Subroutine: NextRandomNumber

Point to the next item in the randomNumbers list

Sound

Subroutine: MakeSound

Make a sound

Setup

Subroutine: TerminateGame

Terminate the current game

Sound

Subroutine: DefineEnvelope

Define a sound envelope

Sound

Subroutine: MakeSoundEnvelope

Either make a sound or set up an envelope

Sound

Subroutine: ToggleEngineSound

Turn the engine sound on or off

Sound

Subroutine: ResetEngineSound

Reset the pitch of the engine sound

Sound

Subroutine: MakeEngineSound

Make the engine sound, with the choppiness and pitch affected by thrust and airspeed

Graphics

Subroutine: DrawGunSights

Draw the canopy corners and the gun sights, if shown

Keyboard

Subroutine: ToggleJoystick

Toggle the joystick setting

Sound

Variable: envelopeData

Data for two sound envelopes

Sound

Variable: soundData

OSWORD blocks for making the various game sounds

Aviator F
---------

CategoryDetails

The Theme

Subroutine: PrintTooLate

Print the "TOO LATE!" message at column 6, row 7 on-screen

The Theme

Variable: tooLateText

The "TOO LATE!" message shown when the aliens land in Acornsville

Graphics

Variable: xLookupLo

Lookup table for converting pixel x-coordinate to low byte of screen address

Graphics

Variable: xLookupHi

Lookup table for converting pixel x-coordinate to high byte of screen address

Keyboard

Variable: keyTable1

Internal key numbers of high priority keys that are scanned first

Keyboard

Variable: keyTable2

Internal key numbers of lower priority keys that are scanned second

Flight model

Variable: axisChangeRate

Stores the amount by which the three axes of movement change when the aileron, elevator or rudder are moved

Keyboard

Variable: keyTable2Lo

Key logger value (low byte) for key presses in keyTable2

Keyboard

Variable: keyTable2Hi

Key logger value (high byte) for key presses in keyTable2

Keyboard

Variable: keyTable1Lo

Key logger value (low byte) for key presses in keyTable1

Keyboard

Variable: keyTable1Hi

Key logger value (high byte) for key presses in keyTable1

Sound

Variable: soundData26

The sound of us making contact with the ground while landing

Flight model

Variable: forceFactor

The factors by which the flight forces are multiplied as part of the scaling process

Dashboard

Variable: dialQuadrant

The value range of a quadrant in each indicator

Dashboard

Variable: xDeltaMax

The maximum x-delta for the hand line in each indicator

Dashboard

Variable: yDeltaMax

The maximum y-delta for the hand line in each indicator

Dashboard

Variable: indicatorLineI

Line buffer storage for the start x-coordinate for each indicator line (I)

Dashboard

Variable: indicatorLineJ

Line buffer storage for the start y-coordinate for each indicator line (J)

Dashboard

Variable: indicatorBase

The base value for each indicator

Dashboard

Variable: indicatorMin

The minimum value shown on each indicator

Dashboard

Variable: indicatorLineT

Line buffer storage for the indicator line's |x-delta| (T)

Dashboard

Variable: indicatorLineU

Line buffer storage for the indicator line's |y-delta| (U)

Dashboard

Variable: indicatorLineV

Line buffer storage for the indicator line's direction (V)

Dashboard

Variable: yJoyCoord

Temporary storage

Dashboard

Variable: xJoyCoord

Temporary storage

Dashboard

Variable: indicator0To6

The first indicator counter

Dashboard

Variable: indicator7To11

The second indicator counter

Dashboard

Variable: joyCoord

Temporary storage

Dashboard

Variable: altitudeMinutes

The value of the altimeter's large "minute" hand

Flight model

Subroutine: ApplyFlightModel (Part 1 of 7)

Apply the flight model to the plane, starting by calculating the effect of gravity and the undercarriage springs

Flight model

Subroutine: ApplyFlightModel (Part 2 of 7)

Convert velocity to the plane's perspective and calculate various aerodynamic forces

Flight model

Subroutine: ApplyFlightModel (Part 3 of 7)

If we are near to an exploding alien, apply turbulence

Flight model

Subroutine: ApplyFlightModel (Part 4 of 7)

Calculate the dxTurn and xLinear vectors, and the slipRate

Flight model

Subroutine: ApplyFlightModel (Part 5 of 7)

Calculate the forces for when we are on the ground

Flight model

Subroutine: ApplyFlightModel (Part 6 of 7)

Adjust the plane's velocity and turn rate, rotate the plane according to the forces on the aircraft, process landing

Flight model

Subroutine: ApplyFlightModel (Part 7 of 7)

Calculate fuel usage

Flight model

Subroutine: AdjustTurn

Adjust the plane's turn rate

Flight model

Subroutine: AdjustVelocity

Adjust the plane's velocity vector

Flight model

Subroutine: AdjustRotation

Move the plane and adjust its rotation

Flight model

Subroutine: ApplyAerodynamics (Part 1 of 3)

Set up various variables to use in the aerodynamics calculations

Flight model

Subroutine: ApplyAerodynamics (Part 2 of 3)

Check whether the plane is stalling, and if it is, simulate one wing stalling before the other, and make the stalling sound

Flight model

Subroutine: ApplyAerodynamics (Part 3 of 3)

Calculate various aerodynamic figures

Flight model

Subroutine: ScaleFlightForces

Scale the flight forces by the relevant scale factors

Maths

Subroutine: Multiply8x16

Multiply an 8-bit and a 16-bit number

Maths

Subroutine: Negate16Bit

Negate a 16-bit number

Flight model

Subroutine: GetMoments

Calculate the pitching, rolling and yawing moments due to the current pitch, roll and yaw rates

Flight model

Subroutine: ApplyFlightControl

Calculate the effects of the primary flight controls (elevator, rudder and ailerons), and implement the "instant centre" feature

Flight model

Subroutine: ApplyTurnAndThrust (Part 1 of 2)

Calculate the (dxTurn, dyTurn, dzTurn) vector

Flight model

Subroutine: ApplyTurnAndThrust (Part 2 of 2)

Calculate the (xLinear, yLinear, zLinear) vector

Flight model

Subroutine: CheckPlaneOnRunway

Check whether the plane is over the runway

Flight model

Subroutine: ProcessLanding (Part 1 of 7)

If this is an emergency landing, make the landing a bumpy one

Flight model

Subroutine: ProcessLanding (Part 2 of 7)

If we are too high to be touching the ground then we can't be landing, so stop the landing checks

Flight model

Subroutine: ProcessLanding (Part 3 of 7)

If we are taxiing, restrict the plane's vertical movement and roll

Flight model

Subroutine: ProcessLanding (Part 4 of 7)

If we are taxiing with the undercarriage up, restrict pitching

Flight model

Subroutine: ProcessLanding (Part 5 of 7)

If we are taxiing with the undercarriage down, restrict pitching and tilt the plane backwards

Flight model

Subroutine: ProcessLanding (Part 6 of 7)

If we are not taxiing, process the landing

Flight model

Subroutine: ProcessLanding (Part 7 of 7)

We have successfully touched down without crashing, so process the effects of landing on the plane

Flight model

Subroutine: ApplyBumpyRide

Apply a random amount of roll or bumpiness to the plane

Maths

Subroutine: AddScaled

Add or subtract a scaled amount to a variable

Flight model

Subroutine: ScaleByAltitude

Multiply the high byte of the plane's altitude by a 16-bit number

Utility routines

Subroutine: ResetVariable

Set a 16-bit in the variable workspace to 0

Setup

Subroutine: Entry

The main entry point for the game: move code into lower memory and call it