# MartyPC: A cycle-accurate emulator for early IBM PCs

> This open-source emulator recreates 1980s IBM computers with extreme precision, down to individual CPU cycles.
- Title: MartyPC: A cycle-accurate emulator for early IBM PCs · GitHub
- Summary: This open-source emulator recreates 1980s IBM computers with extreme precision, down to individual CPU cycles. MartyPC achieves 99.9997% cycle-accuracy by…
- Keywords: martypc, ibm pc, emulator, intel 8088, rust, cycle-accurate, 8088 mph, area 5150, retro computing, pc development, debugging tools, github
- Source: GitHub — https://github.com/dbalsom/martypc
- Read time: 2 min
- Topics: martypc, ibm pc, emulator, intel 8088, rust, cycle-accurate, 8088 mph, area 5150, retro computing, pc development, debugging tools, github
## An emulator for early IBM PCs
MartyPC emulates IBM PCs, XTs, PCjr, and Tandy 1000 computers. It runs on Windows, Linux, macOS, and even in web browsers.
## Built to learn Rust
The project started as a hobby to write an emulator from scratch while learning Rust. It grew far beyond its modest original goals.
## Made for retro PC developers
MartyPC's niche is helping programmers write software for the Intel 8088. They can see and measure exact cycle-by-cycle execution of their code.
## Tested against real hardware
The developer validated the 8088 CPU emulation against a real chip connected to an Arduino MEGA. Instructions run simultaneously on both and results are compared cycle-by-cycle.
## 99.9997% cycle-accurate
After extensive testing with the 8088 V2 Test Suite, including prefetch queue exercises, MartyPC achieves near-perfect cycle accuracy.

> MartyPC passes the 8088 V2 Test Suite with 99.9997% cycle-accuracy.
## Hardware research with real tools
The developer investigated the 8253 timer chip with an Arduino, measured DMA timings with an oscilloscope, and built a bus sniffer using a logic analyzer.
## Runs demanding PC demos
In April 2023, MartyPC became accurate enough to run 8088 MPH. A month later, it became the first emulator to run every effect in Area 5150.
## Emulates CPUs and system hardware
MartyPC includes cycle-accurate Intel 8088 and preliminary NEC V20 emulation. It also emulates the 8255 PPI, 8259 PIC, 8253 PIT, 8237 DMAC, and 8250 UART.
## Complete video card support
CGA, TGA, MDA, Hercules, EGA, and VGA cards are emulated. CGA uses a unique approach that simulates the entire display field, including overscan.
## Sound and storage devices
PC Speaker, Adlib, SN76489, and Disney Sound Source are emulated. Storage includes floppy disk controllers, IBM/Xebec HDC, XT-IDE, and PCjr cartridges.
## Dual-head monitor configurations
MartyPC supports dual-video card setups with multi-monitor configurations. Each display viewport can receive independent shader configurations.
## Extensive debugging tools
The debugging GUI includes instruction disassembly, CPU state, memory viewer, and peripheral states. Code and memory breakpoints plus instruction and cycle-based logging are supported.
## Built on reverse-engineered microcode
The emulator relies on reenigne's work reverse-engineering the 8088 microcode and Ken Shirriff's research on 8086 silicon logic.

> Without his work reverse-engineering the 8088 microcode, this emulator would never have been possible.
## Key takeaway

MartyPC achieves 99.9997% cycle-accuracy by testing against real 8088 hardware, making it ideal for retro PC development and debugging.