Simple Commodore BASIC 2.0 Disk Command Programs

The COBLOG

Simple Commodore BASIC 2.0 Disk Command Programs

2/9/2020 11:50:00 AM

Now for something other than Coldfusion. For the vintage computer folks, odds are that this isn't for you since you already know how to do this. For me and other enthusiasts, this may be helpful.

Recently, I acquired a Commodore 128 Personal Computer that I used to use in my earlier years. Back then and even today, Commodore BASIC wasn’t my strongest language as I only knew the simplest disk commands to run a program. Now with an SD2IEC drive and a CMD FD-2000, cartridge-based utilities including Epyx Fastload Reloaded and Cinemaware Warp Speed, although great for many utilities and additional uses, don't cooperate fully with these disk drives.

This first Commodore BASIC 2.0 program allows the user to mount a Commodore D64 Disk Image from a sub-folder to be used to load programs from. The command for this, found at https://www.thefuturewas8bit.com/index.php/sd2iec-info is useful but complex to type. I simplified into the following code:

10 INPUT"ENTER DIRECTORY";S$
20 INPUT"ENTER DISK IMAGE NAME";F$
30 A$="CD//"+S$+"/:"+F$
40 PRINT A$
50 OPEN1,9,15,A$:CLOSE1
60 END

On Line 50, the number '9' is the drive number. If the SD2IEC is your primary drive, then odds are that it's '8.' This program will allow you to enter the directory and sub-directory, followed by the name of the disk image file. Make sure to include the extension, likely '.d64.' Sub-directories may be entered by a simple forward slash. For example, if the file is in 'c64/maniac/maniac1.d64,' you enter the following when prompted:

ENTER DIRECTORY? C64/MANIAC
ENTER DISK IMAGE NAME? MANIAC1.D64

If the SD2IEC blinks consistently after running it, then there was likely a typo somewhere on the inputs. You'll likely need to reset the SD2IEC drive and try again.

The next program here is a simple file renaming program. This was built once I received my CMD FD-2000 disk drive for 3.5" floppy disks. The Epyx Fastload Reloaded Cartridge usually works with the primary drive, not so much with separate drives and the Cinemaware Warp Speed Cartridge doesn’t appear to have a file renaming function. This program is a simple file renamer based off of reference found at https://www.c64-wiki.com/wiki/Drive_command.

10 INPUT"ENTER OLD FILENAME";S$
20 INPUT"ENTER NEW FILENAME";F$
30 A$="R:" + F$ + "=" + S$
40 PRINT "RENAMING " + S$ + " TO " + F$
50 OPEN1,10,15,A$:CLOSE1
60 END

Similar to the last program example, the number '10' in Line 50 is the drive number. The CMD FD-2000 by default is set to drive 10. Again, if your drive is the primary drive, even when it’s not the FD-2000, then you may substitute '10' with '8.' Example:

50 OPEN1,8,15,A$:CLOSE1

Hope some of you find this helpful. Feel free to experiment with this if you want. Please note that the variables with the '$' suffix are string variables and unlike in Visual Basic and many other programming languages, I had to keep the variable names to single characters. I noticed in Commodore BASIC 2.0 that when I entered two variables starting with the same character, the first variable gets overwritten. For example, it interpreted STRA$ also as STRB$; so if I entered 'STRA$="TESTA"' followed by 'STRB$="TESTB",' STRA$ gets 'TESTB' so I’m guessing it thinks STRA$ and STRB$ is really S$; so it would be best to stick with single character variable names.

To keep these programs, as usual, simply use the SAVE disk command to save it your drive.

Example:

SAVE "RENAMER",8

END OF LINE.
DISCLAIMER: The recommendations posted here may not be the best solutions. Please feel free to make your own adjustments which may be better than what I posted.
© 2024 Openshaw Ltd. Productions