Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

Commodore 64 Basic for PostgreSQL

A developer has created a PostgreSQL extension that loads Commodore 64 BASIC, allowing users to write stored procedures and functions using the retro BASIC v2.0 language directly within the database.

Background

- Thom Brown, a PostgreSQL contributor, created `plcbmbasic81` — an extension that lets you write stored procedures in Commodore 64 BASIC, faithfully emulating the 1980s home computer's BASIC v2 interpreter inside the database. - This is not mere nostalgia: PostgreSQL's extensible language framework (`CREATE LANGUAGE`) allows any language with a handler to run as a procedural language. This extension slots into that system, meaning modern SQL queries can call C64 BASIC routines that use `POKE`, `PEEK`, `GOTO`, line numbers, and `SYS` calls. - The post demonstrates installing the extension, writing BASIC functions that return PostgreSQL types, and using `LOAD` to import external `.prg` files — including an example reading a UUID from the C64's emulated I/O memory map. - The project makes a serious technical point about how far PostgreSQL's architecture can be pushed, while letting retrocomputing enthusiasts run authentic C64 code server-side.