Skip to the content
2 layers86.4 × 66.9 mmPico1541v2, the printed circuit board in 3D

CBM 1541 disk drive emulator running on Raspberry PI pico

Size
86.4 × 66.9 mm
Copper layers
2
Thickness
1.6 mm
Parts
54
Nets
63
Pads
334
Tracks, vias
460, 358
Pours
2
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
25 Mar 2026
Updated
21 Oct 2026

Overview

Pico1541v2 is an open-source printed circuit board by johnnyegel, from the johnnyegel/Pico1541 repository on GitHub. It is a 2-layer board of 86.4 × 66.9 mm with 54 parts on 63 nets, routed with 460 tracks and 358 vias.

It is built around the SRV05-4 and MMBT3904. Its parts include 7 connectors, 5 capacitors, 5 switches, 4 resistors and 2 ICs. It belongs with the RP2040 boards of this library.

Main components

2

README

README.md

Pico1541

A cycle-accurate Commodore 1541 disk drive emulator running on the Raspberry Pi Pico 2 (RP2350).

Unlike high-level IEC drive emulators (such as standard SD2IEC devices), Pico1541 provides true hardware-level emulation. It models the MOS 6502 CPU and dual MOS 6522 VIAs in sub-cycle lockstep at 1 MHz, alongside a custom PIO-based magnetic track surface. As a result, Pico1541 is compatible with custom fastloaders, custom DOS routines, and sophisticated multi-stage copy protection schemes that execute code directly inside the drive.


Table of Contents


Features

  • Cycle-Accurate Emulation Core: Driven by racc6502v4, a dedicated micro-instruction 6502 CPU core executing in sub-cycle lockstep with dual 6522 VIAs at 1 MHz.
  • Fastloader & Protection Compatibility: Compatible with popular fastloaders and custom drive code (Action Replay, Final Cartridge III, Epyx Fastload, Vorpal, V-MAX!, RapidLok, and custom track loaders).
  • Supported Disk Formats:
    • .D64: Standard 35-track and 40-track Commodore disk images (dynamic on-the-fly GCR encoding/decoding).
    • .G64: Raw GCR track bitstreams with custom sector interleave and variable speed zones.
    • .PRG: Mount standalone PRG files as virtual single-file disks on the fly.
  • Weak-Bit (Unstable Flux) Emulation: Dynamically mutates weak-bit areas (unstable GCR flux) across track revolutions using an LFSR pseudorandom generator without generating false SYNC markers, enabling copy-protected titles that rely on non-deterministic data (e.g. Bruce Lee, Paperboy) to load successfully.
  • Dual-Core Architecture (RP2350):
    • Core 1 (Emulator): Dedicated entirely to the cycle-exact 6502 CPU, 6522 VIAs, and PIO magnetic surface streaming.
    • Core 0 (Manager): Runs asynchronous Embassy tasks managing the SD card, flash filesystem, OLED display, navigation buttons, and virtual directory synthesis.
  • Hardware PIO Magnetic Surface: Utilizes RP2350 Programmable I/O (PIO) state machines and two-channel ping-pong DMA chaining for zero-CPU-overhead track data streaming to the emulated read head.
  • Storage Options:
    • MicroSD Card (FAT32): Mount disk images directly from folders on your SD card.
    • Internal Flash (LittleFS): Built-in flash filesystem for bundled utilities, settings, and ROM storage.
  • On-Device Interface:
    • 128x64 I2C SSD1306 OLED display.
    • 4-button tactile keypad (Up, Down, Select/Enter, Back/Exit).
    • RGB Status LED and Dual-color Drive Activity LED.
    • Drive Sound Emulation: Piezo speaker with PWM sample playback modeling authentic drive acoustics: motor hum with smooth acceleration/deceleration fade, head stepping clicks, and track 0 knocking sounds. Configurable volume (Muted, Low, Medium, High) and motor/stepper toggles saved in persistent flash.
  • SD2IEC Navigation & File Browser: Intercepts CD: commands on IEC channel 15 to allow navigating SD card folders and disk images using standard Commodore 64 file browsers such as fb64.
  • Configurable Drive ID: Switch drive device address between 8, 9, 10, or 11 with settings saved persistently in on-board flash.
  • Bundled Image Conversion Tools: Includes standalone Rust CLI tools (nib2g64 and nbz2nib) for converting raw .NIB and compressed .NBZ disk captures into standard .G64 format with automatic seam detection, alignment, and weak-bit sanitization.

Emulation Status & Known Limitations

Pico1541 actively strives for cycle-exact 1541 hardware behavior. However, full compatibility remains an ongoing development effort:

  • Cycle Accuracy Status: While the micro-instruction 6502 core and dual 6522 VIA emulation pass instruction-level test suites and run most fastloaders, cycle-accurate behavior is not yet 100% complete. A small number of advanced demos utilizing extreme cycle-tight fastloaders do not yet load correctly.
  • Weak-Bit Support: The magnetic surface engine includes weak-bit emulation for .G64 images. Weak byte ranges (represented by 0x00 bytes in .G64) mutate pseudorandomly on each revolution without generating false SYNC pulses. This allows copy-protected games relying on weak bits (such as Bruce Lee and Paperboy) to pass protection checks and boot. Advanced multi-revolution density-drift protections may still behave unpredictably.
  • Disk Image Formats: Native on-device emulation directly supports .D64, .G64, and .PRG. Raw .NIB format images cannot be processed directly on the microcontroller due to memory constraints; users can convert .NIB and .NBZ captures to .G64 using the bundled nib2g64 tool (see below) or external utilities prior to loading.

Architecture

Pico1541 divides responsibilities cleanly across the RP2350's two Cortex-M33 cores:

text
┌────────────────────────────────────────┐  ┌────────────────────────────────────────┐
│         Core 0 — Drive Manager         │  │        Core 1 — Hardware Emulator      │
│  (Embassy Async / pico1541-manager)    │  │   (Cycle-Exact / pico1541-emulator)    │
├────────────────────────────────────────┤  ├────────────────────────────────────────┤
│ • MicroSD FAT32 Driver (SPI)           │  │ • 6502 CPU Core (racc6502v4) @ 1 MHz   │
│ • Internal Flash LittleFS Storage      │  │ • Dual 6522 VIAs (Timers, Handshake)   │
│ • D64 / G64 / PRG Handlers             │  │ • PIO Magnetic Surface Engine          │
│ • On-the-fly GCR Track Encoder         │  │ • Hardware DMA Ping-Pong Streaming     │
│ • SSD1306 OLED UI & Keypad Task       │  │ • Physical IEC Bus Line Polling        │
│ • SD2IEC CD: Command Interceptor       │  │ • Stepper Motor & Head Position Logic  │
└───────────────────┬────────────────────┘  └───────────────────┬────────────────────┘
                    │                                           │
                    └─────────── Shared Track Buffer ───────────┘
                                (Double-buffered GCR)

Communication between cores occurs via atomic flags and shared double-buffered track memory (DualCoreTrackBuffer), ensuring Core 1 never suffers jitter or interrupt latency from SD card I/O.


Hardware & Pinout

Pico1541 interfaces with the 5V Commodore IEC bus using an open-collector inverter (7406 or 7405) with 1kΩ pull-up resistors on the 3.3V side. Ready-to-order KiCad PCB schematics and Gerbers are located in hardware/kicad/Pico1541v2/.

Hardware Revision 2 (RP2350 / Raspberry Pi Pico 2)

GPIOFunctionDescriptionConnection
GPIO 19DATA_RXIEC Data InInverted from IEC Pin 5 (DATA, 1kΩ pull-up)
GPIO 20DATA_TXIEC Data OutDrives 7406/7405 Open-Collector to IEC DATA
GPIO 21CLK_RXIEC Clock InInverted from IEC Pin 4 (CLK, 1kΩ pull-up)
GPIO 22CLK_TXIEC Clock OutDrives 7406/7405 Open-Collector to IEC CLK
GPIO 26ATN_RXIEC Attention InInverted from IEC Pin 3 (ATN, 1kΩ pull-up)
GPIO 27RESET_RXIEC Reset InInverted from IEC Pin 6 (RESET, 1kΩ pull-up)
GPIO 4I2C0_SDAOLED Display SDASSD1306 I2C Data
GPIO 5I2C0_SCLOLED Display SCLSSD1306 I2C Clock
GPIO 6..9BUTTONSTactile ButtonsShort to Ground (Up, Down, Enter, Back)
GPIO 11SD_DETMicroSD Card DetectSD Socket Card Detect Switch
GPIO 12SD_MISOMicroSD Data OutSPI1 MISO (DAT0)
GPIO 13SD_CSMicroSD Chip SelectSPI1 Chip Select (CD)
GPIO 14SD_CLKMicroSD ClockSPI1 SCK
GPIO 15SD_MOSIMicroSD Data InSPI1 MOSI (CMD)
GPIO 2PIEZOPiezo SpeakerHead Stepper Sound Simulation
GPIO 10ACT_LED1Activity LED Pin 1Dual-color Activity Indicator
GPIO 3ACT_LED2Activity LED Pin 2Dual-color Activity Indicator
GPIO 16RGB_REDStatus RGB LED RedDrive State Indicator
GPIO 17RGB_GREENStatus RGB LED GreenDrive State Indicator
GPIO 18RGB_BLUEStatus RGB LED BlueDrive State Indicator

ROM Installation & Legal Notice

[!IMPORTANT] Commodore DOS ROMs are proprietary and copyrighted. This repository does NOT contain any Commodore ROM files. To use Pico1541, you must supply a legally obtained 16 KB (16,384 bytes) binary dump of a 1541 DOS ROM (such as 1541-II.251968-03.bin, original 1541-c.bin, or a licensed JiffyDOS 1541 ROM).

The ROM file must have an exact size of 16,384 bytes (0x4000 bytes).

Compile-Time Embedding (Flash LittleFS)

This is the standard and recommended installation method. The build system packages the ROMs into an internal LittleFS flash partition on the Pico 2, making the drive completely self-contained.

  1. Install mklittlefs on your system:
    • On Linux / macOS, build from source via earlephilhower/mklittlefs or install via your package manager.
    • Verify mklittlefs is accessible in your PATH (mklittlefs --version).
  2. Copy your 16 KB ROM file(s) into the flash-fs/roms/ directory in this repository:
    bash
    cp /path/to/1541-II.251968-03.bin flash-fs/roms/
    (You can place multiple .bin or .rom files here—such as standard 1541-II DOS, 1541-C, and JiffyDOS—to switch between them on device).
  3. Compile the firmware as described in Building & Flashing. The build script (build.rs) will automatically pack flash-fs/ into a LittleFS image (fs.bin) and link it into flash memory.

Switching ROMs at Runtime (OLED Menu)

When multiple ROMs are bundled into the flash filesystem, you can switch between them on the fly:

  1. On the device, navigate to:
    text
    Main Menu -> Settings -> Select ROM
  2. The OLED screen displays all ROMs discovered in internal storage.
  3. Scroll to the desired ROM and press Select. The firmware immediately writes the selection to /settings/boot_rom.txt in persistent flash, reloads the emulator memory buffer, and resets the 6502 drive emulation.

Prerequisites

1. Rust Toolchain

Pico1541 is built with Rust. Install the stable Rust toolchain via rustup:

bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

2. ARM Cortex-M Target

Add the bare-metal target for the RP2350 (Cortex-M33):

bash
rustup target add thumbv8m.main-none-eabihf

3. Flashing Tools

Install elf2uf2-rs for easy USB drag-and-drop flashing (when the Pico 2 is in BOOTSEL mode):

bash
cargo install elf2uf2-rs --locked

Alternatively, install picotool or probe-rs if you prefer flashing via SWD/JTAG debuggers.


Building & Flashing

Clone the repository and enter the project directory:

bash
git clone https://github.com/johnnyegel/Pico1541.git
cd Pico1541

Make sure you have placed your 16 KB DOS ROM in flash-fs/roms/ before building.

Building the Release Binary

Build the optimized release firmware:

bash
cargo build -p pico1541-rp2350 --target thumbv8m.main-none-eabihf --release

Flashing via USB (BOOTSEL Mode)

  1. Unplug the Pico 2.
  2. Hold down the BOOTSEL button on the Pico 2 board and plug it into your computer via USB.
  3. Flash the binary:
    bash
    elf2uf2-rs -d target/thumbv8m.main-none-eabihf/release/pico1541-rp2350
    (Or run cargo run -p pico1541-rp2350 --release directly from within the crates/pico1541-rp2350 directory).

Flashing via SWD Debugger

If you are using a Raspberry Pi Debug Probe or SWD debugger with probe-rs, you can flash using:

bash
cargo flash-swd

Disk Image Conversion Tools (nib2g64)

While Pico1541's microcontroller firmware natively supports .D64, .G64, and .PRG formats, raw .NIB captures cannot be held entirely in the RP2350 RAM alongside the active emulation buffers. To make working with .NIB and .NBZ images seamless, Pico1541 includes host CLI conversion tools located in tools/:

  • Automatic Seam Detection & Alignment: Detects track loop overlaps and aligns tracks to standard sector headers.
  • Weak-Bit Processing: Identifies bad GCR runs and corrupt flux sequences, mapping them to weak-bit regions (0x00) so the firmware's magnetic surface engine can simulate non-deterministic flux at runtime.
  • Single File or Batch Processing: Convert an individual image or point to a directory to batch-convert all .nib and .nbz files.

Converting Images

bash
# Convert a single .nib or .nbz to .g64
cargo run -p nib2g64 -- game.nib -o game.g64

# Batch convert an entire folder of disk images
cargo run -p nib2g64 -- /path/to/disks/

Usage & Operation

IEC Cable Connection

Connect a standard 6-pin DIN serial cable from the Commodore 64 / 128 serial port to the DIN connector on the Pico1541 hat. Ensure the ground reference is shared.

OLED Menu Navigation

Pico1541 uses a 4-button navigation scheme:

  • Up / Down: Scroll through menus, files, and disk directories.
  • Select / Enter: Open a directory, mount a disk image (.D64, .G64), or mount a .PRG.
  • Back: Navigate up one directory level, or unmount the current image and return to the main menu.
  • Fast Scroll: Holding the Up or Down buttons skips through large lists quickly.
Menus Overview:
  • SD Card Browser: Browse files and folders on your MicroSD card.
  • Internal Flash Browser: Browse files stored on internal LittleFS flash storage (such as bundled utilities).
  • Settings:
    • Drive ID: Configure device address between 8, 9, 10, or 11.
    • Select ROM: Choose which DOS ROM to load from internal flash.
    • Sound Settings: Configure volume (Muted, Low, Medium, High) and toggle motor hum or head-stepping sounds.
    • Monitor: Real-time bus and drive activity diagnostics display.

C64 Commands & Browser

Once an image is mounted, use standard Commodore commands on your C64:

basic
LOAD "$",8
LIST
LOAD "*",8,1
RUN
Navigating with C64 File Browsers (e.g., fb64):

Pico1541 includes built-in SD2IEC protocol command snooping. When using tools like fb64:

  • Directory changes (CD:DIRNAME, CD:_, CD:←) are automatically intercepted on command channel 15.
  • The virtual directory track is dynamically updated, allowing you to browse folders and mount disks directly from the C64 screen without touching the hardware buttons.

Repository Structure

text
Pico1541/
├── crates/
│   ├── pico1541-emulator/     # Pure 6502 and dual 6522 VIA emulation engine
│   ├── racc6502v4/            # Cycle-accurate micro-step 6502 CPU implementation
│   ├── pico1541-manager/      # Async Embassy manager, disk formats, GCR, UI logic
│   ├── pico1541-rp-common/    # Shared hardware drivers (PIO, SPI, Display, Audio)
│   ├── pico1541-rp2350/       # Firmware entry point for Raspberry Pi Pico 2 (RP2350)
│   └── pico1541-common/       # Common definitions, events, and inter-core buffers
├── flash-fs/                  # Root filesystem packed into on-chip LittleFS partition
│   └── roms/                  # Location to place 16KB DOS ROMs for compile-time embedding
├── hardware/                  # KiCad schematics, PCB layouts, and Gerber files
│   └── kicad/
│       └── Pico1541v2/        # Hardware Revision 2 interface hat (RP2350)
├── tools/
│   ├── nib2g64/               # Standalone NIB/NBZ to G64 converter CLI tool
│   └── nbz2nib/               # Standalone NBZ decompressor CLI utility
├── scripts/                   # Tracing, logic analysis, and code generation scripts
├── COMMERCIAL_LICENSE.md      # Commercial manufacturing terms
└── LICENSE.md                 # Firmware license (PolyForm Noncommercial 1.0.0)

Licensing

This project is made available under multiple licenses:

Parts

54
QtyValueFootprintReferences
9MMountingHole:MountingHole_2.5mm_Pad_ViaH1, H2, H3, H4, H5, H7, H8, H9, H10
6FiducialFiducial:Fiducial_1mm_Mask3mmFID1, FID2, FID3, FID4, FID5, FID6
41kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR1, R2, R3, R4
3100nCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC2, C4, C5
21kResistor_SMD:R_Array_Convex_4x0603RN3, RN4
2~Symbol:Symbol_CC-Noncommercial_CopperTop_SmallCC1, CC2
110kResistor_SMD:R_Array_Convex_4x0603RN1
110uCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC3
1330Resistor_SMD:R_Array_Convex_4x0603RN2
147uCapacitor_SMD:CP_Elec_5x4.5C1
174LS06Package_SO:SO-14_3.9x8.65mm_P1.27mmU1
1Button1Button_Switch_SMD:SW_SPST_Omron_B3FS-100xPSW2
1Button2Button_Switch_SMD:SW_SPST_Omron_B3FS-100xPSW3
1Button3Button_Switch_SMD:SW_SPST_Omron_B3FS-100xPSW4
1Button4Button_Switch_SMD:SW_SPST_Omron_B3FS-100xPSW5
1DIN-6Pico-1541 Footprints:DIN-6-240degJ7
1Display/KeysConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ3
1LED_ACTLED_THT:LED_D5.0mmD2
1LED_STATPico-1541 Footprints:LED_D5.0mm-4_RGB_CorrectStaggered_PinsD1
1MMBT3904Package_TO_SOT_SMD:SOT-23Q1
1Micro SD CardPico-1541 Footprints:MicroSD_HPJFJ4
1OLEDConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ6
1OLED/Key_HatConnector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ5
1PiezoConnector_PinSocket_2.54mm:PinSocket_1x02_P2.54mm_VerticalLS1
1RaspberryPi_PicoModule:RaspberryPi_Pico_SMDA1
1ResetButton_Switch_THT:SW_Tactile_SPST_Angled_PTS645Vx83-2LFSSW1
1SRV05-4Package_TO_SOT_SMD:SOT-23-6U2
1SWDConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1
1SerialConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ2

The 49 most common of 54 parts.

Similar boards

  • 2 layers268 × 110.5 mmUnicorn, the printed circuit board in 3D

    Unicorn

    yanghu/unicorne

    A one-piece 40% ortho keyboard design inspired by crkbd, Kyria and Ferris.

    157 parts63MIT
  • 4 layers20.7 × 40.2 mmGigaset Debug Adapter, the printed circuit board in 3D

    Gigaset Debug Adapter

    Manawyrm/Gigaset-Debug-Adapter

    Gigaset-Debug-Adapter can be used with many Gigaset DECT phone models to access the internal UART. It's basically a 1.8V USB->UART converter, with switchable strapping logic and 3V step-down converter.

    54 parts43GPL-3.0
  • 4 layers82.5 × 65.5 mmOpenHomeSwitch, the printed circuit board in 3D

    OpenHomeSwitch

    TobleMiner/OpenHomelabSwitch

    297 parts11
  • 4 layers53.1 × 98 mmMarsupial, the printed circuit board in 3D

    Marsupial

    VIPQualityPost/marsupial

    2 port USB PD + data hub

    208 parts3
  • 4 layers72.7 × 100 mmIlluminator, the printed circuit board in 3D

    Illuminator

    VIPQualityPost/polarizer-illuminator

    15W USB PD powered microscope illuminator with electrically controlled liquid crystal polarizer for removing specular reflections.

    66 parts3
  • 4 layers43.1 × 12.4 mmStlink, the printed circuit board in 3D

    Stlink

    IM-TechieScientist/custom-stlink

    A custom STLink compatible debugger using STM32F103 designed using KiCAD

    39 parts
  • 2 layers61 × 90.9 mmBle ir remote, the printed circuit board in 3D

    Ble ir remote

    kattaliraees/ble_ir_remote

    IR remote with BLE interface

    47 partsMIT
  • 4 layers116.5 × 84.4 mmESC, the printed circuit board in 3D

    ESC

    navjeet-lohan/STM32-ESC-PCB

    180 parts

Questions

How big is the Pico1541v2 PCB?

It measures 86.4 × 66.9 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Pico1541v2 use?

54 parts, built around the SRV05-4 and MMBT3904. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Pico1541v2 KiCad files?

From the johnnyegel/Pico1541 repository on GitHub, at the commit this page was made from: the board is hardware/kicad/Pico1541v2/Pico1541v2.kicad_pcb and its schematic hardware/kicad/Pico1541v2/Pico1541v2.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Pico1541v2 design in my own project?

Its repository states no licence, so its author keeps all rights: ask johnnyegel before reusing the design.