The Commodore 64 (C64) is a classic home computer, but its internal hardware behavior can be complex to diagnose when components fail. Unlike traditional emulators that mimic the software behavior of the machine, the `c64-hw-sim` project by developer antirez models the C64 motherboard (specifically the ASSY 250407 revision) at a granular, electrical level. The simulator understands the board's netlist—the specific electrical connections on the PCB—and how every individual chip behaves at its specific pins. This allows users to interact with the machine as if they were physically manipulating the hardware: they can 'lift' a chip's leg, short a pin to ground or +5V, pull a chip out of its socket, or 'open' a resistor to see exactly how the system reacts.

A GIF showing the character ROM being pulled out and reinserted during a BASIC program execution.
A demonstration of the simulator's ability to model physical hardware manipulation, such as removing a chip from its socket.github.com

This visual demonstrates the project's core capability of simulating physical hardware interactions like removing a chip.

The simulation mechanism relies on modeling the physics of the electrical traces. Every pin drives its connected net with varying strengths (strong, weak pull-ups, or no drive). The simulator determines which signal 'wins' on a net; if two outputs fight, the lower voltage wins. It also models the behavior of floating lines, which drift toward specific voltages over time depending on whether they are loaded by TTL or MOS inputs. This level of detail means that when a user simulates a broken part, the resulting visual 'garbage' on the screen is a direct consequence of the simulated circuit's logic, rather than a pre-programmed effect. For example, lifting a specific pin on the color RAM might cause the machine to boot normally but display random colors because the CPU and the video chip (VIC) are reading from different, aliased addresses.

While highly accurate, the simulator faces significant performance trade-offs due to its exhaustive modeling. Because every pin of every chip is simulated, the program struggles to run at real-time speeds even on high-end modern hardware; for instance, an Apple M3 Max can only simulate the C64 at roughly 31% of its original speed. This makes it unsuitable for playing games but ideal for its intended purpose: hardware forensics. Repairers can use the tool to test hypotheses about a broken board, identifying which chips are most likely to be faulty before performing the tedious and risky process of desoldering components. However, the simulation has limits; it does not currently model internal chip faults like bad DRAM cells, nor does it simulate analog components like the power supply or the SID filter's audio output. It remains a specialized tool for understanding the 'intimate' electrical mechanics of the C64 rather than a general-purpose emulator.