Skip to navigation

BBC Micro Elite

Save and load: CATS (Disc version)

Name: CATS [View in context] 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 JSR GTDRV \ Get an ASCII disc drive 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) LDA #4 \ Print extended token 4, which clears the screen and JSR DETOK \ prints the boxed-out title "DRIVE {drive number} \ CATALOGUE" LDA #1 \ Set the CATF flag to 1, so that the TT26 routine will STA CATF \ print out the disc catalogue correctly STA XC \ Move the text cursor to column 1 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) JSR OSCLI \ Call OSCLI to execute the OS command at (Y X), which \ catalogues the disc DEC CATF \ Decrement the CATF flag back to 0, so the TT26 routine \ reverts to standard formatting CLC \ Clear the C flag RTS \ Return from the subroutine