CODE = &00008000 \ The build address for the Absolute file \ \ [Show more]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, RISC OS 2 and RISC OS 3.00 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\ \ 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 aboveINCLUDE "3-assembled-output/exports.arm"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 passLANDER !RunImage CODE Produces the binary file !RunImage.unprot.bin.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 gameName: RunImageEntry [Show more] Type: Subroutine Category: Copy protection Summary: Entry point for the !RunImage Absolute fileContext: See this subroutine on its own page References: No direct references to this subroutine in this source file.gameCode INCBIN "3-assembled-output/GameCode.bin" .gameCodeEndName: gameCode [Show more] Type: Variable Category: Copy protection Summary: The unencrypted game codeContext: See this variable on its own page References: This variable is used as follows: * gameCodeAddr uses gameCode.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 \ routineName: DecryptGameBinary [Show more] Type: Subroutine Category: Copy protection Summary: Placeholder routine to decrypt game code to &8000 so it can be runContext: See this subroutine on its own page References: This subroutine is called as follows: * RunImageEntry calls DecryptGameBinary.absoluteAddr EQUD CODEName: absoluteAddr [Show more] Type: Variable Category: Copy protection Summary: The address of the start of the Absolute fileContext: See this variable on its own page References: This variable is used as follows: * DecryptGameBinary uses absoluteAddr.gameCodeAddr EQUD gameCodeName: gameCodeAddr [Show more] Type: Variable Category: Copy protection Summary: The address of the game codeContext: See this variable on its own page References: This variable is used as follows: * DecryptGameBinary uses gameCodeAddr.gameCodeEndAddr EQUD gameCodeEndName: gameCodeEndAddr [Show more] Type: Variable Category: Copy protection Summary: The address of the end of the game codeContext: See this variable on its own page References: This variable is used as follows: * DecryptGameBinary uses gameCodeEndAddr] NEXT pass% \ Loop back for the second passTwo-pass assembly loopOSCLI "SAVE !RunImage "+STR$~CODE%+" "+STR$~O%+" "+STR$~CODE+" "+STR$~CODESave !RunImage.unprot.bin
[X]
Configuration variable CODE
The build address for the Absolute file
[X]
Subroutine DecryptGameBinary (category: Copy protection)
Placeholder routine to decrypt game code to &8000 so it can be run
[X]
[X]
Variable absoluteAddr (category: Copy protection)
The address of the start of the Absolute file
[X]
Label decr1 in subroutine DecryptGameBinary
[X]
Variable gameCode (category: Copy protection)
The unencrypted game code
[X]
Variable gameCodeAddr (category: Copy protection)
The address of the game code
[X]
Label gameCodeEnd in variable gameCode
[X]
Variable gameCodeEndAddr (category: Copy protection)
The address of the end of the game code