1541 Floppy disk drive

The Commodore 1541 floppy disk drive is an intelligent storage device, which uses 5 1/4 SS/DD (NOT HD) floppy disks to store data onto and retrieve. Unlike the C2N tape drive, which data is stored sequentially as the tape motor is going, the 1541 is able to store data randomly anywhere on the disk. As a result to this, searching for a particular file or data can be done rather quickly.

The 1541 contains its own CPU (a MOS 6502), RAM (2k) and kernal drive ROM (16k). It has a single drive head, and as such can only access data on one side of a disk. It is common practice to cut a write protect notch on the other side of the disk, so that the can be flipped over and make use of the 2nd disk side (commonly known as making the disk a flippy disk). Each disk side usually will have a notch on the disk for wrote protection. Placing a piece of black tape over this will prevent being able to write to that disk side. Each disk side can hold up to 170kb of data (or 664 disk blocks). Unlike the tape drive, the C64 passes disk commands over to the 1541 drive, and its DOS (stored in the 1541 ROM) will perform the needed work on seeking the disk and reading or writing as requested.

In order to use a new disk, the disk must first be formatted. This will wipe anything stored on that side of the disk, and write data for a blank formatted disk onto it. This creates 35 disk tracks, and then proceeds to write the disk directory (disk label name, disk ID, and disk BAM or Block Allocation Map) onto track 18. The BAM is a binary map of the disk tracks and sectors and is used to keep track on what sections of the disk are empty or contain data.

When the 1541 was designed, it was engineered to be backwards compatible with the VIC-20 which was produced prior to the release of the C64. However in order to keep it compatible, the standard disk speed is much slower than the C64 is actually able to handle. As a result, it was known early in its release to be rather slow. As time progressed, programmers were able to write custom disk routines that take over the stock C64 and 1541 disk routines to greatly improve transfer speeds. Some applications included these custom disk loaders as part of their boot loader (which also may include some kind of copy protection), or various cartridges to supply fast loading (such as the EPYX Fast Load, Action Replay, and Super Snapshot). Or other hard devices such as CMD’s JiffyDos, which required replacing both the C64 kernal rom chip, and the 1541 kernal rom chip. Many of these also included a DOS wedge, which allowed you to issue disk drive commands easier using shorter additional commands, instead of the ones required on a stock C64.

Commodore did later release two other floppy drives, the 1571 which is a dual-sided (two drive head) 5 1/4 disk drive. The 1571 was made to be highly backward compatible with the 1541 drive, and normally powers on in 1541 mode. However on a Commodore 128 in 128 mode, or by issuing a command, the drive can be switched into 1571 dual drive mode. This allowed disks to be formatted on both sides at the same time, and read and write to data store on either side. The back side of a 1571 formatted disk is not written the same, and thus when used in a 1541 drive, only any data stored on the first side can be accessed. Flipping the disk over will not allow the data to accessed as well. Commodore also released the 1581 drive, which is a 3 1/4 floppy disk drive (also DD disk and NOT HD disks). This drive is not 1541 compatible, and was more commonly used by power Commodore users that needed a larger storage medium. Both 1571 and 1581 drives can be used by a C64, however they also have a burst mode which is only usable on a Commodore 128 in 128 mode. When either drive is detected, disk access speed is greatly enhanced.

Commodore disk drives rely on a device number, usually 8,9,10, or 11 although it is possible to have a drive with a higher device number. The default device number is 8 and most programs are hard coded to only use device 8. On the original 1541, changing the device number involves opening the unit and cutting one of 2 solder traces. On the newer 1541-II or later drives, Commodore placed dip-switches on the back of the drive to make this much easier. Besides changing the hard-wire device number, it is also possible to change a drives device number via software commands, however this only stays until the drive is reset.

The Commodore disk drives have several file types which can be used as needed. The common examples are PRG, SEQ, REL, and USR

PRG is a general program file, which usually some form of program that can be loaded and executed. Although it is possible to store data as a PRG file.

SEQ is a sequential file. This is more commonly used as a way to store data such as a text file, or other data or records.

REL is a relative file, and more common as a form of data base for record keeping.

USR is less common, but still may hold data or simply used to structure the disk directory.

Standard disk commands:

LOAD “$”,8:LIST (loading $ will tell the drive to load the disk directory and place it into the C64’s BASIC memory. It is important to note that you cannot do ,8,1 here or you will only get garbled data displayed. After the directory has been loaded, issuing the LIST command will list the directory to screen. It is important to note that any program stored in BASIC ram will be replaced. If attempting to read from a different device, replace the 8 with the number desired)

LOAD “filename”,8 (loads the requested program into BASIC ram. Usually this is fine with many program files. However, some will not load correctly, as they are required to load into a different memory location than BASIC ram. Normally after loading has completed, you would issue the RUN command to execute the loaded program).

LOAD “filename”,8,1 (this instructs the C64 to load the specified program file, but place the file into the memory address which is contained at the beginning of the file. This is more important with a program file that contains ML or machine language programming, especially as some programs are designed to auto-run themselves when the program file is loaded. After loading completes, usually you will want to issue the RUN command).

SAVE “filename”,8 (this will save the BASIC program in memory to disk. It is important to note that there is any ML program also in memory, normally this will not save that data, unless a C64 register has been modified first. However this is a more advanced procedure and will not be documented here)

VERIFY “filename”,8 (this will load and verify the program in BASIC ram is the same as the file specified. Helpful if you wish to confirm that a recently saved program did so correctly.

OPEN 15,8,15,”N0:label,ID”:CLOSE 15 (this will NEW or format the disk currently in the drive. Please be aware that this will erase any data currently stored on the disk. So it’s important to confirm you are not about to format a disk which contains anything important on it. You can replace “label” with a disk name of your choice, as well as replace ID with an 2 characters that you wish for the disk ID).

There are other lesser used commands that you may wish to perform, such as reading the drive error channel to see if a drive error occurred. Or changing of the device number. It is recommended to consult the 1541 users guide (or 1571/1581) for more details on these. There are also programs written to perform these functions. For more details on the 1541 disk drive layout, it is highly recommended to read the book “Inside Commodore DOS”.