Main Content

Pi1541 is a real-time, cycle exact, Commodore 1541 disk drive emulator that can run on a Raspberry Pi 3B (or 3B+). The software is free and I have endeavored to make the hardware as simple and inexpensive as possible.

Pi1541 provides you with an SD card solution for using D64, G64, NIB and NBZ Commodore disk images on real Commodore 8 bit computers such as;-
Commodore 64
Commodore 128
Commodore Vic20
Commodore 16
Commodore Plus4


Like most people I was a little disappointed in the SD2IEC offerings (being very hit and miss with their compatability) and the hard to order, FPGA solutions were out of my budget.
Inspired by projects such as Peter Edwards’ Tapuino and David Banks’ PiTubeDirect I set about implementing a 1541 on a Raspberry Pi. My the goal was to make a highly compatable, inexpensive SD card solution for all Commodore 8 bit machines.
I am yet to get it to work on a Pi Zero (as this would be a truly inexpensive solution), but maybe one day.

The Commodore 1541 disk drive is a computer itself. It consists of a CPU, ROM, RAM, IO devices and the drive mechanics. Due to the popularity of Commodore machines and the subsequent proliferation of software created for them, all kinds of exotic fast loaders and copy protection schemes were developed. As a consequence an inexpensive, cycle exact, SD card solution has taken longer than other systems to come to fruition.
How does Pi1541 differ from SD2IEC?
Unlike SD2IEC, Pi1541 emulates a 6502 and the two 6522s. Any code it is asked to run is run in a cycle exact way. SD2IEC supports a limited set of fast loaders by attempting to guess the fast loader from the code sent to it. SD2IEC will not, and cannot, execute the code, it just simulates the communication protocoles. As a consequence only a small amount of popular fast loaders are supported. As Pi1541 can execute code on its emulated 6502 core it supports a vast range of fast loaders (games and demo scene) even copy protected originals.

When I started out, I had no way of selecting disk images using the Pi’s screen and keyboard. I used NBLA000�s excellent CBMFileBrowser that all SD2IEC users would be familiar with. CBMFileBrowser runs on the target Commodore computer and allows you browse and select diskimages using that target computer. In order to do this I had to implement minimal SD2IEC commands. This way, folders can be navigated and disk images selected as, at this level the Pi behaves like a SD2IEC device. But once a disk image has been selected the Pi drops down into full cycle exact emulation and compatability is near 100%.
Subsequently I have implemented file browsing and selection using the Pi’s screen and keyboard. I was going to remove SD2IEC support but others have convinced me to leave it in. Be warned though; the bare minimum functionality was implemented and was initially only used for testing. Going forwards I hope others will implement the full functionality.
Currently when Pi1541 boots it will be in browser mode (or SD2IEC mode)
In this mode Pi1541 will support very minimal SD2IEC commands. Basicaly you can load PRG files and browse folders and images. (Multiple channels and Saving are also supported for sequentual files only)
Once a valid disk image or images have been selected Pi1541 will drop down into emulation mode.
In full emulation mode reading and writing are supported. To simulate a write protected disk, set the disk image’s file on the SD card to read only.
Note: writing is only supported for D64 and G64 disk images.
Note: when writing back to a disk, Pi1541 cannot make a track longer than the original image’s track length. This is generally not an issue.”

Link to article