Kevin Vance's C64 Cartridge Links the 6502 to the Rather More Powerful RP2040 on a Raspberry Pi Pico
Released under a permissive license, this "Rube Goldberg machine" lets a Commodore 64 load programs and data from a Raspberry Pi Pico.
Maker Kevin Vance has built a clever cartridge compatible with the classic Commodore 64 microcomputer, and it is driven by a somewhat less than period-appropriate device: a Raspberry Pi Pico board.
"I've taken another crack at putting a Raspberry Pi Pico into a C64 cartridge, and it's exceeded my expectations," Vance writes of his work. "There's buffers on the board to bring the 5V signals down to 3.3V, but if there was a 5V tolerant pico, you could probably put the GPIO [General Purpose Input/Output] pins right on the bus!"
The compact cartridge board, jumper-configurable between 8kB and 16kB, uses a window of the Raspberry Pi Pico's 264kB of static RAM (SRAM) as a read-only memory — driven by a combination of the programmable input/output (PIO) blocks on the Raspberry Pi Pico's RP2040 microcontroller and its direct memory access (DMA) controller.
"To allow the C64 to communicate with the Pico," Vance explains, "a 256 byte command area is reserved that will put that byte onto the RX FIFO for the CPU to consume. The CPU can put any value onto the TX FIFO to signal that it is ready for more commands. It's a Rube Goldberg machine, but the Pico's PIO controllers and DMA can do this in well under the time required by the C64's CPU."
In a video demo posted to Twitter the cartridge is shown loading an image — a Raspberry Pi logo, appropriately — from the Raspberry Pi Pico, in somewhat unusual fashion: "The 6502 code stored in [the RAM] window copies the 23kB image displayer program to the C64's memory in 1kB chunks, then executes it," Vance explains.
"It's telling the Pico's CPU to page through the larger program by reading from a special 256 byte area that puts commands on the PIO FIFO, one of which will bypass the FIFO and just return whether the Pico is busy."
More details are available on Vance's GitHub repository, where firmware source code and PCB design files have been made available under the permissive BSD three-clause license.