Skip to navigation


List of all subroutines

This index contains every subroutine and entry point that appears in the source code for Lander, 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 objects
----------

DrawObject (Part 1 of 5)Draw a 3D object and its shadow
DrawObject (Part 2 of 5)Process the object's vertices
DrawObject (Part 3 of 5)Calculate the visibility of each of the object's faces
DrawObject (Part 4 of 5)Draw the shadow for each of the object's faces
DrawObject (Part 5 of 5)Draw each of the object's faces
DrawObjects (Part 1 of 3)Draw all the objects in the visible portion of the object map, starting by working our way through the map looking for objects
DrawObjects (Part 2 of 3)Draw the object that we have found on the object map
DrawObjects (Part 3 of 3)Draw a destroyed object that we have found on the object map
PlaceObjectsOnMapRandomly place a number of objects on the map, avoiding the sea and the launchpad

Copy protection
---------------

DecryptGameBinary (!RunImage)Placeholder routine to decrypt game code to &8000 so it can be run
RunImageEntry (!RunImage)Entry point for the !RunImage Absolute file

Drawing lines
-------------

DrawHorizontalLineDraw a horizontal line
DrawLineSegmentDraw a horizontal line of between 0 and 17 pixels by jumping to the relevant entry point

Drawing the screen
------------------

SwitchScreenBankSwitch screen banks and clear the newly hidden screen bank to black

Drawing triangles
-----------------

DrawQuadrilateralDraw a quadrilateral (i.e. two triangles)
DrawTriangle (Part 1 of 11)Draw a triangle, starting by ordering the coordinates and jumping to the relevant part of the routine
DrawTriangle (Part 2 of 11)Calculate the slope of (x1, y1) to (x2, y2)
DrawTriangle (Part 3 of 11)Calculate the slope of (x1, y1) to (x3, y3)
DrawTriangle (Part 4 of 11)Draw a triangle that isn't clipped and has a sloping first side
DrawTriangle (Part 5 of 11)Draw a triangle with a horizontal edge between (x1, y1) and (x2, y2)
DrawTriangle (Part 6 of 11)Draw a clipped triangle that's partly off-screen
DrawTriangle (Part 7 of 11)Calculate the slopes of (x1, y1) to (x2, y2) and (x1, y1) to (x3, y3) for a clipped triangle
DrawTriangle (Part 8 of 11)Draw the bottom part of a clipped triangle
DrawTriangle (Part 9 of 11)Draw the top part of a clipped triangle
DrawTriangle (Part 10 of 11)Draw a clipped triangle with a horizontal edge between (x1, y1) and (x2, y2)
DrawTriangle (Part 11 of 11)Draw a triangle, clipping it to the screen as we go
DrawTriangleFromBufferProcess the "draw triangle" command from the graphics buffer
DrawTriangleShadowToBufferDraw a triangle shadow into the correct graphics buffer, according to its distance
DrawTriangleToBufferDraw a coloured triangle into a slightly nearer graphics buffer, according to its distance

Graphics buffers
----------------

AddTerminatorsToBuffersAdd terminators to the ends of the graphics buffers so we know when to stop drawing
DrawGraphicsBufferDraw the contents of the specified graphics buffer
DrawNextFromGraphicsBufferProcess the next command from the graphics buffer
TerminateGraphicsBufferTerminate drawing from the graphics buffer by returning from the subroutine

Landscape
---------

DrawLandscapeAndBuffers (Part 1 of 4)Draw the landscape and the contents of the graphics buffers, from the back of the screen to the front
DrawLandscapeAndBuffers (Part 2 of 4)Draw a row of landscape tiles
DrawLandscapeAndBuffers (Part 3 of 4)Draw the objects in the graphics buffers for two rows behind the current corner row
DrawLandscapeAndBuffers (Part 4 of 4)Draw the remaining graphics buffers
GetLandscapeAltitudeCalculate the altitude of the landscape for a given coordinate
GetLandscapeBelowVertexCalculate the landscape altitude directly below an object's vertex
GetLandscapeTileColourCalculate the colour of the landscape tile currently being drawn

Main loop
---------

EndGameFinish the game
GameOverPrint a Game Over message and start a new game
LoseLifeDisplay a crash animation when we lose a life and end the game if this is our last life
LoseLifeFromParticleLoopLose a life when a crash is detected in the particle processing loop
MainLoopThe main game loop
StartNewGameStart a brand new game with a full set of lives and a newly generated set of objects

Maths (Arithmetic)
------------------

GetRandomNumbersGenerate pseudo-random numbers from the random number seeds

Maths (Geometry)
----------------

AddVectorsAn unused routine that adds two vectors and uses self-modifying code to store the results in a specified location
AddVectorsWithFeedbackAn unused routine that adds a delta vector to a coordinate and updates the delta with feedback from the coordinate value
AddVectorToVerticesAdd a vector to the rotated vertex coordinates to get the vertex coordinates in 3D space
AddVectorToVertices+8Enter the routine with R0 to R3 already set
CalculateRotationMatrixCalculate the rotation matrix
GetDotProductCalculate the dot product of two 3D vectors
GetMouseInPolarCoordinates (Part 1 of 2)Convert the mouse x- and y-coordinates into polar coordinates, starting by calculating the polar angle
GetMouseInPolarCoordinates (Part 2 of 2)Calculate the polar distance
MultiplyVectorByConstantAn unused routine that multiplies a vector by a constant value
MultiplyVectorByMatrixMultiply a 3D vector by the rotation matrix in rotationMatrix, if the object is a rotating object
ProjectParticleOntoScreenProject a 3D particle coordinate onto the screen
ProjectVertexOntoScreenProject a vertex coordinate from a 3D object onto the screen
TransposeRotationMatrixAn unused routine that transposes the rotation matrix

Particles
---------

AddBulletParticleToBufferAdd a bullet particle to the particle data buffer
AddDebrisParticleToBufferAdd a debris particle to the particle data buffer, which is a purple-brownish-green particle that bounces out of an explosion
AddExhaustParticleToBufferAdd one of the moving particles in the exhaust plume to the particle data buffer
AddExplosionToBufferCreate a big explosion of particles and add it to the particle data buffer
AddMovingParticleToBufferAdd a moving particle to the particle data buffer, adding a random element to its velocity and lifespan counter
AddRisingParticleToBufferAdd a particle to the particle data buffer that initially drifts up, with a random element to its velocity and lifespan counter
AddShipExplosionToBufferAn unused routine that adds a 50-cluster explosion cloud to the particle data buffer, just front of the player's ship
AddSmallExplosionToBufferAdd a small explosion to the particle data buffer
AddSmokeParticleToBufferAdd a smoke particle to the particle data buffer
AddSparkCloudToBufferAn unused routine that adds a cloud of 150 spark particles to the particle data buffer, just in front of the player's ship
AddSparkParticleToBufferAdd a spark particle to the particle data buffer that fades from white-hot to red over time
AddSprayParticleToBufferAdd a spray particle to the particle data buffer
AddStaticParticleToBufferAdd a particle to the particle data buffer that starts off static, adding a random element to its velocity and lifespan counter
BounceParticleBounce a particle off the ground
DeleteParticleDataDelete a particle from the particle data buffer and move the last particle's data down to take its place
dpar1The start of the main particle-processing loop
Draw1x1ParticleFromBufferProcess the "draw 1x1-pixel specified" command from the graphics buffer
Draw2x1ParticleFromBufferProcess the "draw 2x1-pixel particle" command from the graphics buffer
Draw2x2ParticleFromBufferProcess the "draw 2x2-pixel particle" command from the graphics buffer
Draw3x1ParticleFromBufferProcess the "draw 3x1-pixel particle" command from the graphics buffer
Draw3x2ParticleFromBufferProcess the "draw 3x2-pixel particle" command from the graphics buffer
DrawParticleShadowToBufferDraw a small black particle into the correct graphics buffer, according to its distance
DrawParticleToBufferDraw a large coloured particle into a slightly nearer graphics, buffer according to its distance
DropARockFromTheSkyDrop a rock from the specified coordinates by spawning it as a particle, albeit a very big particle with an associated 3D object
DropRocksFromTheSkyIf the score is 800 or more, then randomly drop rocks from the sky by spawning them as particles
MoveAndDrawParticles (Part 1 of 4)Process particle movement and draw the particles into the graphics buffers, starting with the movement of particles
MoveAndDrawParticles (Part 2 of 4)Draw particles (including rocks) into the graphics buffers
MoveAndDrawParticles (Part 3 of 4)Process rocks by checking for collisions and drawing them as 3D objects
MoveAndDrawParticles (Part 4 of 4)Draw particles into the graphics buffers
ProcessObjectDestructionIf this particle has hit an object, destroy the object and the particle in an explosion, scoring points if it's a bullet
SetParticleColourToFadeSet the flags for a particle whose colour fades from white to red over time, to give a white-hot explosion particle that cools down
SpawnRockAn unused routine that spawns a rock in the sky, at half the altitude of the rocks in the DropRocksFromTheSky routine
SplashParticleIntoSeaSplash a particle into the sea, creating a spray particle
StoreParticleDataStore the data for a new particle in the particle data buffer

Player
------

LandOnLaunchpadCheck to see if the player has landed on the launchpad
MoveAndDrawPlayer (Part 1 of 5)Process player movement and draw the player's ship into the graphics buffers, starting with reading the mouse position
MoveAndDrawPlayer (Part 2 of 5)Update the player's velocity and coordinates
MoveAndDrawPlayer (Part 3 of 5)Check for collisions and draw the ship
MoveAndDrawPlayer (Part 4 of 5)Spawn the particles in the exhaust plume if the engine is engaged
MoveAndDrawPlayer (Part 5 of 5)Spawn a bullet particle if the fire button is being pressed
PlacePlayerOnLaunchpadThe main entry point for the game
ResetMousePositionReset the mouse position to (511, 511), ready for the game

Score bar
---------

DrawFuelLevelDraw the bar at the top of the screen showing the current fuel level
PrintCurrentScorePrint the current score at the left end of the score bar
PrintHexDigitAn unused routine that prints a single digit hexadecimal number in the score bar
PrintHexNumberAn unused routine that prints an 8-digit hexadecimal number on the second character row of the screen
PrintScoreInBothBanksPrint a number at a specified text column in the score bar

Start and end
-------------

AbortWithMemoryErrorShow a memory error and abort the game
EntryThe main entry point for the game
InitialiseParticleDataInitialise the particle data buffer and associated variables
ReturnToDesktopReturn to the desktop