Building an IBM PC XT on an FPGA
A detailed build log of recreating a functional 1980s IBM PC XT using an FPGA, a low-power NEC V20 CPU, and custom Verilog modules — all to run the EGA version of Monkey Island with mouse, hard drive, and Adlib sound.
Introduction
This article is a translation and adaptation of the BitHack project — a recreation of the classic IBM PC XT from the 1980s using modern technologies. The original author is BitHack; the translation was done by Dmitry Bright. The ultimate goal of the project is deceptively simple: build a functional computer capable of running the EGA version of "The Secret of Monkey Island" with full mouse support, a writable hard drive, and sound through an Adlib-compatible card.

Hardware Platform
The core components of the build are:
- CPU: A low-power variant of the NEC V20 (a software-compatible replacement for the Intel 8088, but with additional instructions and slightly better performance)
- FPGA: icesugar-pro board with a Lattice LFE5U-25F
- Memory: A 1 MB SRAM chip (CY62158EV30)
- Interfaces: Dual PS/2 connector (keyboard and mouse), micro SD card slot (functioning as a hard drive)
- Sound: YM3014B DAC for FM synthesis, plus a piezo speaker for the PC speaker
- Other: Reset button, status LEDs

Development Stages
1. Bus Controller
The first major challenge was implementing a bus controller — a finite state machine that handles communication between the NEC V20 CPU and the rest of the system through the FPGA. The controller must provide precisely timed signals matching the original IBM PC XT bus timing. The NEC V20 expects specific signal patterns for memory reads, memory writes, I/O reads, and I/O writes, each with their own timing requirements.
Getting this right is critical: if the timing is off by even a single clock cycle, the CPU either reads garbage data or writes to the wrong location. The state machine was implemented in Verilog, carefully matching the timing diagrams from the NEC V20 datasheet.

2. First Tests — Blinking an LED
"Blinking an LED can be called the hardware equivalent of the software 'Hello, World!'" — and for good reason. Before attempting to run any software, the first goal was to verify that the CPU was alive and executing instructions. A tiny assembly program was written that simply toggled an I/O port connected to an LED. Seeing that LED blink meant the bus controller was working, the CPU was fetching and executing instructions from ROM, and the basic I/O write path was functional.
3. Memory Management
The memory architecture required careful design:
- BIOS: Loaded into the FPGA's block RAM, providing the initial boot code that the CPU executes on power-up
- Main RAM: Mapped to the external 1 MB SRAM chip, providing the conventional memory that DOS and applications use
- Video memory: Implemented with separate read and write ports to allow simultaneous CPU writes and display refresh reads without bus contention
The video memory implementation was particularly tricky. In the original IBM PC, the CGA and EGA adapters had their own dedicated memory that both the CPU and the video timing generator needed to access. The FPGA implementation uses dual-port block RAM to avoid the access conflicts that the original hardware solved with bus arbitration.

4. SD Card as Hard Drive
One of the more involved parts of the project was implementing SD card support to serve as the system's hard drive. This required two components:
- Hardware: A Verilog SPI controller module that handles the low-level communication with the SD card, including initialization, reading sectors, and writing sectors
- Software: An Option ROM written in 8088 assembly language that hooks into the BIOS disk interrupt (INT 13h) and translates disk requests into SD card SPI commands
The SPI protocol was chosen over the faster SD bus mode because it requires fewer FPGA pins and is simpler to implement. While slower, SPI is more than adequate for an XT-class system where the CPU is the bottleneck, not the storage.

5. PS/2 Mouse Support
Getting the mouse working required building a bridge between two completely different protocols. Monkey Island expects a serial (COM port) mouse, but modern mice use the PS/2 protocol. The solution was to implement a PS/2-to-Serial bridge in Verilog that:
- Receives mouse movement and button data via the PS/2 protocol
- Converts the data into the Microsoft Serial Mouse protocol format
- Presents it on a virtual UART (serial port) that the game software can read
Debugging this module required extensive use of a logic analyzer to capture and examine the actual PS/2 signals from the mouse, comparing them against the protocol specification to find timing issues.

6. Sound
The audio system has two parts:
PC Speaker: The classic beeper found in every IBM PC, controlled through the Programmable Interval Timer (PIT). The FPGA implements the timer counter that generates a square wave at the requested frequency, driving a piezo speaker. This provides the basic beeps and boops that many early PC games used for sound effects and even music.
Adlib FM Synthesis: For proper music, the project implements an Adlib-compatible sound card using the open-source "jtopl" Verilog core — a reimplementation of the Yamaha OPL2 FM synthesis chip. The jtopl core outputs PCM audio data, which then needs to be converted to the format expected by the YM3014B DAC chip. A custom Verilog module handles this conversion, translating PCM samples into the 3:10 floating-point format (3-bit exponent, 10-bit mantissa) that the YM3014 expects.

Development Tools
- Schematic design: EasyEDA CAD
- PCB manufacturing: JLCPCB
- HDL: Verilog
- Simulation: Verilator (an open-source Verilog simulator that compiles Verilog code to C++ for fast simulation)
- Assembly: NASM (the Netwide Assembler, used for writing the BIOS and Option ROM code)
Results
The finished project successfully runs DOS applications with both CGA and EGA graphics modes. Additional features include:
- A USB-UART bridge for transferring files to and from the SD card without removing it
- Acrylic panels for protecting the exposed PCB
- Full CGA and EGA graphics support
- Working Adlib-compatible sound
- PS/2 keyboard and mouse input
And yes — Monkey Island runs perfectly, with full EGA graphics, mouse control, and Adlib music.
All source code, schematics, and Gerber files for the PCB have been published on GitHub, making this a fully open-source and reproducible project for anyone interested in building their own FPGA-based retro PC.
FAQ
What is this article about in one sentence?
This article explains the core idea in practical terms and focuses on what you can apply in real work.
Who is this article for?
It is written for engineers, technical leaders, and curious readers who want a clear, implementation-focused explanation.
What should I read next?
Use the related articles below to continue with closely connected topics and concrete examples.