Skip to navigation


Loader: Elite GMA loader (Part 4 of 4)

[Commodore 64 version, Disk Loader 2]

Name: Elite GMA loader (Part 4 of 4) [Show more] Type: Subroutine Category: Loader Summary: Load the GMA5 and GMA6 binaries and start the game
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
.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 game