GitHub - lasect/pg_6502: the MOS tech 6502 8-bit microprocessor in pure SQL powered by postgres

1 min read Original article ↗

Skip to content

Navigation Menu

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

MOS 6502 CPU emulator running entirely in PostgreSQL. CPU registers, flags, and 64KB memory are database tables; every opcode is a stored procedure.

Quick Start

# Start PostgreSQL
docker compose up -d

# Load schema and test binary
make reset

# Run Klaus 6502 Functional Test
make test

Architecture

Table Description
pg6502.cpu Single row: A, X, Y, SP, PC + status flags
pg6502.mem 64KB of memory, one row per byte

Requirements

  • PostgreSQL 16+
  • Docker

License

MIT License — see LICENSE file.