GitHub

About ChaosDrive

ChaosDrive is a virtual circuit-bending playground for the Sega Genesis. It runs a full Genesis emulator (Genesis-Plus-GX compiled to WebAssembly) in your browser, then lets you jam a virtual screwdriver into its internals in real time.

How It Works

The emulator’s video, audio, and CPU memory are all exposed to JavaScript through the WASM heap. Each chaos key directly mutates the emulator’s internal state — the same bytes a real chip would read — so every glitch you see is the hardware faithfully rendering corrupted data.

Notable Effects

VRAM Shifts — Tile and sprite graphics live in Video RAM as 8×8 pixel patterns. Shifting VRAM by a few bytes scrambles which tile maps to which pattern, smearing the whole scene like a broken CRT.

CRAM Corruption — The Genesis stores its 64-color palette in Color RAM (CRAM). Randomizing or rotating these entries swaps every on-screen color at once, creating psychedelic palette cycling.

VSRAM / Column Melt — Vertical Scroll RAM controls how far each 2-tile column is scrolled. Corrupting it makes columns slide independently, giving the classic “melting screen” look.

H-Scroll Waviness — The VDP supports per-scanline horizontal scroll offsets. Writing random values here warps each line left or right, producing a wavy, heat-shimmer distortion.

FM Corruption & Bitcrush — The YM2612 FM synth chip has operator registers controlling frequency, feedback, and envelope. Corrupting these detunes notes and creates harsh metallic timbres. Bitcrushing zeroes out low bits of the audio buffer for lo-fi distortion.

CPU Mayhem — Incrementing the 68000’s program counter or flipping its registers makes the CPU execute from the wrong address, often causing the game to spiral into uncharted code paths.

Tech

Emulation: C → Emscripten → WebAssembly
Rendering: Canvas 2D (raw VRAM → ImageData @ 60 fps)
Audio: Web Audio API (44.1 kHz, stereo)

Where to Get ROMs

You need a Sega Genesis/Mega Drive ROM file (.bin, .md, .smd, .gen) to use ChaosDrive. Here are some examples:

Sonic the Hedgehog
archive.org — Classic first thing to try
Archive.org Genesis Collection
Search for more Genesis ROMs

Screen Size

ChaosDrive Controls

Emulator

ASDA / B / C buttons
D-Pad
EnterStart
TabReset (clear all hacks)

VRAM Manipulation

OShift VRAM up
LShift VRAM down
KShift VRAM left
;Shift VRAM right
IShift VRAM random amount
PCorrupt one VRAM byte
\Invert all VRAM

CRAM / Colors

[Randomize CRAM
]Shift CRAM up
YPersistent CRAM corruption ON
UPersistent CRAM corruption OFF

Sprite / Scroll

QCorrupt VSRAM (column melt)
WH-scroll waviness (wobble)
RFuzz scroll registers
TScramble sprite attributes

Audio

XEnable FM corruption
CDisable FM corruption
VCorrupt DAC/PCM data
BBitcrush audio
NDetune FM channels
ZPSG noise blast
,Shift Z80 audio mem up
.Shift Z80 audio mem down

General Mayhem ⚠

FCorrupt 68K RAM byte
GScramble critical RAM
HIncrement program counter
JCorrupt random register
EFlip VDP display mode
/Flip game logic variables

Utility

1Save screenshot to downloads

ChaosDrive