© 2022 EasyEDA Some rights reserved
1.Easy to use and quick to get started
2.The process supports design scales of 300 devices or 1000 pads
3.Supports simple circuit simulation
4.For students, teachers, creators
1.Brand new interactions and interfaces
2.Smooth support for design sizes of over 30,000 devices or 100,000 pads
3.More rigorous design constraints, more standardized processes
4.For enterprises, more professional users
Std EditionC64 DiskBuddy64
Profile:Connect your Commodore 1541 Floppy Disk Drive to a PC
License: CC-BY-SA 3.0
DiskBuddy64 is a minimal adapter that can interface a Commodore 1541(II) floppy disk drive to your PC via USB in order to read from and write on disks. It uses its own fast loader to minimize the transfer times. The DiskBuddy64 is controlled via a command line interface or a graphical front end written in Python.
The DiskBuddy64 is a proprietary interface. It does not turn the floppy disk drive into a standard USB mass storage device. Instead, it offers the ability to send low-level IEC commands back and forth over USB. The provided Python scripts were developed to support this interface and can directly access the floppy disk drive and the contents of an inserted floppy disk. Thanks to the integrated fast loader, the adapter reads or writes floppy disks at twelve times the normal speed, dumping an entire disk in about 32 seconds. DiskBuddy64 cannot read or write copy-protected disks.
The integrated USB to serial converter can also be used as a SerialUPDI programmer for the on-board ATtiny microcontroller, so that no additional hardware is required to flash the firmware.
The schematic is shown below:
One of the (not quite so) new 8-pin tinyAVRs was chosen for this project. Any of these MCUs can be used: ATtiny202, ATtiny212, ATtiny402 or ATtiny412. Don't buy them in China, they are much cheaper e.g. at Digikey (€0.45).
The CH340N (or CH330N) is now in use everywhere with me. At around €0.45 (if you buy 10 pieces) it is very cheap, fast, small, uncomplicated, reliable and hardly requires any external components (not even a crystal). It's probably the best choice for this small project too. And it is also used as a SerialUPDI programmer for the ATtiny.
The floppy disk drive is connected to the adapter via the 6-pin DIN jack. Alternatively, a serial cable can be soldered directly to the corresponding pads.
Two PCB versions are available, one with micro USB and IEC connector, the other as a USB stick with male USB-A and directly soldered IEC cable. The corresponding Gerber files can be found in the hardware folder and can be uploaded to a PCB manufacturer of your choice.
The main reason for the low speed of the 1541 floppy disk drive is the slow serial data transfer to the computer. As with most fast loaders, a proprietary transmission protocol is used here to accelerate this. Instead of the synchronous serial protocol with handshake and lots of waiting times, an asynchronous 2-bit parallel data transmission is used. For this to work, the sender and receiver must understand this protocol. For this purpose, a corresponding program is loaded into the RAM area of the memory and executed on the floppy disk drive side. The corresponding source codes (in 6502 assembly) can be found in the software/drive/ folder. To increase the speed even further, the GCR encoding and decoding is not done by the floppy disk drive, but by the PC. Reading or writing an entire 35-track floppy disk takes 32 seconds - not a world record, but about 12 times faster than normal speed and sufficient for most purposes.
For a more detailed explanation of some functional principle, I recommend Michael Steil's website. Take the opportunity to watch his Ultimate Commodore 1541 Drive Talk, then you will know (almost) everything you need to know about the Commodore floppy disk drives.
The DiskBuddy64 adapter bridges the gap between your PC and the Commodore 1541 floppy disk drives. It communicates with the floppy disk drive via bit banging of the IEC protocol and with the PC via the integrated USB-to-serial converter. The adapter also supports the proprietary protocol for faster data transmission. It essentially provides the basic functions of the IEC protocol in such a way that they can be called up from the PC using serial commands via USB. The source codes of the firmware can be found in the software/avr/ folder.
The Python scripts provide the user interface on the PC. These control the adapter and thus the floppy disk drive via USB. Both command line tools and a simple graphical user interface are available. The Python scripts can be found in the software/pc/ folder.
DiskBuddy64 uses the D64 format to read or create disk images. The structure of a D64 file can be found here. The D64 format is supported by all C64 emulators as well as by SD2IEC and Pi1541.
python diskbuddy-gui.py
.python flash-firmware.py
.DEVICE=attiny202 make install
to compile, burn the fuses and upload the firmware (change DEVICE accordingly).Python needs to be installed on your PC in order to use the software. Most Linux distributions already include this. Windows users can follow these instructions. In addition PySerial and Tkinter (8.6 or newer) must be installed. However, these are already included in most Python installations.
Windows users may also need to install a driver for the CH340N USB to serial adapter. This is not necessary for Linux or Mac users.
python diskbuddy-gui.py
.The following command line tools are available:
python disk-detect.py
python disk-dir.py [-h] [-d {8,9,10,11}]
optional arguments:
-h, --help show help message and exit
-d, --device device number of disk drive (8-11, default=8)
python disk-format.py [-h] [-x] [-n] [-c] [-v] [-d {8,9,10,11}] [-t TITLE] [-i IDENT]
optional arguments:
-h, --help show help message and exit
-x, --extend format 40 tracks
-n, --nobump do not bump head
-c, --clear clear (demagnetize) disk (recommended for new disks)
-v, --verify verify each track after it is formatted
-d, --device device number of disk drive (8-11, default=8)
-t TITLE, --title TITLE disk title (max 16 characters, default=commodore)
-i IDENT, --ident IDENT disk ident (2 characters, default=64)
Example: python disk-format.py -t games -i a7
python disk-read.py [-h] [-x] [-b] [-d {8,9,10,11}] [-i INTER] [-f FILE]
optional arguments:
-h, --help show help message and exit
-x, --extend read disk with 40 tracks
-b, --bamonly only read blocks with BAM entry (recommended)
-d, --device device number of disk drive (8-11, default=8)
-i INTER, --interleave INTER sector interleave (default=4)
-f FILE, --file FILE output file (default=output.d64)
Example: python disk-read.py -b -f game.d64
python disk-write.py [-h] [-b] [-d {8,9,10,11}] [-i INTER] -f FILE
optional arguments:
-h, --help show help message and exit
-b, --bamonly only write blocks with BAM entry (recommended)
-d, --device device number of disk drive (8-11, default=8)
-i INTER, --interleave INTER sector interleave (default=4)
-f FILE, --file FILE input file (*.d64)
Example: python disk-write.py -b -f game.d64
python disk-verify.py [-h] [-b] [-d {8,9,10,11}] [-i INTER] [-e ERRORS] -f FILE
optional arguments:
-h, --help show help message and exit
-b, --bamonly only verify blocks with BAM entry (recommended)
-d, --device device number of disk drive (8-11, default=8)
-i INTER, --interleave INTER sector interleave (default=4)
-e ERRORS, --errors ERRORS tolerated errors until abort (default=0)
-f FILE, --file FILE d64 file to compare the disk with
Example: python disk-verify.py -b -f game.d64
python disk-load.py [-h] [-d {8,9,10,11}]
optional arguments:
-h, --help show help message and exit
-d, --device device number of disk drive (8-11, default=8)
python flash-firmware.py
There are numerous applications to create and modify D64 image files and add or delete PRG files yourself. The whole thing is very quick and easy, for example with WebDrive on cbm8bit.com. As a web application, it is platform-independent and requires no installation. In addition, you can even visualize the image of the diskette - very cool!
If you are looking for a command line tool for working with D64 files, cc1541 is a good choice.
This work is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License. (http://creativecommons.org/licenses/by-sa/3.0/)