.LOD JSR COPYNAME ; Copy the last saved commander's name from INWK+5 to ; comnam and pad out the rest of comnam with spaces, so ; we can use it as the filename to read in rfile JSR rfile ; Load the commander file into the buffer at comfil BCS diskerror ; If the C flag is set then there was a disk error, so ; jump to diskerror to print the disk error (whose ; number is now in A), make a beep and wait for a key ; press JSR UNMUTILATE ; Decrypt the newly loaded file in the buffer at comfil LDA TAP% ; If the first byte of the loaded file has bit 7 set, BMI ELT2F ; jump to ELT2F, as this is an invalid commander file ; ; ELT2F contains a BRK instruction, which will force an ; interrupt to call the address in BRKV, which will ; print out the system error at ELT2F LDY #NT% ; We have successfully loaded the commander file to the ; TAP% staging area, so now we want to copy it to the ; last saved commander data block at NA%+8, so we set up ; a counter in Y to copy NT% bytes .copyme LDA TAP%,Y ; Copy the Y-th byte of TAP% to the Y-th byte of NA%+8 STA NA%+8,Y DEY ; Decrement the loop counter BPL copyme ; Loop back until we have copied all NT% bytes .LOR SEC ; Set the C flag RTS ; Return from the subroutine .ELT2F LDA #9 ; Print extended token 9 ("{cr}{all caps}ILLEGAL ELITE JSR DETOK ; II FILE{sentence case}") JSR t ; Scan the keyboard until a key is pressed, returning ; the ASCII code in A and X JMP SVE ; Jump to SVE to display the disk access menu and return ; from the subroutine using a tail callName: LOD [Show more] Type: Subroutine Category: Save and load Summary: Load a commander fileContext: See this subroutine in context in the source code References: This subroutine is called as follows: * SVE calls LOD
The filename should be stored at INWK, terminated with a carriage return (13).
Other entry points: LOR Set the C flag and return from the subroutine
[X]
Subroutine COPYNAME (category: Save and load)
Copy the last saved commander's name from INWK+5 to comnam and pad out the rest of comnam with spaces, so we can use it as a filename
[X]
Subroutine DETOK (category: Text)
Print an extended recursive token from the TKN1 token table
[X]
Label ELT2F is local to this routine
[X]
Variable NA% (category: Save and load)
The data block for the last saved commander
[X]
Subroutine SVE (category: Save and load)
Display the disk access menu and process saving of commander files
[X]
Configuration variable TAP% = LS% - 111
The staging area where we copy files after loading and before saving
[X]
Subroutine UNMUTILATE (category: Save and load)
Decrypt the commander file in the buffer at comfil
[X]
Label copyme is local to this routine
[X]
Subroutine diskerror (category: Save and load)
Print a disk error, make a beep and wait for a key press
[X]
Subroutine rfile (category: Save and load)
Read a commander file from a DOS disk into the buffer