Commodore 1541 Floppy drive commands

Getting back in to playing with my old Commodore 64 and 1541 floppy drive. I had to relearn how to use the floppy drive. Just a simple task such as formatting a floppy disk took me a little while to find the commands. So to make it easier for myself I thought I would list a bunch of the commands that I would be using now in the future.

Format a disk (NEW)
OPEN 1,8,15,"N0:Diskname,ID": CLOSE 1
OPEN 1,8,15: PRINT#1,"N0:Diskname,ID": CLOSE 1
The disk name has a maximum of 16 chars and the ID requires 2 chars.

Initialize drive (INITIALIZE)
e.g. to detect a disk change
OPEN 1,8,15,"I0":CLOSE 1

Validate a disk (VALIDATE)
Checks and fixes the disk’s meta-data structures (directory, block availability map, etc.)
OPEN 1,8,15,"V0": CLOSE 1

Copy files (COPY)
OPEN 1,8,15,"C0:NewFile=OldFile": CLOSE 1

Copy disk (COPY)
OPEN 1,8,15,"C0=C1": CLOSE 1
Copy the whole disk on a double drive from drive 1 to drive 0.

Concatenate files (COMBINE)
OPEN 1,8,15,"C0:NewFile=OldFile1,OldFile2,...": CLOSE 1
The command string is limited to 40 chars in length!

Rename a file (RENAME)
OPEN 1,8,15,"R0:New_Name=Old_Name":CLOSE 1
The command string is limited to 40 chars in length!

Delete a file (SCRATCH)
OPEN 1,8,15,"S0:filename": CLOSE 1
Wildcards such as * (matches all the remaining chars) or ? (matches one char) are supported.For example: OPEN 1,8,15,"S0:*":CLOSE 1 all files of a disk will be deleted (“scratched”).With comma (,) more than one file or wildcard mask can be given and multiple matching files actually could be subject of the deletion.

Overwrite a file (REPLACE)
OPEN 1,8,15,"@0:filename,S,W": CLOSE 1.
The REPLACE command is especially prone to triggering the above mentioned bug on the original 1541 (fixed in the 1541C and the 1541-II) – it may fail with some regularity and one could lose all data on a disk. Unless the user knows for certain that the drive in question will not be an original 1541, the better way is to first to use SCRATCH and after that the BASIC command SAVE.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s