This page contains a map of all the routines and variables in the original version of Lander, in the order in which they appear in the original source. The source files are structured like this:
- The main game source, which consists of Lander A, Lander B, Lander C and Lander D
- The !RunImage source for the RISC OS version
You can click on the links above to jump to the relevant part of the map.
Lander A
--------
Category | Details |
---|---|
Landscape | The offset we apply to the on-screen landscape to push it away from us and to the left, so the visible tiles fit nicely on-screen |
Landscape | The address of the landscape offset |
Landscape | The configuration data for each tile row in the landscape |
Landscape | The address of the landscapeConfig table |
Graphics buffers | The addresses of each of the graphics buffers (these values do not change) |
Graphics buffers | The end addresses of each of the graphics buffers (these values get updated as objects are drawn into the buffers) |
Landscape | Subroutine: DrawLandscapeAndBuffers (Part 1 of 4) Draw the landscape and the contents of the graphics buffers, from the back of the screen to the front |
Landscape | Subroutine: DrawLandscapeAndBuffers (Part 2 of 4) Draw a row of landscape tiles |
Landscape | Subroutine: DrawLandscapeAndBuffers (Part 3 of 4) Draw the objects in the graphics buffers for two rows behind the current corner row |
Landscape | Subroutine: DrawLandscapeAndBuffers (Part 4 of 4) Draw the remaining graphics buffers |
Landscape | Subroutine: GetLandscapeAltitude Calculate the altitude of the landscape for a given coordinate |
Landscape | Subroutine: GetLandscapeBelowVertex Calculate the landscape altitude directly below an object's vertex |
Landscape | Subroutine: GetLandscapeTileColour Calculate the colour of the landscape tile currently being drawn |
Player | Subroutine: MoveAndDrawPlayer (Part 1 of 5) Process player movement and draw the player's ship into the graphics buffers, starting with reading the mouse position |
Player | Subroutine: MoveAndDrawPlayer (Part 2 of 5) Update the player's velocity and coordinates |
Player | Subroutine: MoveAndDrawPlayer (Part 3 of 5) Check for collisions and draw the ship |
Player | Subroutine: MoveAndDrawPlayer (Part 4 of 5) Spawn the particles in the exhaust plume if the engine is engaged |
Player | Subroutine: MoveAndDrawPlayer (Part 5 of 5) Spawn a bullet particle if the fire button is being pressed |
Player | Check to see if the player has landed on the launchpad |
Main loop | Subroutine: LoseLifeFromParticleLoop Lose a life when a crash is detected in the particle processing loop |
Main loop | Display a crash animation when we lose a life and end the game if this is our last life |
Main loop | Print a Game Over message and start a new game |
Graphics buffers | Variable: graphicsBuffEndAddr2 The addresses of the tables containing the graphics buffer addresses (same as graphicsBufferEndAddr and graphicsBufferAddr) |
Particles | Subroutine: MoveAndDrawParticles (Part 1 of 4) Process particle movement and draw the particles into the graphics buffers, starting with the movement of particles |
Particles | Subroutine: MoveAndDrawParticles (Part 2 of 4) Draw particles (including rocks) into the graphics buffers |
Particles | Subroutine: MoveAndDrawParticles (Part 3 of 4) Process rocks by checking for collisions and drawing them as 3D objects |
Particles | Subroutine: MoveAndDrawParticles (Part 4 of 4) Draw particles into the graphics buffers |
Particles | Subroutine: SetParticleColourToFade Set the flags for a particle whose colour fades from white to red over time, to give a white-hot explosion particle that cools down |
Particles | Bounce a particle off the ground |
Particles | Subroutine: ProcessObjectDestruction If this particle has hit an object, destroy the object and the particle in an explosion, scoring points if it's a bullet |
Particles | Subroutine: AddSmallExplosionToBuffer Add a small explosion to the particle data buffer |
Particles | Subroutine: SplashParticleIntoSea Splash a particle into the sea, creating a spray particle |
Particles | Subroutine: DeleteParticleData Delete a particle from the particle data buffer and move the last particle's data down to take its place |
Particles | Subroutine: AddBulletParticleToBuffer Add a bullet particle to the particle data buffer |
Particles | Subroutine: AddExhaustParticleToBuffer Add one of the moving particles in the exhaust plume to the particle data buffer |
Particles | Subroutine: AddStaticParticleToBuffer Add a particle to the particle data buffer that starts off static, adding a random element to its velocity and lifespan counter |
Particles | Subroutine: AddRisingParticleToBuffer Add a particle to the particle data buffer that initially drifts up, with a random element to its velocity and lifespan counter |
Particles | Subroutine: AddMovingParticleToBuffer Add a moving particle to the particle data buffer, adding a random element to its velocity and lifespan counter |
Lander B
--------
Category | Details |
---|---|
Particles | Store the data for a new particle in the particle data buffer |
Start and end | Subroutine: InitialiseParticleData Initialise the particle data buffer and associated variables |
Particles | Subroutine: AddSmokeParticleToBuffer Add a smoke particle to the particle data buffer |
Particles | Subroutine: AddDebrisParticleToBuffer Add a debris particle to the particle data buffer, which is a purple-brownish-green particle that bounces out of an explosion |
Particles | Subroutine: DropARockFromTheSky Drop a rock from the specified coordinates by spawning it as a particle, albeit a very big particle with an associated 3D object |
Particles | Subroutine: AddSparkParticleToBuffer Add a spark particle to the particle data buffer that fades from white-hot to red over time |
Particles | Subroutine: AddSprayParticleToBuffer Add a spray particle to the particle data buffer |
Particles | Subroutine: AddExplosionToBuffer Create a big explosion of particles and add it to the particle data buffer |
Particles | Subroutine: AddShipExplosionToBuffer An unused routine that adds a 50-cluster explosion cloud to the particle data buffer, just front of the player's ship |
Particles | Subroutine: AddSparkCloudToBuffer An unused routine that adds a cloud of 150 spark particles to the particle data buffer, just in front of the player's ship |
Particles | An unused routine that spawns a rock in the sky, at half the altitude of the rocks in the DropRocksFromTheSky routine |
Particles | Subroutine: DropRocksFromTheSky If the score is 800 or more, then randomly drop rocks from the sky by spawning them as particles |
3D objects | A table that maps object types to object blueprints |
3D objects | Subroutine: 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 |
3D objects | Subroutine: DrawObjects (Part 2 of 3) Draw the object that we have found on the object map |
3D objects | Subroutine: DrawObjects (Part 3 of 3) Draw a destroyed object that we have found on the object map |
3D objects | The address of the object blueprint for the player's ship |
3D objects | The address of the object blueprint for a rock |
3D objects | Subroutine: DrawObject (Part 1 of 5) Draw a 3D object and its shadow |
3D objects | Subroutine: DrawObject (Part 2 of 5) Process the object's vertices |
3D objects | Subroutine: DrawObject (Part 3 of 5) Calculate the visibility of each of the object's faces |
3D objects | Subroutine: DrawObject (Part 4 of 5) Draw the shadow for each of the object's faces |
3D objects | Subroutine: DrawObject (Part 5 of 5) Draw each of the object's faces |
Score bar | Print the current score at the left end of the score bar |
Score bar | Subroutine: PrintScoreInBothBanks Print a number at a specified text column in the score bar |
Score bar | A four-pixel colour word for the colour of the fuel bar |
Maths (Geometry) | The address of the sine/cosine lookup table |
Maths (Geometry) | The address of the arctan lookup table |
Maths (Arithmetic) | The address of the square root lookup table |
Score bar | Draw the bar at the top of the screen showing the current fuel level |
Graphics buffers | Variable: graphicsBufferEndAddr The address of the table containing the end addresses of the graphics buffers |
Graphics buffers | The address of the table containing the addresses of the graphics buffers |
Maths (Geometry) | Subroutine: MultiplyVectorByMatrix Multiply a 3D vector by the rotation matrix in rotationMatrix, if the object is a rotating object |
Maths (Geometry) | Calculate the dot product of two 3D vectors |
Maths (Geometry) | Subroutine: TransposeRotationMatrix An unused routine that transposes the rotation matrix |
Maths (Geometry) | Subroutine: AddVectorsWithFeedback An unused routine that adds a delta vector to a coordinate and updates the delta with feedback from the coordinate value |
Maths (Geometry) | Subroutine: CalculateRotationMatrix Calculate the rotation matrix |
Maths (Geometry) | Subroutine: GetMouseInPolarCoordinates (Part 1 of 2) Convert the mouse x- and y-coordinates into polar coordinates, starting by calculating the polar angle |
Maths (Geometry) | Subroutine: GetMouseInPolarCoordinates (Part 2 of 2) Calculate the polar distance |
Lander C
--------
Category | Details |
---|---|
Maths (Geometry) | Subroutine: ProjectParticleOntoScreen Project a 3D particle coordinate onto the screen |
Maths (Geometry) | Subroutine: ProjectVertexOntoScreen Project a vertex coordinate from a 3D object onto the screen |
Maths (Geometry) | An unused routine that adds two vectors and uses self-modifying code to store the results in a specified location |
Maths (Geometry) | Subroutine: AddVectorToVertices Add a vector to the rotated vertex coordinates to get the vertex coordinates in 3D space |
Maths (Geometry) | Subroutine: MultiplyVectorByConstant An unused routine that multiplies a vector by a constant value |
Maths (Arithmetic) | The first random seed for the random number generator |
Maths (Arithmetic) | The second random seed for the random number generator |
Maths (Arithmetic) | Generate pseudo-random numbers from the random number seeds |
Drawing the screen | The screen address for the start of the 17th pixel line in the current bank (i.e. the line just below the two rows of text) |
Drawing the screen | An unused table of grey four-pixel colour words |
Drawing the screen | The unused address of the unused table of grey four-pixel colour words |
Particles | Subroutine: Draw1x1ParticleFromBuffer Process the "draw 1x1-pixel specified" command from the graphics buffer |
Particles | Subroutine: Draw2x1ParticleFromBuffer Process the "draw 2x1-pixel particle" command from the graphics buffer |
Particles | Subroutine: Draw2x2ParticleFromBuffer Process the "draw 2x2-pixel particle" command from the graphics buffer |
Particles | Subroutine: Draw3x2ParticleFromBuffer Process the "draw 3x2-pixel particle" command from the graphics buffer |
Particles | Subroutine: Draw3x1ParticleFromBuffer Process the "draw 3x1-pixel particle" command from the graphics buffer |
Drawing triangles | Subroutine: DrawTriangleFromBuffer Process the "draw triangle" command from the graphics buffer |
Particles | Subroutine: DrawParticleToBuffer Draw a large coloured particle into a slightly nearer graphics, buffer according to its distance |
Particles | Subroutine: DrawParticleShadowToBuffer Draw a small black particle into the correct graphics buffer, according to its distance |
Drawing triangles | Subroutine: DrawTriangleShadowToBuffer Draw a triangle shadow into the correct graphics buffer, according to its distance |
Drawing triangles | Subroutine: DrawTriangleToBuffer Draw a coloured triangle into a slightly nearer graphics buffer, according to its distance |
Graphics buffers | The jump table for drawing commands that we store in the graphics buffers |
Graphics buffers | Subroutine: DrawGraphicsBuffer Draw the contents of the specified graphics buffer |
Graphics buffers | Subroutine: AddTerminatorsToBuffers Add terminators to the ends of the graphics buffers so we know when to stop drawing |
Drawing the screen | The screen address for the start of the 17th pixel line in screen bank 0 (i.e. the line just below the two rows of text) |
Drawing the screen | The screen address for the start of the 17th pixel line in screen bank 1 (i.e. the line just below the two rows of text) |
Drawing the screen | The number of the current screen bank (0 or 1) |
Maths (Arithmetic) | The address of the division lookup table |
Drawing the screen | Switch screen banks and clear the newly hidden screen bank to black |
Drawing triangles | Draw a quadrilateral (i.e. two triangles) |
Drawing triangles | Subroutine: DrawTriangle (Part 1 of 11) Draw a triangle, starting by ordering the coordinates and jumping to the relevant part of the routine |
Drawing triangles | Subroutine: DrawTriangle (Part 2 of 11) Calculate the slope of (x1, y1) to (x2, y2) |
Drawing triangles | Subroutine: DrawTriangle (Part 3 of 11) Calculate the slope of (x1, y1) to (x3, y3) |
Drawing triangles | Subroutine: DrawTriangle (Part 4 of 11) Draw a triangle that isn't clipped and has a sloping first side |
Drawing triangles | Subroutine: DrawTriangle (Part 5 of 11) Draw a triangle with a horizontal edge between (x1, y1) and (x2, y2) |
Drawing triangles | Subroutine: DrawTriangle (Part 6 of 11) Draw a clipped triangle that's partly off-screen |
Drawing triangles | Subroutine: DrawTriangle (Part 7 of 11) Calculate the slopes of (x1, y1) to (x2, y2) and (x1, y1) to (x3, y3) for a clipped triangle |
Drawing triangles | Subroutine: DrawTriangle (Part 8 of 11) Draw the bottom part of a clipped triangle |
Drawing triangles | Subroutine: DrawTriangle (Part 9 of 11) Draw the top part of a clipped triangle |
Drawing triangles | Subroutine: DrawTriangle (Part 10 of 11) Draw a clipped triangle with a horizontal edge between (x1, y1) and (x2, y2) |
Drawing triangles | Subroutine: DrawTriangle (Part 11 of 11) Draw a triangle, clipping it to the screen as we go |
Lander D
--------
Category | Details |
---|---|
Drawing lines | Jump table for drawing a horizontal line of between 0 and 17 pixels using the relevant entry point in DrawLineSegment |
Drawing lines | Subroutine: DrawHorizontalLine Draw a horizontal line |
Drawing lines | Draw a horizontal line of between 0 and 17 pixels by jumping to the relevant entry point |
Start and end | The address of the game's variable workspace |
Start and end | The address of the game's stack |
Start and end | The memory location to check to ensure we have enough memory for the game |
Score bar | The score at the start of each game |
Score bar | The high score when we first load the game |
Score bar | The fuel level at the start of each new game |
Start and end | Stores the stack pointer from when the game was run |
Player | The parameters for OS_Word 21,3 for resetting the mouse position |
Player | The address of the OS_Word block for resetting the mouse position |
Player | Subroutine: ResetMousePosition Reset the mouse position to (511, 511), ready for the game |
Start and end | Subroutine: AbortWithMemoryError Show a memory error and abort the game |
Start and end | The main entry point for the game |
Main loop | Start a brand new game with a full set of lives and a newly generated set of objects |
3D objects | Randomly place a number of objects on the map, avoiding the sea and the launchpad |
Player | Subroutine: PlacePlayerOnLaunchpad The main entry point for the game |
Main loop | The main game loop |
Main loop | Finish the game |
Start and end | Return to the desktop |
Score bar | An unused routine that prints an 8-digit hexadecimal number on the second character row of the screen |
Score bar | An unused routine that prints a single digit hexadecimal number in the score bar |
3D objects | Object blueprint for a rock |
3D objects | Object blueprint for a pyramid |
3D objects | Object blueprint for the player's ship |
3D objects | Variable: objectSmallLeafyTree Object blueprint for the small leafy tree |
3D objects | Object blueprint for the tall leafy tree |
3D objects | Variable: objectSmokingRemainsLeft Object blueprint for the smoking remains that bend to the left |
3D objects | Variable: objectSmokingRemainsRight Object blueprint for the smoking remains that bend to the right |
3D objects | Object blueprint for the fir tree |
3D objects | Object blueprint for the gazebo |
3D objects | Object blueprint for the building |
3D objects | Variable: objectSmokingBuilding Object blueprint for the smoking remains of a building |
3D objects | Object blueprint for the smoking remains of a gazebo |
3D objects | Object blueprint for the rocket |
Maths (Geometry) | Sine/cosine lookup table |
Maths (Geometry) | Arctan lookup table |
Maths (Arithmetic) | Square root lookup table |
Maths (Arithmetic) | Division lookup tables |
!RunImage
---------
Category | Details |
---|---|
Copy protection | Subroutine: RunImageEntry (!RunImage) Entry point for the !RunImage Absolute file |
Copy protection | Variable: gameCode (!RunImage) The unencrypted game code |
Copy protection | Subroutine: DecryptGameBinary (!RunImage) Placeholder routine to decrypt game code to &8000 so it can be run |
Copy protection | Variable: absoluteAddr (!RunImage) The address of the start of the Absolute file |
Copy protection | Variable: gameCodeAddr (!RunImage) The address of the game code |
Copy protection | Variable: gameCodeEndAddr (!RunImage) The address of the end of the game code |