MOS tech 6502 8-bit microprocessor in pure SQL powered by Postgres

A new open-source project implements a full MOS 6502 CPU emulator within PostgreSQL, utilizing database tables for registers and memory, and stored procedures for opcodes.
MOS 6502 CPU emulator running entirely in PostgreSQL. CPU registers, flags, and 64KB memory are database tables; every opcode is a stored procedure.
# Start PostgreSQL
docker compose up -d
# Load schema and test binary
make reset
# Run Klaus 6502 Functional Test
make test
| Table | Description |
|---|---|
| pg6502.cpu | Single row: A, X, Y, SP, PC + status flags |
| pg6502.mem | 64KB of memory, one row per byte |
- PostgreSQL 16+
- Docker
MIT License — see LICENSE file.
Source: Hacker News















