Drive commands are commands sent to a Commodore floppy drive. Using commands, disks can be formatted, files deleted, drive number changed (until powerdown typically), programs can get uploaded and executed in the drive (typically done by fastloaders), and many other things. In case an error occurs when executing the command, the red drive LED starts to flash, and a more verbose error message can be fetched from the drive.
List of standard drive commands
- NEW/N - Format a floppy disk
- Syntax: "N:label,id"
- label may be up to 16 characters long. id must be two characters. If id is omitted, the directory of the disk will be erased (disk must be formatted already).
- RENAME/R - Rename a file
- Syntax: "R:newname=oldname"
- SCRATCH/S - Delete files
- Syntax: "S:file"
- Wildcards "*" and "?" are supported.
Sending drive commands
Drive commands can be sent in a number of ways. Most disk copy programs or other disk utility programs include an extra menu point for sending drive commands, too.
C64 BASIC V2.0 / C128 BASIC V7.0
OPEN 1,8,15,"command":CLOSE 1 :REM send command to drive 8
OPEN 1,8,15,"N:NEWDISK,01":CLOSE 1 :REM format disk in drive 8 with label NEWDISK and disk id 01
Reading the error message from the drive is even a bit more complicated as one has to read the error message using INPUT# which BASIC does not allow in direct mode, so an own small BASIC program has to be written:
10 OPEN 1, 8, 15 :REM Open Error/Command Channel 20 INPUT#1, EN$, ER$, TR$, SC$ :REM Read Message 30 CLOSE 1 :REM Close Channel 40 PRINT "ErrNr: "; EN$ :REM Display Results 50 PRINT "Error: "; ER$ 60 PRINT "Track: "; TR$ 70 PRINT "Sector:"; SC$ RUN
Final Cartridge 3
Using the Final Cartridge 3, commands can be sent using the new
DOS"command BASIC command. Error messages get displayed by
DOS without parameters.
The FC3 implements some non-standard floppy commands that are handled directly by the DOS command.
DOS"N:NEWDISK,01 :REM format disk in drive 8 with label NEWDISK and disk id 01 DOS"F:NEWDISK,01 :REM FC3 specific - fast format a disk DOS"D:NEWNAME,01 :REM FC3 specific - rename disk
Using JiffyDOS, commands can be sent using
@"command for S-JiffyDOS). Error messages get displayed by
@ without parameters.
@N:NEWDISK,01 :REM JiffyDOS: format disk in drive 8 with label NEWDISK and disk id 01 @"N:NEWDISK,01 :REM S-JiffyDOS: format disk in drive 8 with label NEWDISK and disk id 01
Similar to Jiffy, the Action Replay cartridge provides an
@command command for sending drive commands.
Similar to the FC3, the Action Replay implements some additional commands (N: fast format and C: TODO: unknown). If you want to prevent these command strings to be parsed by the AR instead of the drive, use
@"command to send the command.
@N:NEWDISK,01 :REM fast format disk in drive 8 with label NEWDISK and disk id 01 @"N:NEWDISK,01 :REM standard format disk in drive 8 with label NEWDISK and disk id 01