Skip to navigation

Lander on the Acorn Archimedes

Lander !RunImage source

LANDER !RunImage SOURCE Lander was written by David Braben and is copyright D.J.Braben 1987 The code on this site has been reconstructed from a disassembly of the game on the Arthur and RISC OS 2 application discs The commentary is copyright Mark Moxon, and any misunderstandings or mistakes in the documentation are entirely my fault The terminology and notations used in this commentary are explained at https://lander.bbcelite.com/terminology The deep dive articles referred to in this commentary can be found at https://lander.bbcelite.com/deep_dives
This source file produces the following binary file: * !RunImage.unprot.bin
CODE = &00008000 \ The build address for the Absolute file \ \ [Show more]
\ \ This variable is used by the following: \ \ * absoluteAddr \ \ This list only includes code that refers \ to the variable by name; there may be \ other references to this memory location \ that don't use this label, and these will \ not be mentioned above
INCLUDE "3-assembled-output/exports.arm"
LANDER !RunImage CODE Produces the binary file !RunImage.unprot.bin.
DIM CODE% &A000 \ Reserve a block in memory for the \ assembled code FOR pass% = 4 TO 6 STEP 2 \ Perform a two-pass assembly, using both \ P% and O%, with errors enabled on the \ second pass only O% = CODE% \ Assemble the code for deployment to \ address O% P% = CODE \ Assemble the code into the block at P% [ \ Switch from BASIC into assembly language OPT pass% \ Set the assembly option for this pass
Name: RunImageEntry [Show more] Type: Subroutine Category: Copy protection Summary: Entry point for the !RunImage Absolute file
Context: See this subroutine on its own page References: No direct references to this subroutine in this source file
B DecryptGameBinary \ RISC OS runs !RunImage as an Absolute file \ which executes from the first instruction \ rather than having an execute address, so \ this jumps to the decryption routine to \ decrypt the game binary before jumping to \ Entry to start the game
Name: gameCode [Show more] Type: Variable Category: Copy protection Summary: The unencrypted game code
Context: See this variable on its own page References: This variable is used as follows: * gameCodeAddr uses gameCode
.gameCode INCBIN "3-assembled-output/GameCode.bin" .gameCodeEnd
Name: DecryptGameBinary [Show more] Type: Subroutine Category: Copy protection Summary: Placeholder routine to decrypt game code to &8000 so it can be run
Context: See this subroutine on its own page References: This subroutine is called as follows: * RunImageEntry calls DecryptGameBinary
.DecryptGameBinary LDR R0, gameCodeAddr \ Set R0 to the address of the game code LDR R1, absoluteAddr \ Set R1 to the address of the start of the \ Absolute file LDR R2, gameCodeEndAddr \ Set R2 to the address of the end of the \ game code .decr1 LDR R12, [R0], #4 \ Copy a word from R0 to R1, updating the STR R12, [R1], #4 \ addresses as we go (this is where the \ decryption process would work, but \ currently it is just a copy) CMP R0, R2 \ Loop back until we have copied the whole BNE decr1 \ game B Entry \ Start the game by jumping to the Entry \ routine
Name: absoluteAddr [Show more] Type: Variable Category: Copy protection Summary: The address of the start of the Absolute file
Context: See this variable on its own page References: This variable is used as follows: * DecryptGameBinary uses absoluteAddr
.absoluteAddr EQUD CODE
Name: gameCodeAddr [Show more] Type: Variable Category: Copy protection Summary: The address of the game code
Context: See this variable on its own page References: This variable is used as follows: * DecryptGameBinary uses gameCodeAddr
.gameCodeAddr EQUD gameCode
Name: gameCodeEndAddr [Show more] Type: Variable Category: Copy protection Summary: The address of the end of the game code
Context: See this variable on its own page References: This variable is used as follows: * DecryptGameBinary uses gameCodeEndAddr
.gameCodeEndAddr EQUD gameCodeEnd
Two-pass assembly loop
] NEXT pass% \ Loop back for the second pass
Save !RunImage.unprot.bin
OSCLI "SAVE !RunImage "+STR$~CODE%+" "+STR$~O%+" "+STR$~CODE+" "+STR$~CODE
[X]