Skip to navigation

Lander on the Acorn Archimedes

Map of the source code

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:

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

Lander A
--------

CategoryDetails

Landscape

Variable: landscapeOffset

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

Variable: landscapeOffsetAddr

The address of the landscape offset

Landscape

Variable: landscapeConfig

The configuration data for each tile row in the landscape

Landscape

Variable: landscapeConfigAddr

The address of the landscapeConfig table

Graphics buffers

Variable: graphicsBuffers

The addresses of each of the graphics buffers (these values do not change)

Graphics buffers

Variable: graphicsBuffersEnd

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

Subroutine: LandOnLaunchpad

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

Subroutine: LoseLife

Display a crash animation when we lose a life and end the game if this is our last life

Main loop

Subroutine: GameOver

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

Subroutine: BounceParticle

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
--------

CategoryDetails

Particles

Subroutine: StoreParticleData

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

Subroutine: SpawnRock

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

Variable: objectTypes

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

Variable: objectPlayerAddr

The address of the object blueprint for the player's ship

3D objects

Variable: objectRockAddr

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

Subroutine: PrintCurrentScore

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

Variable: fuelBarColour

A four-pixel colour word for the colour of the fuel bar

Maths (Geometry)

Variable: sinTableAddr

The address of the sine/cosine lookup table

Maths (Geometry)

Variable: arctanTableAddr

The address of the arctan lookup table

Maths (Arithmetic)

Variable: squareRootTableAddr

The address of the square root lookup table

Score bar

Subroutine: DrawFuelLevel

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

Variable: graphicsBufferAddr

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)

Subroutine: GetDotProduct

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
--------

CategoryDetails

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)

Subroutine: AddVectors

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)

Variable: randomSeed1

The first random seed for the random number generator

Maths (Arithmetic)

Variable: randomSeed2

The second random seed for the random number generator

Maths (Arithmetic)

Subroutine: GetRandomNumbers

Generate pseudo-random numbers from the random number seeds

Drawing the screen

Variable: screenAddr

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

Variable: greyColourWords

An unused table of grey four-pixel colour words

Drawing the screen

Variable: greyColourWordsAddr

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

Variable: bufferJump

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

Variable: screenBank2Addr

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

Variable: screenBank1Addr

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

Variable: screenBankNumber

The number of the current screen bank (0 or 1)

Maths (Arithmetic)

Variable: divisionTableAddr

The address of the division lookup table

Drawing the screen

Subroutine: SwitchScreenBank

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

Drawing triangles

Subroutine: DrawQuadrilateral

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
--------

CategoryDetails

Drawing lines

Variable: lineJump

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

Subroutine: DrawLineSegment

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

Start and end

Variable: workspaceAddr

The address of the game's variable workspace

Start and end

Variable: stackAddr

The address of the game's stack

Start and end

Variable: memoryTestAddr

The memory location to check to ensure we have enough memory for the game

Score bar

Variable: initialScore

The score at the start of each game

Score bar

Variable: initialHighScore

The high score when we first load the game

Score bar

Variable: initialFuelLevel

The fuel level at the start of each new game

Start and end

Variable: stackPointerOnEntry

Stores the stack pointer from when the game was run

Player

Variable: mouseParameters

The parameters for OS_Word 21,3 for resetting the mouse position

Player

Variable: mouseParametersAddr

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

Subroutine: Entry

The main entry point for the game

Main loop

Subroutine: StartNewGame

Start a brand new game with a full set of lives and a newly generated set of objects

3D objects

Subroutine: PlaceObjectsOnMap

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

Subroutine: MainLoop

The main game loop

Main loop

Subroutine: EndGame

Finish the game

Start and end

Subroutine: ReturnToDesktop

Return to the desktop

Score bar

Subroutine: PrintHexNumber

An unused routine that prints an 8-digit hexadecimal number on the second character row of the screen

Score bar

Subroutine: PrintHexDigit

An unused routine that prints a single digit hexadecimal number in the score bar

3D objects

Variable: objectRock

Object blueprint for a rock

3D objects

Variable: objectPyramid

Object blueprint for a pyramid

3D objects

Variable: objectPlayer

Object blueprint for the player's ship

3D objects

Variable: objectSmallLeafyTree

Object blueprint for the small leafy tree

3D objects

Variable: objectTallLeafyTree

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

Variable: objectFirTree

Object blueprint for the fir tree

3D objects

Variable: objectGazebo

Object blueprint for the gazebo

3D objects

Variable: objectBuilding

Object blueprint for the building

3D objects

Variable: objectSmokingBuilding

Object blueprint for the smoking remains of a building

3D objects

Variable: objectSmokingGazebo

Object blueprint for the smoking remains of a gazebo

3D objects

Variable: objectRocket

Object blueprint for the rocket

Maths (Geometry)

Variable: sinTable

Sine/cosine lookup table

Maths (Geometry)

Variable: arctanTable

Arctan lookup table

Maths (Arithmetic)

Variable: squareRootTable

Square root lookup table

Maths (Arithmetic)

Variable: divisionTable

Division lookup tables

!RunImage
---------

CategoryDetails

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