EMU6502

EMU6502

A toy 6502 CPU emulator in C++ with bitmap graphics support. Designed for easy game development in 6502 assembly.

C++, Assembly, SDL
Started: 8/23/2023
Updated: 7/15/2024
emulation,retro,systems,graphics

EMU6502 Graphics Demo Bitmap graphics demo showing the 16-color palette system

Overview

A custom 6502 CPU emulator built in C++ that prioritizes ease of game development over hardware accuracy. Rather than emulating specific systems from the era, this emulator provides modern conveniences like bitmap graphics and a flexible color palette to make 6502 assembly game development more accessible.

Features

  • Bitmap Graphics System - Memory-mapped graphics starting at $1000
  • 16-Color Palette - Full 24-bit RGB color support starting at $1800
  • 64K Memory - Fully usable address space for program and graphics data
  • Complete Instruction Set - Jumping, branching, and core 6502 operations
  • Debug Output - Built-in debugging tools for development

Technical Implementation

Memory Map

  • $0000-$0FFF: Program memory and general-purpose RAM
  • $1000-$17FF: Bitmap graphics buffer
  • $1800-$180F: 16-color palette (24-bit RGB values)
  • $1810-$FFFF: Extended program space

Graphics System

The emulator uses a memory-mapped graphics approach where writing to memory addresses in the graphics region directly updates the display. The 16-color palette system allows full RGB color definitions, providing more flexibility than authentic 6502-era hardware.

CPU Implementation

Implemented 6502 instructions include:

  • Arithmetic and logic operations
  • Memory load/store operations
  • Jump and branch instructions
  • Stack operations
  • Comparison and bit testing

Development Philosophy

Unlike cycle-accurate emulators that faithfully reproduce historical hardware, EMU6502 is designed as a learning and game development tool. It provides the charm and challenge of 6502 assembly programming while removing the hardware limitations that make authentic development difficult.

Planned Features

  • Subroutine Support - Enhanced function call mechanisms
  • Bank Switching - Memory banking for larger programs
  • Memory-Mapped ROM - Separate ROM/RAM regions
  • Hardware Sprites - Built-in sprite rendering system

Building

git clone https://github.com/DeaSTL/emu6502
cd emu6502
make

Use Cases

  • Learning 6502 assembly programming
  • Developing retro-style games with modern conveniences
  • Understanding CPU emulation concepts
  • Experimenting with low-level graphics programming