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

https://github.com/lasect/pg_6502

Article

  • Full 6502 CPU emulator implemented in PostgreSQL PL/pgSQL stored functions
  • Uses a 64KB memory table and single-row register table; executes opcodes procedurally
  • Can run 6502 binaries entirely within Postgres

Discussion

  • Praised as creative absurdity; A+ for perversity
  • Requests for SQLite3 port and Applesoft BASIC running through SQL
  • eatonphil linked his own PL/pgSQL Forth-like language as a simpler prior art
  • “Waiting for 6502 implemented on top of Sudoku” — top joke

Discuss on HN


Type Link
Added Apr 15, 2026
Modified Apr 15, 2026