Skip to navigation


Version analysis of CATS

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

Code variations between these versions are shown below.

Name: CATS Type: Subroutine Category: Save and load Summary: Ask for a disc drive number and print a catalogue of that drive
This routine asks for a disc drive number, and if it is a valid number (0-3) it displays a catalogue of the disc in that drive. It also updates the OS command at CTLI so that when that command is run, it catalogues the correct drive.
Returns: C flag Clear if a valid drive number was entered (0-3), set otherwise
.CATS

Code variation 1 of 7Related to the Master version

The Master Compact only has one disc drive, and it uses ADFS rather than DFS, so instead of asking for a drive number, it asks for a directory name.

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

JSR GTDRV \ Get an ASCII disc drive number from the keyboard in A, \ setting the C flag if an invalid drive number was \ entered BCS DELT-1 \ If the C flag is set, then an invalid drive number was \ entered, so return from the subroutine (as DELT-1 \ contains an RTS) STA CTLI+1 \ Store the drive number in the second byte of the \ command string at CTLI, so it overwrites the "0" in \ ".0" with the drive number to catalogue STA DTW7 \ Store the drive number in DTW7, so printing extended \ token 4 will show the correct drive number (as token 4 \ contains the {drive number} jump code, which calls \ MT16 to print the character in DTW7)
IF _SNG47 JSR GTDRV \ Get an ASCII disc drive number from the keyboard in A, \ setting the C flag if an invalid drive number was \ entered BCS DELT-1 \ If the C flag is set, then an invalid drive number was \ entered, so return from the subroutine (as DELT-1 \ contains an RTS) STA CTLI+4 \ Store the drive number in the fifth byte of the \ command string at CTLI, so it overwrites the "1" in \ "CAT 1" with the drive number to catalogue STA DTW7 \ Store the drive number in DTW7, so printing extended \ token 4 will show the correct drive number (as token 4 \ contains the {drive number} jump code, which calls \ MT16 to print the character in DTW7) ELIF _COMPACT JSR GTDIR \ Get a directory name from the keyboard and change to \ that directory ENDIF

Code variation 2 of 7Minor and very low-impact

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

LDA #4 \ Print extended token 4, which clears the screen and JSR DETOK \ prints the boxed-out title "DRIVE {drive number} \ CATALOGUE"
LDA #3 \ Print extended token 3, which clears the screen and JSR DETOK \ prints the boxed-out title "DRIVE {drive number} \ CATALOGUE"

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

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

LDA #1 \ Set the CATF flag to 1, so that the TT26 routine will STA CATF \ print out the disc catalogue correctly
LDA #DOCATF \ Send a #DOCATF 1 command to the I/O processor to set JSR OSWRCH \ the CATF flag to 1, so that the TT26 routine on the LDA #1 \ I/O processor prints out the disc catalogue correctly JSR OSWRCH
 STA XC                 \ Move the text cursor to column 1

Code variation 4 of 7Related to the Master version

As the Master Compact uses ADFS, this release has to claim and release the NMI workspace when accessing the disc, in order to prevent ADFS from corrupting that part of zero page. It does this by calling the NMICLAIM and NMIRELEASE routines at the appropriate time.

This variation is blank in the Disc (docked) and 6502 Second Processor versions.

IF _SNG47 JSR getzp \ Call getzp to store the top part of zero page in the \ the buffer at &3000, as it gets corrupted by the MOS \ during disc access ELIF _COMPACT JSR NMIRELEASE \ Release the NMI workspace (&00A0 to &00A7) so the MOS \ can use it, and store the top part of zero page in the \ the buffer at &3000, as it gets corrupted by the MOS \ during disc access ENDIF
 LDX #LO(CTLI)          \ Set (Y X) to point to the OS command at CTLI, which
 LDY #HI(CTLI)          \ contains a dot and the drive number, which is the
                        \ DFS command for cataloguing that drive (*. being short
                        \ for *CAT)

Code variation 5 of 7Specific to an individual platform

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

JSR OSCLI \ Call OSCLI to execute the OS command at (Y X), which \ catalogues the disc
JSR SCLI2 \ Call SCLI2 to execute the OS command at (Y X), which \ catalogues the disc, setting the SVN flag while it's \ running to indicate disc access is in progress

Code variation 6 of 7Specific to an individual platform

This variation is blank in the Disc (docked) and 6502 Second Processor versions.

JSR getzp \ Call getzp to restore the top part of zero page from \ the buffer at &3000

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

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

DEC CATF \ Decrement the CATF flag back to 0, so the TT26 routine \ reverts to standard formatting
STZ CATF \ Set the CATF flag to 0, so the TT26 routine reverts to \ standard formatting
LDA #DOCATF \ Send a #DOCATF 0 command to the I/O processor to set JSR OSWRCH \ the CATF flag to 0, so that TT26 returns to normal LDA #0 \ printing JSR OSWRCH
 CLC                    \ Clear the C flag

 RTS                    \ Return from the subroutine