.load4 ; When the Elite loader has finished, it jumps back here ; via the instruction we inserted into address $CE0E CLC ; Call CopyZeroPage with the C flag clear to copy the JSR CopyZeroPage ; contents of zero page to $CE00, so we can restore it ; once we have finished loading the game binaries LDA L1 ; Set bits 0 to 2 of the 6510 port register at location AND #%11111000 ; L1 to %110 to set the input/output port to the ORA #%00101110 ; following: STA L1 ; ; * LORAM = 0 ; * HIRAM = 1 ; * CHAREN = 1 ; ; This sets the entire 64K memory map to RAM except for ; the I/O memory map at $D000-$DFFF, which gets mapped ; to registers in the VIC-II video controller chip, the ; SID sound chip, the two CIA I/O chips, and so on, and ; $E000-$FFFF, which gets mapped to the Kernal ROM ; ; See the memory map at the bottom of page 264 in the ; Programmer's Reference Guide ; ; This also sets bits 3 and 5 to configure the Datasette ; as follows: ; ; * Bit 3 = Datasette output signal level 1 ; ; * Bit 5 = Datasette motor control off IF _GMA86_PAL LDA #5 ; Call LoadGMAFile to load the GMA5 file, which contains JSR LoadGMAFile ; the first block of game code (ELITE A to C) LDA #6 ; Call LoadGMAFile to load the GMA6 file, which contains JSR LoadGMAFile ; the second block of game code (ELITE D onwards) ELIF _GMA85_NTSC LDA #'5' ; Call LoadGMAFile to load the GMA5 file, which contains JSR LoadGMAFile ; the first block of game code (ELITE A to C) LDA #'6' ; Call LoadGMAFile to load the GMA6 file, which contains JSR LoadGMAFile ; the second block of game code (ELITE D onwards) ENDIF LDA L1 ; Set bits 0 to 2 of the 6510 port register at location AND #%11111000 ; L1 to %110 to set the input/output port to the ORA #%00000110 ; following: STA L1 ; ; * LORAM = 0 ; * HIRAM = 1 ; * CHAREN = 1 ; ; This sets the entire 64K memory map to RAM except for ; the I/O memory map at $D000-$DFFF, which gets mapped ; to registers in the VIC-II video controller chip, the ; SID sound chip, the two CIA I/O chips, and so on, and ; $E000-$FFFF, which gets mapped to the Kernal ROM ; ; See the memory map at the bottom of page 264 in the ; Programmer's Reference Guide SEC ; Call CopyZeroPage with the C flag set to restore the JSR CopyZeroPage ; contents of zero page from $CE00, which we backed up ; above JSR KERNALRESTOR ; Call the Kernal's RESTOR function to restore the ; vector table at $0314 to $0333 with the default ; values, so the fast loader code is no longer called ; when we use the Kernal's file functions JSR KERNALCLALL ; Call the Kernal's CLALL function to clear the file ; table and close any open files JMP S% ; Jump to S% in the GMA5 game binary we just loaded, to ; finally start the gameName: Elite GMA loader (Part 4 of 4) [Show more] Type: Subroutine Category: Loader Summary: Load the GMA5 and GMA6 binaries and start the gameContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Subroutine CopyZeroPage (category: Loader)
Copy a page of data in a specified direction between zero page and the page at $CE00, omitting the first two bytes
[X]
Configuration variable KERNALCLALL = $FFE7
The Kernal function to clear the file table
[X]
Configuration variable KERNALRESTOR = $FF8A
The Kernal function to restore the vector table at $0314 to $0333 with the default values
[X]
Configuration variable L1 = $0001
The 6510 input/output port register, which we can use to configure the Commodore 64 memory layout (see page 260 of the Programmer's Reference Guide)
[X]
Subroutine LoadGMAFile (category: Loader)
Load a specific GMA file
[X]
Configuration variable S% = $1D22
The entry point in the LOCODE file (GMA5)