Welcome

Writing an arcade game emulator is an awesome learning project, and this tutorial will take you through the entire process in a very detailed way. Want to really learn how a CPU works? Writing an emulator is the best way to learn about it.

You'll need a working knowledge of C, and a knowledge of assembly language might be helpful. If you don't know assembly, writing an emulator is a great way to become knowlegeable about it. You will also need to be comfortable with hexadecimal math (also known as base 16, or simply "hex"). I will give an introduction to this topic as well.

I have chosen to emulate Space Invaders which uses the 8080 processor. Since this game and processor are so popular, there is a lot of information about them widely available on the internet. You'll need it to complete the project.

All the source code for this tutorial is available on github. If you aren't comfortable using git, there is a "Download ZIP" button on the github page that will download an archive of all the code.

Introduction

Introduction to Binary and Hex

A quick introduction to a CPU

Logical Operations

Introduction to Assembly Language

Stacks

8080 Disassembler

Diving In

Disassembler pt 1

Memory Maps

developing on the command line

Disassembler pt 2

8080 CPU Emulator

Emulator Shell

Arithmetic Group

Branch Group

Logical Group

IO and Special Group

Stack Group

More About Binary Numbers

Finishing the CPU emulator

Full 8080 emulation

Machine

rest of the machine

Displays - more than you ever wanted to know

Interrupts

Buttons and ports

Cocoa Platform

Making the emulator play for Mac OS X 10.11 El Capitan and XCode 7.

Cocoa Port pt 1 - Setting up the project

Cocoa Port pt 2 - Machine object

Cocoa Port pt 3 - InvadersView

Debugging Tales

Cocoa Port pt 4 - Keyboard

Cocoa Port pt 5 - Sound

Cocoa Port pt 6 - Performance

Cocoa Port pt 7 - Threading

iPhone Platform

Adopting the emulator for play on iPhone/iOS 9.

iPhone Port pt 1 - Project Setup

iPhone Port pt 2 - Machine Object

iPhone Port pt 3 - ViewController.m

Xcode built-in debugging tools

iPhone Port pt 4 - Touch Handling

iPhone Port pt 5 - Sound

iPhone Port pt 6 - Eye Candy

CHIP-8 Emulator

Introduction to CHIP-8

CHIP-8 Disassembler

CHIP-8 Instruction Set

CHIP-8 Emulator

Sprites

Cocoa Port pt 1 - Project Setup

Cocoa Port pt 2 - Machine Object

Cocoa Port pt 3 - View Object

6502 Emulator

6502 Emulator Introduction

6502 Addressing Modes

6502 Disassembler

6502 Assembler

Next: introduction-to-binary-and-hex →


Post questions or comments on Twitter @realemulator101, or if you find issues in the code, file them on the github repository.