.DEEOR LDA #LO(G%-1) ; Set FRIN(1 0) = G%-1 as the low address of the STA FRIN ; decryption block, so we decrypt from the start of the LDA #HI(G%-1) ; DOENTRY routine STA FRIN+1 LDA #HI(R%-1) ; Set (A Y) to R% as the high address of the decryption LDY #LO(R%-1) ; block, so we decrypt to the end of the first block of ; game code at R% (so we decrypt from DOENTRY to the end ; of the ELITE C section) LDX #KEY1 ; Set X = KEY1 as the decryption seed (the value used to ; encrypt the code, which is done in elite-checksum.py) IF _REMOVE_CHECKSUMS NOP ; If we have disabled checksums, skip the call to DEEORS NOP ; and return from the subroutine to skip the second call RTS ; below ELSE JSR DEEORS ; Call DEEORS to decrypt between DOENTRY and F% ENDIF LDA #LO(C%-1) ; Set FRIN(1 0) = C%-1 and as the low address of the STA FRIN ; decryption block, so we decrypt from the start of the LDA #HI(C%-1) ; ELITE D section STA FRIN+1 LDA #HI(F%-1) ; Set (A Y) to F% as the high address of the decryption LDY #LO(F%-1) ; block, so we decrypt to the end of the second block of ; game code at F% (so we decrypt sections ELITE D to ; ELITE K) LDX #KEY2 ; Set X = KEY2 as the decryption seed (the value used to ; encrypt the code, which is done in elite-checksum.py) ; Fall through into DEEORS to decrypt between XX21 and ; $B1FFName: DEEOR [Show more] Type: Subroutine Category: Utility routines Summary: Unscramble the main codeContext: See this subroutine in context in the source code References: This subroutine is called as follows: * S% calls DEEOR
The main game code and data are encrypted. This routine decrypts the game code in two parts: between G% and R%, and between C% and F%. In the BeebAsm version, the encryption is done by elite-checksum.py, but in the original this would have been done by the BBC BASIC build scripts.
[X]
Configuration variable C% = $6A00
The address where the second block of game code will be loaded and run (ELITE D onwards)
[X]
Subroutine DEEORS (category: Utility routines)
Decrypt a multi-page block of memory
[X]
Variable F% (category: Utility routines)
Denotes the end of the main game code, from ELITE A to ELITE K
[X]
Variable G% (category: Utility routines)
Denotes the start of the main game code, from ELITE A to ELITE K
[X]
Configuration variable KEY1 = $36
The seed for encrypting LOCODE from G% to R%, where LOCODE = ELTA-C
[X]
Configuration variable KEY2 = $49
The seed for encrypting HICODE from R% to F%, where HICODE = ELTD-K
[X]
Variable R% (category: Utility routines)
Denotes the end of the first part of the main game code (CODE1), from ELITE A to ELITE C