Skip to navigation


Loader: RunGMA

[Commodore 64 version, Disk Loader 1]

Name: RunGMA [Show more] Type: Subroutine Category: Loader Summary: Load and run the GMA1 loader file
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * basicVectors calls RunGMA * RelocateLoader calls RunGMA
.RunGMA LDA #%00000000 ; Call the Kernal's SETMSG function to set the system JSR KERNALSETMSG ; error display switch as follows: ; ; * Bit 6 clear = do not display I/O error messages ; ; * Bit 7 clear = do not display system messages ; ; This ensures that any file system errors are hidden LDA #2 ; Call the Kernal's SETLFS function to set the file LDX #8 ; parameters as follows: LDY #$FF ; JSR KERNALSETLFS ; * A = logical number 2 ; ; * X = device number 8 (disk) ; ; * Y = secondary address $FF ; ; The last setting ensures that the Kernal's LOAD ; function loads files using the addresses in their PRG ; headers LDA #3 ; Call SETNAM to set the filename parameters as follows: LDX #LO(filename) ; LDY #HI(filename) ; * A = filename length of 3 JSR KERNALSETNAM ; ; * (Y X) = address of filename ; ; So this sets the filename to "GM*" LDA #0 ; Call the Kernal's LOAD function to load the GMA* file JSR KERNALLOAD ; as follows: ; ; * A = 0 to initiate a load operation ; ; So this loads the first GM* file we find on disk at ; the address in its PRG header, which will be GMA1 at ; $0334 LDA #$FF ; Set the high byte of the execution address of STOP to STA $0329 ; $FF, from the default $F6ED to $FFED ; ; The address $FFED in the Kernal ROM simply returns ; without doing anything, so this effectively disables ; the RUN/STOP key NOP ; These NOPs pad out the rest of this routine to ensure NOP ; that the BASIC vectors in basicVectors end up in the NOP ; correct addresses for overriding BASIC, for when this NOP ; file is loaded at its PRG address of $02A7 NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP JMP $0334 ; Jump to the start of the GMA1 loader file that we just ; loaded, which loads the game