A near perfect emulation of the 1541 floppy drive has been released, and you need only a Raspberry Pi and a soldering iron to rock the 1980s once again.
Thankfully, the emulator does not recreate the 1541's unfortunate habit of dying early and often.
Retro enthusiast Steve White ruined the weekend of many a computer-widow or widower with a short post announcing the release on Lemon64, a forum for those who like to fiddle with Commodore's obsolete hardware.
The objective of the Pi1541 project is to produce a perfect emulator for the original Commodore 1541 drive, running on a Raspberry Pi 3B (or 3B+).
Attempts to emulate Commodore's dodgy drive have been attempted before, most notably the SD2IEC hardware which, while convenient, does not completely emulate all the hardware, leading to incompatibilities.
Pi1541, on the other hand, emulates the 6502 CPU and two 6522 IO controllers found in the actual hardware, ensuring that any code will be run exactly as it would on the original silicon. Add some disk images to the Pi SD card, and the diminutive computer becomes a drive compatible with many of Commodore’s 8 bit wares, including the much loved Commodore 64.
Wannabe floppy-botherers will also need to wield a soldering iron in order to construct a cable to connect the Pi's General-Purpose Input/Output (GPIO) header to Commodore's six-pin serial port via an I2C Bi-Directional Logic Level Converter (the 5V produced by a vintage Commodore would fry the Pi otherwise).
The 1541 had somewhat of a chequered history, with Brian Bagnall’s excellent history of Jack Tramiel's computer company documenting the compromises made on its path to market. Rather than the somewhat sluggish drive that eventually emerged, Commodore engineer Robert Russell had planned to use a 6526 chip with a faster serial line.
Alas, production problems and a requirement to make the 1541 backwardly compatible with the ageing Vic 20 computer resulted in a drive with performance that could charitably be described as "lethargic".
Taking over two minutes to load a 64 kilobyte into memory was maddening. As Russell told Bagnall: "I wasted millions of people's hours I was later told."
Third-party companies later overcame some of the performance problems, and the solutions should behave correctly when introduced to the Pi1541 thanks to the thorough hardware emulation.
The Pi1541 will, however, not be emulating the horrifying failure rate of the original device. The drive heads soon became misaligned, with Tom Halfhill, editor of Compute!’s Gazette, complaining that four of the magazine's seven drives failed.
In Bagnall's book, Robert Russell remembered the boomerang drives heading back to Commodore: "We had 30 semi-trailers full of 1541 disk drives in the back parking lot sinking into the asphalt. I don’t know how many hundred-thousand drives were out there."
Those were the days.
White – a resident of Melbourne, Australia, and Technical Director of Torus Games – told El Reg he started out on a Vic 20 in 1983 before moving to a Commodore 64 in 1984 and finally acquiring a 1541 drive in 1987.
After a bad experience with the SD2IEC he set about creating Pi1541 about two years ago, using his experience in 6502 assembler to emulate to process. The next bit was trickier.
"The 6522 emulation was a bit harder. There are the original data sheets but they can be vague and confusing in areas. For the drive logic there is even less information... I discovered the timings a total byte would take to read of the disk for each of the four density regions. By some fluke I was able to start reading disk images by serving up bytes to the emulated 6522 using these timings."
White had a great deal of trouble getting copy-protected VMAX4 games to work, eventually having to write his own logic analyser on the Pi to capture all the address and data bus activity from an actual 1541. This attention to detail had the side effect of hugely improving compatibility.
Among others, he gives credit to Peter Edwards, author of the Arduino-based C64 tape emulator, for inspiration and to nbla000 for letting him make use of the CBMFileBrowser code. ®