This index contains every subroutine and entry point that appears in the source code for Aviator, grouped by category. An entry points is a label within a subroutine that is called from outside the subroutine, which typically implements a subset or variation of the functionality of the parent subroutine.
- 3D geometry
- Dashboard
- Drawing lines
- Flight model
- Graphics
- Keyboard
- Main loop
- Maths
- Scoring
- Setup
- Sound
- The Theme
- Utility routines
- Visibility
3D geometry
| |
AddPointToObject | Add a point vector to an object's coordinates |
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 |
AddTempToPoint (Part 2 of 2) | Check whether the vector addition overflowed and set the point's visibility accordingly |
NextObjectGroup | Cycle to the next object group |
ProjectAxisAngle | Convert the rotation angles of the plane into coordinates |
ProjectPoint (Part 1 of 3) | Project a point onto the screen (i.e. convert from 3D coordinates to screen coordinates) |
ProjectPoint (Part 2 of 3) | Calculate the screen coordinates of the projected point |
ProjectPoint (Part 3 of 3) | Move the projected coordinates to the centre of the screen and update the point's status byte |
SetMatrices | Set up matrices 1 to 4 |
SetMatrixEntry | Calculate a matrix entry |
SetMatrixEntry2 | Set mWrite = (S R) * mRead >> 16 and (J I) = mRead SetMatrixEntry3 Set mWrite = (J I) * -mRead >> 16 and (S R) = -mRead |
SetMatrixEntry3 | Set mWrite = (J I) * -mRead >> 16 and (S R) = -mRead |
SetObjectCoords (Part 1 of 11) | Calculate the coordinates for an object's location |
SetObjectCoords (Part 2 of 11) | Pre-process the bullets (objects 12, 13, 14 or 15) |
SetObjectCoords (Part 3 of 11) | Logic for checking which objects to pre-process |
SetObjectCoords (Part 4 of 11) | Pre-process the object groups (objects 6, 7, 8 or 9) |
SetObjectCoords (Part 5 of 11) | Logic for checking which objects to pre-process |
SetObjectCoords (Part 6 of 11) | Pre-process dormant aliens (object group 30) |
SetObjectCoords (Part 7 of 11) | Pre-process feeding and flying aliens (objects 31, 32 and 33) |
SetObjectCoords (Part 8 of 11) | Process the object |
SetObjectCoords (Part 9 of 11) | Process the next object in the group, if applicable, or return from the subroutine if not |
SetObjectCoords (Part 10 of 11) | Process the next dormant alien (object group 30) |
SetObjectCoords (Part 11 of 11) | Update the object status and return from the subroutine |
SetObjectToOrigin | Set an object's coordinates to (0, 0, 0) |
SetObjPointCoords (Part 1 of 2) | Calculate the coordinate for a point within an object |
SetObjPointCoords (Part 2 of 2) | Apply the correct scale factor to the matrix multiplication |
SetPoint | Set a point's coordinates to the value (a, a, a) |
SetPointCoords | Calculate the coordinates for a point |
SetPointToOrigin | Set a point's coordinates to the origin at (0, 0, 0) |
SetPointVisibility | Set the status byte for multiple points to indicate that their coordinates and visibility have been calculated |
Dashboard
| |
ArtificialHorizon | Vector line calculation for the artificial horizon on indicator 7 |
DrawFuelPixel | Draw or erase a pixel on the fuel gauge on the dashboard |
DrawRadarBlip | Draw a blip on the radar (runway or alien) |
GetHandVector | Vector line calculation for a hand on indicators 0 to 6 |
GetRadarVector | Calculate the radar line vector for a line (the runway) or a dot (an alien) |
IndicatorB | Update the brakes indicator ("B") |
IndicatorF | Update the flaps indicator ("F") and related variables |
IndicatorT | Update the Theme indicator ("T") |
IndicatorU | Update the undercarriage indicator ("U") and related variables |
ResetRadar | Reset the radar display |
ShowUpsideDownBar | Show or hide the upside down bar in the artificial horizon indicator |
UpdateDash7To11 | Update the next indicator in the range 7 to 11 |
UpdateDashboard | Update two indicators on the dashboard, one from 0-6, one from 7-11, cycling through them with each subsequent call |
UpdateFuelGauge | Update the fuel gauge every 16 iterations of the main loop |
UpdateIndicator (Part 1 of 15) | Update a single indicator on the dashboard |
UpdateIndicator (Part 2 of 15) | Calculations for the compass (indicator 0) |
UpdateIndicator (Part 3 of 15) | Calculations for the airspeed indicator (indicator 1) |
UpdateIndicator (Part 4 of 15) | Calculations for the altimeter's small "hour" hand (indicator 2) |
UpdateIndicator (Part 5 of 15) | Calculations for the altimeter's "minute" hand (indicator 3) |
UpdateIndicator (Part 6 of 15) | Logic for checking which indicator to update |
UpdateIndicator (Part 7 of 15) | Calculations for the vertical speed indicator (indicator 4) |
UpdateIndicator (Part 8 of 15) | Logic for checking which indicator to update |
UpdateIndicator (Part 9 of 15) | Calculations for the turn indicator (indicator 5), the bottom part of the slip-and-turn indicator |
UpdateIndicator (Part 10 of 15) | Calculations for the slip indicator (indicator 6), the top part of the slip-and-turn indicator |
UpdateIndicator (Part 11 of 15) | Calculations for the artificial horizon (indicator 7) |
UpdateIndicator (Part 12 of 15) | Logic for checking which indicator to update |
UpdateIndicator (Part 13 of 15) | Calculations for the rudder indicator (indicator 9) |
UpdateIndicator (Part 14 of 15) | Calculations for the joystick position display (indicator 8 or 10) |
UpdateIndicator (Part 15 of 15) | Calculations for the thrust indicator (indicator 11) |
UpdateRadarBlip | Update a blip on the radar (runway or alien) |
Drawing lines
| |
AbortLine | Abort drawing this line |
ClipBestEndOfLine | Clip a line at the start or end point, depending on which is best |
ClipStartOfLine (Part 1 of 5) | Check whether the line is completely off-screen |
ClipStartOfLine (Part 2 of 5) | Work out the deltas depending on the direction of slope |
ClipStartOfLine (Part 3 of 5) | Work out the deltas depending on the steepness of slope |
ClipStartOfLine (Part 4 of 5) | Calculate where to clip the line |
ClipStartOfLine (Part 5 of 5) | Move the start point to the clipped position and return it |
DrawCanopyLine (Part 1 of 9) | Draw a line in the canopy view |
DrawCanopyLine (Part 2 of 9) | Modify the line drawing routine for a shallow horizontal slope |
DrawCanopyLine (Part 3 of 9) | Draw a line as a shallow horizontal slope |
DrawCanopyLine (Part 4 of 9) | Draw a part of the line, working down the screen |
DrawCanopyLine (Part 5 of 9) | Draw a part of the line, working up the screen |
DrawCanopyLine (Part 6 of 9) | Draw a part of the line, working along the screen |
DrawCanopyLine (Part 7 of 9) | Modify the line drawing routine for a steep vertical slope |
DrawCanopyLine (Part 8 of 9) | Draw a line as a steep vertical slope |
DrawCanopyLine (Part 9 of 9) | If the line was clipped, draw a line from the clipped coordinates to the edge of the screen |
DrawClippedHorizon | Set bit 1 of the line direction in V (for the horizon) |
DrawClippedLine (Part 1 of 6) | Clip a line to fit on-screen, starting with the line deltas |
DrawClippedLine (Part 2 of 6) | Work out whether the line's start point is on-screen |
DrawClippedLine (Part 3 of 6) | Work out whether the line's end point is on-screen |
DrawClippedLine (Part 4 of 6) | Calculate the starting point and direction for our clipped vector line |
DrawClippedLine (Part 5 of 6) | Calculate the deltas for our clipped vector line |
DrawClippedLine (Part 6 of 6) | Add the clipped line to the line buffer and draw it |
DrawHalfHorizon | Draw half of the horizon line |
DrawIndicatorBar | Draw a vertical bar on indicator 9 (rudder) or 11 (thrust) |
DrawIndicatorHand | Apply min and max limits to an indicator value and draw a hand on the indicator |
DrawIndicatorLine | Draw a line on indicators 0 to 7, i.e. a dial hand (0-6) or an artificial horizon (7) |
DrawJoystickCross | Draw a cross in the joystick position display (indicator 8 or 10) |
DrawOrthoLine | Draw an orthogonal line (i.e. vertical or horizontal) |
DrawVectorLine (Part 1 of 3) | Draw a line: set up pixel bytes and slope variables |
DrawVectorLine (Part 2 of 3) | Calculate the coordinates of the next pixel as we step along the line by one pixel |
DrawVectorLine (Part 3 of 3) | Plot a pixel at (I, J) |
EraseCanopyLines | Draw all the lines from a line buffer to erase them |
EraseOrthoLine | Use the value of G instead of H (so the coordinate is G + W) and always use EOR Logic to draw the line (which will erase it if it is already on-screen) |
ModifyDrawRoutine | Modify the drawing routines to draw in the correct colour for the current colour cycle |
SwapLinePoints | Copy an end point into a start point |
Flight model
| |
AdjustRotation | Move the plane and adjust its rotation |
AdjustTurn | Adjust the plane's turn rate |
AdjustVelocity | Adjust the plane's velocity vector |
ApplyAerodynamics (Part 1 of 3) | Set up various variables to use in the aerodynamics calculations |
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 |
ApplyAerodynamics (Part 3 of 3) | Calculate various aerodynamic figures |
ApplyBumpyRide | Apply a random amount of roll or bumpiness to the plane |
ApplyFlightControl | Calculate the effects of the primary flight controls (elevator, rudder and ailerons), and implement the "instant centre" feature |
ApplyFlightModel (Part 1 of 7) | Apply the flight model to the plane, starting by calculating the effect of gravity and the undercarriage springs |
ApplyFlightModel (Part 2 of 7) | Convert velocity to the plane's perspective and calculate various aerodynamic forces |
ApplyFlightModel (Part 3 of 7) | If we are near to an exploding alien, apply turbulence |
ApplyFlightModel (Part 4 of 7) | Calculate the dxTurn and xLinear vectors, and the slipRate |
ApplyFlightModel (Part 5 of 7) | Calculate the forces for when we are on the ground |
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 |
ApplyFlightModel (Part 7 of 7) | Calculate fuel usage |
ApplyTurnAndThrust (Part 1 of 2) | Calculate the (dxTurn, dyTurn, dzTurn) vector |
ApplyTurnAndThrust (Part 2 of 2) | Calculate the (xLinear, yLinear, zLinear) vector |
CheckPlaneOnRunway | Check whether the plane is over the runway |
Crash | Make a crashing sound, flash the canopy and start a new game |
FillUpFuelTank | Fill up the fuel tank by 1/65th of a full tank every four iterations of the main loop |
GetMoments | Calculate the pitching, rolling and yawing moments due to the current pitch, roll and yaw rates |
GetMoments-1 | Contains an RTS |
ProcessLanding (Part 1 of 7) | If this is an emergency landing, make the landing a bumpy one |
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 |
ProcessLanding (Part 3 of 7) | If we are taxiing, restrict the plane's vertical movement and roll |
ProcessLanding (Part 4 of 7) | If we are taxiing with the undercarriage up, restrict pitching |
ProcessLanding (Part 5 of 7) | If we are taxiing with the undercarriage down, restrict pitching and tilt the plane backwards |
ProcessLanding (Part 6 of 7) | If we are not taxiing, process the landing |
ProcessLanding (Part 7 of 7) | We have successfully touched down without crashing, so process the effects of landing on the plane |
RetractFlapsIfFast | Retract the flaps if we are going faster than 150 mph |
ScaleByAltitude | Multiply the high byte of the plane's altitude by a 16-bit number |
ScaleByAltitude-1 | Contains an RTS |
ScaleFlightForces | Scale the flight forces by the relevant scale factors |
SetEngine | Set the engine status |
UpdateFlightModel (Part 1 of 4) | Apply any axis control key presses to the current axis values |
UpdateFlightModel (Part 2 of 4) | Apply any throttle key presses to the current thrust value |
UpdateFlightModel (Part 3 of 4) | Process the undercarriage, brake, flaps and fire keys |
UpdateFlightModel (Part 4 of 4) | Set up matrices, apply the flight model and update the dashboard |
Graphics
| |
ClearCanopy | Clear the canopy to black, leaving the canopy edges alone |
ClearRows | Clear the specified number of rows on-screen |
DrawCanopyCorners | Draw the diagonal corners at the top of the canopy |
DrawCanopyView | Draw the main view out of the canopy |
DrawGunSights | Draw the canopy corners and the gun sights, if shown |
DrawRivet | Draw a square rivet (2 pixels across, 4 pixels high) |
FillCanopy | Fill the canopy with a specified colour, leaving the canopy edges alone |
FillCanopyRows | Fill multiple screen rows with a particular colour, avoiding the canopy edges |
FlipColours | Flip the values of colourCycle and colourLogic to cycle to the next colour state |
SetColourToBlack | Set a logical colour to black |
SetColourToWhite | Set a logical colour to white |
SetLogicalColour | Set a logical colour to a physical colour |
VduDraw | Draw a line using the standard VDU routines |
VduMove | Move the graphics cursor using the standard VDU routines |
VduPlot | Perform a plot command using the standard VDU routines |
VduPoint | Draw a point on-screen using the standard VDU routines |
Keyboard
| |
ProcessOtherKeys | Apply the undercarriage, brakes, flaps and fire keys |
ReadADCChannel | Read the joystick position from one of the ADC channels |
ReadJoystick | Read the joystick axes and fire button and update the aileron, elevator and fire key values accordingly |
ScanKeyboard | Scan the keyboard for a specific key |
ToggleJoystick | Toggle the joystick setting |
UpdateKeyLogger | Scan the keyboard for keys in the two key tables and update the key logger |
Main loop
| |
MainLoop (Part 1 of 15) | Start the main loop by processing gunfire and bullets |
MainLoop (Part 2 of 15) | Reset object statuses and related points |
MainLoop (Part 3 of 15) | Make the sound of firing, if appropriate |
MainLoop (Part 4 of 15) | Check whether aliens have invaded Acornsville |
MainLoop (Part 5 of 15) | Update lines, check flying skills, increment main loop counter, update the radar |
MainLoop (Part 6 of 15) | Check whether any aliens have been hit |
MainLoop (Part 7 of 15) | Process the terminate key |
MainLoop (Part 8 of 15) | If we fire the guns on the runway, enable the Theme |
MainLoop (Part 9 of 15) | Fill up the tank if the engine is switched off, and process the volume keys |
MainLoop (Part 10 of 15) | Award points for a successful landing |
MainLoop (Part 11 of 15) | Process engine start and stop |
MainLoop (Part 12 of 15) | Spend at least 9 centiseconds processing lines from the linesToHide list |
MainLoop (Part 13 of 15) | Process more lines and update the view out of the canopy |
MainLoop (Part 14 of 15) | Handle the score display |
MainLoop (Part 15 of 15) | Update the status of any new line points |
Maths
| |
Add16x16Bit0 | Add two 16-bit numbers that have their signs in bit 0 |
AddScaled | Add or subtract a scaled amount to a variable |
DivideScaled | Divide a 16-bit number by a scaled 16-bit number |
Multiply16x16 | Multiply two unsigned 16-bit numbers |
Multiply16x16Bit0 | Multiply two 16-bit numbers that have their signs in bit 0 |
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) |
Multiply4x16 | Multiply a 4-bit and a 16-bit number |
Multiply8x16 | Multiply an 8-bit and a 16-bit number |
Multiply8x16-2 | Store X in VV before doing the calculation Multiply8x16-6 Store X in VV and calculate (G W V) = (A Y) * R |
Multiply8x16-6 | Store X in VV and calculate (G W V) = (A Y) * R |
Multiply8x8 | Multiply two unsigned 8-bit numbers |
Negate16Bit | Negate a 16-bit number |
ScaleDown (Part 1 of 4) | Scale down the results of divisions done using the ScaleUp and DivideScaled routines |
ScaleDown (Part 2 of 4) | Balance the scale factors for the x- and y-coordinates |
ScaleDown (Part 3 of 4) | Scale the x-coordinate |
ScaleDown (Part 4 of 4) | Scale the y-coordinate |
ScaleSigned | Scale an indicator value by 4 or 16, retaining the sign and adding sensitivity for smaller values |
ScaleUp | Scale up a 16-bit number until it doesn't fit into 16 bits any more |
Sine16Bit | Calculate the sine of a 16-bit number |
Scoring
| |
CheckBridgeAndTown | Check whether we are safely flying under the bridge or down the main street in Acornsville |
CheckFlyingSkills (Part 1 of 2) | Check whether we are performing one of the tests of flying skill |
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 |
DisplayScore | Print the scores on-screen |
PrintScore | Print a score |
PrintScoreText | Print text when showing the scores on-screen |
RemoveScore | Remove the score display from the screen |
ScoreHitPoints | Award points for destroying an alien, and remove the alien from its slot and the radar, if required |
ScorePoints | Increase the score and make a beep |
UpdateHighScore | If this is a high score, update the high score |
UpdateScore | Increase the score by a specified number of points |
Setup
| |
DrawCanopy | Move code around, clear the edges of the canopy view, draw the canopy edges and rivets, and jump to the main code |
Entry | The main entry point for the game: move code into lower memory and call it |
NewGame | Start a new game |
ResetVariables | Reset most variables to prepare for a new flight |
SetupScreen | Set up the screen mode and load the dashboard image |
StartGame | Reset the high score, set up the gunfire sound envelope and start a new game |
TerminateGame | Terminate the current game |
Sound
| |
DefineEnvelope | Define a sound envelope |
MakeEngineSound | Make the engine sound, with the choppiness and pitch affected by thrust and airspeed |
MakeSound | Make a sound |
MakeSoundEnvelope | Either make a sound or set up an envelope |
ProcessVolumeKeys | Adjust the volume when the volume keys are pressed |
ResetEngineSound | Reset the pitch of the engine sound |
ToggleEngineSound | Turn the engine sound on or off |
The Theme
| |
AlienInAcornsville | Move an alien towards Acornsville and check whether it has reached it yet (and if so, end the game) |
CheckAlienWeakSpot | Check whether an object is close enough to an alien's weak spot to be hitting it |
CheckIfAlienIsHit (Part 1 of 2) | Extract the alien's feeding stage, ready for the hit calculations in part 2 |
CheckIfAlienIsHit (Part 2 of 2) | Check to see whether the alien has been hit, and if so, initiate the explosion |
ExplodeAlien | Explode an alien, making the alien split apart |
FireGuns | Create the bullet objects and send them on their way |
FireGuns-1 | Contains an RTS |
GetAlienWeakSpot | Calculate the coordinates of an alien's weak spot |
GetTrailVectorStep | Calculate 1/32 of the vector for a bullet trail |
PrintTooLate | Print the "TOO LATE!" message at column 6, row 7 on-screen |
ResizeFeedingAlien | Change the size of an alien so it grows bigger as it feeds |
SpawnAlien | If the Theme is enabled and the current wave does not yet have eight aliens in it, spawn a new alien |
UpdateAliens (Part 1 of 5) | Update the aliens so they progress through their feeding or attack cycles |
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 |
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 |
UpdateAliens (Part 4 of 5) | When an alien reaches the next feeding stage, double its size |
UpdateAliens (Part 5 of 5) | Check whether the whole wave has been destroyed, and award points accordingly |
UpdateBullets | Move the bullets through the air |
Utility routines
| |
CheckTimePassed | Flag whether 9 centiseconds have passed since the last call |
CopyPointToWork | Copy a point from the point tables to the variable workspace |
CopyTempToPoint | Set a specified point to (xTemp1, yTemp1, zTemp1) |
CopyWorkToPoint | Copy a point from the variable workspace to the point tables |
Delay | Delay for a specified number of loops |
NextRandomNumber | Point to the next item in the randomNumbers list |
ResetVariable | Set a 16-bit in the variable workspace to 0 |
SetRandomNumber | Set the next item in the randomNumbers list to a new random number and update the pointer to point to it |
Visibility
| |
CheckLineDistance | Check whether a point on a line is within the visible distance for the line |
CheckObjDistance | Check whether an object is within the visible distance for that object, along just one axis |
ProcessHorizonLine | Calculate coordinates for the horizon's start and end points |
ProcessLine (Part 1 of 7) | Process a line, rotating and transforming it to the correct coordinates and calculating its visibility |
ProcessLine (Part 2 of 7) | Process runway lines |
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 |
ProcessLine (Part 4 of 7) | Process bullet lines |
ProcessLine (Part 5 of 7) | Calculate the object's coordinates and visibility |
ProcessLine (Part 6 of 7) | Check the visibility of all the object's points on the stack |
ProcessLine (Part 7 of 7) | Check distance and z-coordinates and return the final result |
ProcessLine-1 | Contains an RTS |
ProcessLinesToHide | Process an unprocessed line from the linesToHide list |
ProcessLinesToShow | Process the linesToShow list, projecting all the lines onto the screen and moving any that aren't visible to the linesToHide list |
ProcessRunwayLine (Part 1 of 5) | Calculate coordinates and visibility for a runway line |
ProcessRunwayLine (Part 2 of 5) | Calculate coordinates and visibility for the runway outline |
ProcessRunwayLine (Part 3 of 5) | Calculate visibility for the runway dashes |
ProcessRunwayLine (Part 4 of 5) | Construct the dashes down the middle of the runway |
ProcessRunwayLine (Part 5 of 5) | Clip any portion of the runway outline that's behind us |
ResetLineLists | Reset the line lists at linesToShow and linesToHide |
ShowOrHideLine | Process a line, working out its visibility and adding it to the linesToShow or linesToHide list |
UpdateLinesToShow | Update the linesToShow list, moving any lines that aren't visible into the linesToHide list |