---
title: "Running unmodified Doom in the SQLite bytecode language"
description: "Turso compiles unmodified Doom C source to SQLite's VDBE bytecode by using LLVM as a frontend and a custom backend, vdbecc, that lowers LLVM IR to VDBE."
url: "https://swe.quest/articles/running-unmodified-doom-in-the-sqlite-bytecode-language-75f412e9cb0f0591"
canonical: "https://turso.tech/blog/running-unmodified-doom-in-the-sqlite-bytecode-language"
source: "Turso"
published: "2026-07-17"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 12
tags: ["compilers","sqlite","runtimes","storage-engines","c-cpp"]
---

# Running unmodified Doom in the SQLite bytecode language

A post on [Turso](https://swe.quest/sources/turso.md), published 2026-07-17, 12 min read, Deep dive. Original: [https://turso.tech/blog/running-unmodified-doom-in-the-sqlite-bytecode-language](https://turso.tech/blog/running-unmodified-doom-in-the-sqlite-bytecode-language)

## Summary

Turso compiles unmodified Doom C source to SQLite's VDBE bytecode by using LLVM as a frontend and a custom backend, vdbecc, that lowers LLVM IR to VDBE. The VM's unbounded register file removes the need for register allocation, so every SSA value gets its own register. Calls map to Gosub/Return, function pointers become integers dispatched through a binary search, and XOR is synthesized from OR, AND and subtraction. C's address space is a single 64 MiB BLOB row accessed via BlobRead/BlobWrite with a cached overflow-page table, each frame is emitted as a ResultRow from a never-ending SELECT, input arrives as rebound bind parameters, and a save game is just the SQLite database file.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)

## Prerequisites

- LLVM IR and SSA ([easy posts on Compilers](https://swe.quest/tags/compilers.md?difficulty=easy))
- compiler backends
- SQLite VDBE basics ([easy posts on SQLite](https://swe.quest/tags/sqlite.md?difficulty=easy))
- B-tree overflow pages ([easy posts on Storage engines](https://swe.quest/tags/storage-engines.md?difficulty=easy))

## Keywords

Turso, SQLite, VDBE, LLVM, Doom, vdbecc

## Related posts

- [We're building Postgres in Rust. Using the LLVM of databases](https://swe.quest/articles/we-re-building-postgres-in-rust-using-the-llvm-of-databases-e44d34208278a99e.md): Turso · 2026-07-16 · Easy · 11 min read · PostgreSQL, SQLite, Rust, Query engines, Open source
  Turso, a Rust rewrite of SQLite, is adding a Postgres frontend by parsing Postgres SQL into a common AST and compiling it to Turso's VDBE bytecode, turning the engine into an "LLVM of databases" with pluggable frontends.
- [Introducing Limbo: A complete rewrite of SQLite in Rust](https://swe.quest/articles/introducing-limbo-a-complete-rewrite-of-sqlite-in-rust-eb77d828af295b26.md): Turso · 2024-12-10 · Easy · 7 min read · SQLite, Rust, Formal methods, Testing, WebAssembly
  Limbo is Turso's from-scratch rewrite of SQLite in Rust that aims for full language and file-format compatibility, memory safety and a modern architecture.
- [WebAssembly functions for your SQLite-compatible database](https://swe.quest/articles/webassembly-functions-for-your-sqlite-compatible-database-e23432782d9473c3.md): Turso · 2022-11-23 · Medium · 6 min read · SQLite, WebAssembly, Rust, Databases
  libSQL, Turso's open-contribution fork of SQLite, adds user-defined functions written in WebAssembly and registered directly from SQL with a CREATE FUNCTION ...
- [Turso v0.6.0](https://swe.quest/articles/turso-v0-6-0-5eb94c2c93fd0b4b.md): Turso · 2026-05-12 · Medium · 12 min read · SQLite, Databases, SQL, Storage engines
  Turso 0.6 is the first release supporting all major SQLite features, adding experimental multi-process WAL access (OFD locks on Linux, fcntl elsewhere, IOCP on Windows) and VACUUM/VACUUM INTO.
- [Faster schema changes for large SQLite databases](https://swe.quest/articles/faster-schema-changes-for-large-sqlite-databases-4f28e48522ae95e1.md): Turso · 2025-09-02 · Medium · 3 min read · SQLite, Schema migrations, Performance engineering, Rust, Storage engines
  SQLite re-parses the entire sqlite\_schema table after every ALTER TABLE, so schema changes cost time proportional to total schema size even when only one table is touched.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
