Disco nel drive
Trascina qui file PRG o SEQ per scriverli sul disco
La XUM1541 è un piccolo adattatore USB che collega un drive 1541, 1571 o 1581 a un computer moderno. Con lei puoi salvare in un'immagine D64 i dischi che hai nel cassetto da quarant'anni, prima che si smagnetizzino, oppure scrivere sui floppy veri i giochi e le demo scaricati da internet.
In questa pagina trovi il programma per usarla direttamente dal browser e la guida completa: com'è fatta, come costruirla con un Arduino Pro Micro, come caricare il firmware e installare i driver.
The XUM1541 is a small USB adapter that connects a 1541, 1571 or 1581 drive to a modern computer. With it you can save the disks that have been sitting in your drawer for forty years into D64 images, before they lose their magnetism, or write games and demos downloaded from the internet onto real floppies.
This page has the program to use it straight from the browser and the full guide: how it is made, how to build one with an Arduino Pro Micro, how to load the firmware and install the drivers.
Trascina qui file PRG o SEQ per scriverli sul disco
I drive Commodore parlano con il computer attraverso il bus seriale IEC: un cavo con la presa DIN a 6 poli e cinque segnali (ATN, CLK, DATA, RESET, SRQ) con tempi di pochi microsecondi. Un PC non ha niente del genere, e una semplice porta USB non riesce a rispettare quei tempi.
La XUM1541 risolve il problema con un microcontrollore che ha l'USB integrato: il suo firmware, scritto da Nate Lawson e distribuito con il progetto OpenCBM, gestisce da solo tutti i tempi del bus, mentre il computer gli manda solo comandi ad alto livello (“parla con il drive 8”, “manda questi byte”, “leggi la risposta”).
Un Arduino Pro Micro e una presa DIN: è la versione di questa guida, costa pochi euro di componenti.
La versione commerciale di RETRO Innovations, con porta parallela per i cavi XP1541 e bus IEEE-488 per i drive PET. Usa lo stesso firmware e funziona anche con il nostro programma.
1541, 1541-II, 1570, 1571, 1581 e in generale le periferiche sul bus seriale del C64 e del VIC-20.
Commodore drives talk to the computer over the IEC serial bus: a cable with a 6-pin DIN plug and five signals (ATN, CLK, DATA, RESET, SRQ) timed in microseconds. A PC has nothing like it, and a plain USB port cannot keep those timings.
The XUM1541 solves this with a microcontroller that has built-in USB: its firmware, written by Nate Lawson and shipped with the OpenCBM project, handles all the bus timing on its own, while the computer only sends high-level commands (“talk to drive 8”, “send these bytes”, “read the answer”).
An Arduino Pro Micro and a DIN socket: the version in this guide, a few euros of parts.
The commercial version by RETRO Innovations, with a parallel port for XP1541 cables and an IEEE-488 bus for PET drives. Same firmware, and it works with our program too.
1541, 1541-II, 1570, 1571, 1581 and in general the devices on the C64 and VIC-20 serial bus.
Nella versione più semplice non ci sono altri componenti: le linee del bus IEC vanno saldate direttamente ai pin del Pro Micro. Il firmware usa i pin in modalità “open collector” (li porta a massa oppure li lascia liberi), proprio come fa il C64.
In the simplest version there are no other parts: the IEC bus lines are soldered straight to the Pro Micro pins. The firmware drives the pins “open collector” style (it pulls them to ground or leaves them free), exactly like the C64 does.
| Pro Micro (scritta sulla scheda) | Pro Micro (board marking) | ATmega32U4 | Segnale | Signal | Pin DIN IEC | IEC DIN pin |
|---|---|---|---|---|---|---|
| 16 | PB2 | DATA | 5 | |||
| 14 | PB3 | CLK | 4 | |||
| 8 | PB4 | ATN | 3 | |||
| 9 | PB5 | SRQ | 1 | |||
| 10 | PB6 | RESET | 6 | |||
| GND | — | GND | 2 |
PROMICRO_7406). Protegge meglio il microcontrollore e permette la lettura “nibbler” sulla 1571.PROMICRO_7406). It protects the microcontroller better and allows “nibbler” reads on the 1571.Per la nostra abbiamo seguito il progetto C64-XUM1541 di tebl: un circuito stampato pensato per non dover saldare fili, con il Pro Micro su zoccolo, la presa DIN e un pulsante. I file Gerber per farlo produrre sono nel suo repository (e su PCBWay). Lo stesso schema si può realizzare anche su millefori o con pochi fili.
| Rif. | Componente | Q.tà |
|---|---|---|
| A1 | Arduino Pro Micro 5 V / 16 MHz (ATmega32U4) | 1 |
| A1 | 2 strip da 12 pin maschio, oppure femmina per poter togliere il Pro Micro | 2 |
| J1 | Presa DIN 6 poli femmina da circuito stampato | 1 |
| SW1 | Pulsante 6×6 mm ad angolo retto (serve per caricare il firmware) | 1 |
| D1, R1 | LED 5 mm e resistenza da 330 Ω (facoltativi) | (1) |
| J2 | Connettore 2×8 pin per il cavo parallelo (facoltativo) | (1) |
| — | Scatola 70×45×30 mm (facoltativa) | (1) |
| — | Cavo seriale IEC DIN 6 maschio–maschio, come quello tra C64 e 1541 | 1 |
For ours we followed tebl's C64-XUM1541 project: a printed circuit board designed so you don't have to solder wires, with the Pro Micro on headers, the DIN socket and a button. The Gerber files to have it made are in his repository (and on PCBWay). The same circuit can be built on perfboard or with a few wires.
| Ref. | Part | Qty |
|---|---|---|
| A1 | Arduino Pro Micro 5 V / 16 MHz (ATmega32U4) | 1 |
| A1 | 2 × 12-pin male headers, or female ones to be able to remove the Pro Micro | 2 |
| J1 | 6-pin female DIN socket, PCB mount | 1 |
| SW1 | 6×6 mm right-angle push button (used to load the firmware) | 1 |
| D1, R1 | 5 mm LED and 330 Ω resistor (optional) | (1) |
| J2 | 2×8-pin header for the parallel cable (optional) | (1) |
| — | 70×45×30 mm project box (optional) | (1) |
| — | 6-pin DIN male–male IEC serial cable, like the one between C64 and 1541 | 1 |
Il firmware ufficiale è nel repository di OpenCBM, già compilato per il Pro Micro:
La versione 8 è quella che abbiamo provato con il programma di questa pagina. Il Pro Micro ha un bootloader (Caterina) che resta dopo la programmazione, quindi il firmware si può cambiare quando si vuole. Si programma con avrdude, che si trova già installato con l'Arduino IDE.
COM10):avrdude -p m32u4 -c avr109 -P COM10 -b 57600 -D -U flash:w:xum1541-PROMICRO-v08.hex:i
Con l'Arduino IDE avrdude si trova in %LOCALAPPDATA%\Arduino15\packages\arduino\tools\avrdude\ (cartella bin, con avrdude.conf in etc da indicare con -C). Su Linux:
stty -F /dev/ttyACM0 speed 1200 # reset nel bootloader
avrdude -p m32u4 -c avr109 -P /dev/ttyACM0 -U flash:w:xum1541-PROMICRO-v08.hex:i
16D0:0504).La guida di tebl consiglia la versione 7 del firmware, perché con la sua configurazione di OpenCBM la 8 non funzionava: se usi OpenCBM e hai problemi, prova la v07 dal suo repository. Il programma di questa pagina accetta le versioni 7 e 8.
The official firmware is in the OpenCBM repository, already built for the Pro Micro:
Version 8 is the one we tested with the program on this page. The Pro Micro has a bootloader (Caterina) that stays after programming, so the firmware can be changed whenever you like. It is programmed with avrdude, which already comes with the Arduino IDE.
COM10):avrdude -p m32u4 -c avr109 -P COM10 -b 57600 -D -U flash:w:xum1541-PROMICRO-v08.hex:i
With the Arduino IDE, avrdude is in %LOCALAPPDATA%\Arduino15\packages\arduino\tools\avrdude\ (folder bin, with avrdude.conf in etc to be passed with -C). On Linux:
stty -F /dev/ttyACM0 speed 1200 # reset into the bootloader
avrdude -p m32u4 -c avr109 -P /dev/ttyACM0 -U flash:w:xum1541-PROMICRO-v08.hex:i
16D0:0504).tebl's guide recommends firmware version 7, because version 8 did not work with his OpenCBM setup: if you use OpenCBM and have trouble, try v07 from his repository. The program on this page accepts versions 7 and 8.
Windows non ha un driver per la xum1541: si installa con Zadig. Quale scegliere dipende dal programma che vuoi usare:
| Driver | Programma di questa pagina (Chrome, Edge) | OpenCBM (riga di comando) |
|---|---|---|
| WinUSB | ✔ necessario | dipende dalla versione: da provare |
| libusb-win32 | ✘ il browser non la vede | ✔ quello indicato nella guida di tebl |
16D0 0504).Il driver si può cambiare quando si vuole rifacendo gli stessi passi con Zadig: per esempio WinUSB per usare la pagina e libusb-win32 per tornare a OpenCBM.
Non serve un driver, ma un permesso: crea il file /etc/udev/rules.d/45-xum1541.rules con questa riga, poi ricarica le regole e ricollega la scheda.
SUBSYSTEM=="usb", ATTR{idVendor}=="16d0", ATTR{idProduct}=="0504", TAG+="uaccess"
sudo udevadm control --reload-rules
Non serve niente: la xum1541 è subito disponibile per il browser.
Windows has no driver for the xum1541: you install one with Zadig. Which one depends on the program you want to use:
| Driver | Program on this page (Chrome, Edge) | OpenCBM (command line) |
|---|---|---|
| WinUSB | ✔ required | depends on the version: to be tested |
| libusb-win32 | ✘ the browser cannot see it | ✔ the one in tebl's guide |
16D0 0504).You can switch driver at any time by repeating the same steps in Zadig: for example WinUSB to use this page and libusb-win32 to go back to OpenCBM.
No driver is needed, only a permission: create the file /etc/udev/rules.d/45-xum1541.rules with this line, then reload the rules and replug the board.
SUBSYSTEM=="usb", ATTR{idVendor}=="16d0", ATTR{idProduct}=="0504", TAG+="uaccess"
sudo udevadm control --reload-rules
Nothing to install: the xum1541 is available to the browser right away.
73,CBM DOS V2.6 1541,00,00. Inserisci un floppy e premi Directory..prg, oppure con Disco → immagine copia tutto il disco in un D64 (o D71, D81)."----------------" DEL alla directory.Il programma usa il protocollo seriale standard, lo stesso del C64 senza caricatori veloci: qualche centinaio di byte al secondo. Un file da 30 blocchi (circa 7,5 KB) richiede una ventina di secondi; un disco intero letto blocco per blocco richiede circa dieci minuti. I trasferimenti veloci di OpenCBM (d64copy, circa un minuto a disco) caricano un programma nella memoria del drive: non sono ancora nel programma web.
Senza xum1541 puoi provare tutto con la Simulazione: un drive virtuale in memoria che risponde come quello vero, ma non legge e non scrive nessun floppy. Il visualizzatore di immagini D64 e l'estrazione dei file funzionano in qualsiasi browser.
73,CBM DOS V2.6 1541,00,00. Insert a floppy and press Directory..prg, or copy the whole disk to a D64 (or D71, D81) with Disk → image."----------------" DEL separators to the directory.The program uses the standard serial protocol, the same as a C64 without fast loaders: a few hundred bytes per second. A 30-block file takes about twenty seconds; a whole disk read block by block takes about ten minutes. OpenCBM's fast transfers (d64copy, about a minute per disk) load a program into the drive's memory: they are not in the web program yet.
Without an xum1541 you can try everything with the Simulation: a virtual drive in memory that answers like the real one but reads and writes no floppy. The D64 image viewer and file extraction work in any browser.
La stessa scheda funziona con OpenCBM, la raccolta di programmi da riga di comando da cui viene il firmware. Su Windows si scompatta lo ZIP, si apre un prompt dei comandi come amministratore nella cartella e si installa con install xum1541. Poi:
cbmctrl detect rem elenca i drive collegati
cbmctrl dir 8 rem directory del disco nel drive 8
d64copy 8 disco.d64 rem copia veloce del disco in un'immagine
d64copy -n 8 disco.d64 > disco.log 2>&1 rem idem, con un registro degli errori
Per archiviare una collezione di dischi è utile tenere il registro di ogni copia: un disco con errori di lettura si riconosce subito anche dopo anni.
The same board works with OpenCBM, the command-line suite the firmware comes from. On Windows, unzip it, open a command prompt as administrator in the folder and install it with install xum1541. Then:
cbmctrl detect rem list the connected drives
cbmctrl dir 8 rem directory of the disk in drive 8
d64copy 8 disk.d64 rem fast copy of the disk to an image
d64copy -n 8 disk.d64 > disk.log 2>&1 rem same, with an error log
When archiving a disk collection it helps to keep a log of every copy: a disk with read errors is easy to spot even years later.
Fonti e ringraziamenti: firmware xum1541 di Nate Lawson e progetto OpenCBM; circuito stampato e guida di tebl, a sua volta basato sull'articolo di myoldcomputer.nl. Il programma web è un'implementazione indipendente di RetroFixer.
Sources and thanks: xum1541 firmware by Nate Lawson and the OpenCBM project; PCB and guide by tebl, itself based on the myoldcomputer.nl article. The web program is an independent implementation by RetroFixer.