Skip to navigation


Version analysis of QUS1

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: QUS1 Type: Subroutine Category: Save and load Summary: Save or load the commander file Deep dive: Commander save files
The filename should be stored at INWK, terminated with a carriage return (13).

Code variation 1 of 8A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

The routine should be called with Y set to &C.
The routine asks for a drive number and updates the filename accordingly before performing the load or save.

Arguments: A File operation to be performed. Can be one of the following: * 0 (save file) * &FF (load file)

Code variation 2 of 8A variation in the comments only

Tap on a block to expand it, and tap it again to revert.

Y Points to the page number containing the OSFILE block, which must be &C because that's where the pointer to the filename in INWK is stored below (by the STX &0C00 instruction)
Returns: C flag Set if an invalid drive number was entered
.QUS1

Code variation 3 of 8Related to an enhanced feature

The enhanced versions support the entering of disc drive numbers when loading or saving.

This variation is blank in the Cassette and Electron versions.

PHA \ Store A on the stack so we can restore it after the \ call to GTDRV JSR GTDRV \ Get an ASCII disc drive number from the keyboard in A, \ setting the C flag if an invalid drive number was \ entered STA INWK+1 \ Store the ASCII drive number in INWK+1, which is the \ drive character of the filename string ":0.E." PLA \ Restore A from the stack BCS QUR \ If the C flag is set, then an invalid drive number was \ entered, so jump to QUR to return from the subroutine

Code variation 4 of 8Related to Elite's use of the Tube

This variation is blank in the Cassette, Disc (docked) and Electron versions.

PHA \ Store A on the stack so we can restore it after the \ call to DODOSVN LDA #255 \ Set the SVN flag to 255 to indicate that disc access JSR DODOSVN \ is in progress PLA \ Restore A from the stack

Code variation 5 of 8Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

LDX #INWK \ Store a pointer to INWK at the start of the block at STX &0C00 \ &0C00, storing #INWK in the low byte because INWK is \ in zero page
LDX #INWK \ Store a pointer to INWK at the start of the block at STX &0A00 \ &0A00, storing #INWK in the low byte because INWK is \ in zero page

Code variation 6 of 8Minor and very low-impact

Tap on a block to expand it, and tap it again to revert.

LDX #0 \ Set X to 0 so (Y X) = &0C00 JMP OSFILE \ Jump to OSFILE to do the file operation specified in \ &0C00 (i.e. save or load a file depending on the value \ of A), returning from the subroutine using a tail call
LDX #0 \ Set (Y X) = &0C00 LDY #&C JSR OSFILE \ Call OSFILE to do the file operation specified in \ &0C00 (i.e. save or load a file depending on the value \ of A)
LDX #&FF \ Set KEYB = &FF to indicate that we are reading from STX KEYB \ the keyboard using an OS command INX \ Set X = 0 JSR OSFILE \ Call OSFILE to do the file operation specified in \ &0A00 (i.e. save or load a file depending on the value \ of A) INC KEYB \ Increment KEYB back to 0 to indicate we are done \ reading the keyboard RTS \ Return from the subroutine

Code variation 7 of 8Related to Elite's use of the Tube

This variation is blank in the Cassette, Disc (docked) and Electron versions.

JSR CLDELAY \ Pause for 1280 empty loops LDA #0 \ Set the SVN flag to 0 indicate that disc access has JSR DODOSVN \ finished

Code variation 8 of 8Specific to an individual platform

This variation is blank in the Cassette and Electron versions.

CLC \ Clear the C flag .QUR RTS \ Return from the subroutine