.LOAD LDY #0 \ We start by changing the load command at LDLI to \ contain the filename that was just entered by the \ user, so we set an index in Y so we can copy the \ filename from INWK+5 into the LDLI command .LOADL1 LDA INWK+5,Y \ Fetch the Y-th character of the filename CMP #13 \ If the character is a carriage return then we have BEQ LOADL2 \ reached the end of the filename, so jump to LOADL2 as \ we have now copied the whole filename IF _SNG47 STA LDLI+10,Y \ Store the Y-th character of the filename in the Y-th \ character of LDLI+10, where LDLI+10 points to the \ JAMESON part of the load command in LDLI: \ \ "LOAD :1.E.JAMESON E7E" ELIF _COMPACT STA LDLI+5,Y \ Store the Y-th character of the filename in the Y-th \ character of LDLI+5, where LDLI+5 points to the \ JAMESON part of the load command in LDLI: \ \ "LOAD JAMESON E7E" ENDIF INY \ Increment the loop counter CPY #7 \ If Y < 7 then there may be more characters in the BCC LOADL1 \ name, so loop back to LOADL1 to fetch the next one .LOADL2 LDA #' ' \ We have copied the name into the LDLI command string, \ but the new name might be shorter then the previous \ one, so we now need to blank out the rest of the name \ with spaces, so we load the space character into A IF _SNG47 STA LDLI+10,Y \ Store the Y-th character of the filename in the Y-th \ character of LDLI+10, which will be directly after \ the last letter we copied above ELIF _COMPACT STA LDLI+5,Y \ Store the Y-th character of the filename in the Y-th \ character of LDLI+5, which will be directly after \ the last letter we copied above ENDIF INY \ Increment the loop counter CPY #7 \ If Y < 7 then we haven't yet blanked out the whole BCC LOADL2 \ name, so loop back to LOADL2 to blank the next one \ until the load string is ready for use IF _SNG47 JSR SWAPZP \ Call SWAPZP to store the top part of zero page, as it \ gets corrupted by the MOS during the loading process ELIF _COMPACT JSR NMIRELEASE \ Release the NMI workspace (&00A0 to &00A7) ENDIF LDX #LO(LDLI) \ Set (Y X) to point to the OS command at LDLI, which LDY #HI(LDLI) \ contains the DFS command for loading the commander \ file JSR OSCLI \ Call OSCLI to execute the OS command at (Y X), which \ loads the commander file JSR SWAPZP \ Call SWAPZP to restore the top part of zero page LDY #NT% \ We now want to copy the newly loaded commander data \ block to location &0791, so we set a counter in Y to \ copy the NT% bytes in the commander data block .LOADL3 LDA &0E7E,Y \ Copy the Y-th byte of &0E7E to the Y-th byte of &0791 STA &0791,Y DEY \ Decrement the loop counter BPL LOADL3 \ Loop back until we have copied all the bytes in the \ newly loaded commander data block RTS \ Return from the subroutine RTS \ This instruction has no effect as we already returned \ from the subroutineName: LOAD [Show more] Type: Subroutine Category: Save and load Summary: Load the commander fileContext: See this subroutine in context in the source code References: This subroutine is called as follows: * LOD calls LOAD
Arguments: INWK+5 The filename, terminated by a carriage return
[X]
Variable LDLI (category: Save and load)
The OS command string for loading a commander file
[X]
Label LOADL1 is local to this routine
[X]
Label LOADL2 is local to this routine
[X]
Label LOADL3 is local to this routine
[X]
Subroutine NMIRELEASE (category: Utility routines)
Release the NMI workspace (&00A0 to &00A7)
[X]
Configuration variable: NT% = SVC + 3 - TP
This sets the variable NT% to the size of the current commander data block, which starts at TP and ends at SVC+3 (inclusive), i.e. with the last checksum byte
[X]
Configuration variable: OSCLI = &FFF7
The address for the OSCLI routine
[X]
Subroutine SWAPZP (category: Utility routines)
Swap zero page (&0090 to &00EF) with the buffer at &3000