Skip to main content

About Hybrix

Hybrix is a small virtual computer you can understand completely. It runs in a web browser and features purpose-built chips such as the Chombit CPU, the Palix 2D graphics unit, and the Jamdac synthesizer. Hybrix Studio is the workshop where you can make anything from video games or electronic music to a spreadsheet app.

The story​

I learned to code on the 8-bit Commodore 64, a computer that was simple enough to understand completely. Later on, I wrote firmware for wireless transmitters, working from circuit diagrams for a custom board. This bottom-up mindset still shapes my work today: although nobody reads "every byte" of a modern TypeScript codebase, in principle I could trace the meaning of any particular byte. That's because the knowledge telescopes back to fully understood foundations, something we call compositional assimilation.

When it came time to teach my son about computers, I struggled to find a coding platform that presents these foundations in an approachable way. We also tried a real Commodore 64, but it was too much effort for a beginner to reach a rewarding result. So I designed a new computer with three aims: you can make an entire program single-handedly, it can look and sound beautiful, and you can understand how it runs... down to bytes and clock cycles! Achieving all three goals took five years and led to a novel CPU, audio chip, assembler, compiler, emulator, and Hybrix Studio, plus six books of documentation. It's all hand-made.

Pete Gonzalez

Pete Gonzalez is the founder of Write 'n' Run, the company that makes Hybrix. He worked as a software architect at TikTok, HBO, and Microsoft, specializing in developer tools that let thousands of engineers collaborate in a single codebase. Earlier, he cofounded the indie game studio Ratloop. Write 'n' Run is based in Seattle and has no outside investors.

From a program down to the hardware​

Making a polished program usually involves navigating an ocean of premade systems. With Hybrix, you can trace your program all the way to the hardware.

Programs worth understanding

Chombit Chess was made using Hybrix Studio. The source code is on GitHub.

Chombit Chess

The gallery has more demo ROMs, from games to tools and music:

Chombimon machine language monitorMandelbrot fractal demoJamdac music

Made using Studio's editors

Quickly create sprite animations, tilemaps, and music using Studio's built-in editors, then arrange them into scenes on a board.

Emit
Emitted Definition
s_door {
  door_id: 1,
  clip_shut: @id_clip_door3_shut,
  x: 13,
  y: 34,
  flip_x: true,
  clip_open: @id_clip_door3_open,
  direction: 3,
  room_item_kind: 1,
  room: @l_1002,
  destination: @l_1005
} at @l_1006

The editors all produce normal data objects that could also be written using code. With boards, you can even decide how a scene becomes data, whether it's a race track, an app window, or a conversation tree.

Compiled into CPU instructions you can follow

Write code using the Hybrix language, a minimalist programming language with familiar features like classes, generics, and memory safety, without giving up direct access to the hardware. One click in Studio reveals the CPU instructions produced from the line you're editing, highlighted side-by-side:

Source code you write
index <- to_byte(index + 1)
if index >= 16
do index <- 0
Compiled CPU instructions
c0_10a5: 88 15 01 add b:21, 1
c0_10a8: 95 15 10 compare b:21, 16
c0_10ab: 08 if less unsigned
c0_10ac: 3c 05 jump near $c0_10b1
c0_10ae: 40 15 00 move b:21, 0

b:21 is the CPU register for the variable index.

Most languages hide the CPU, with the compiler rearranging your code beyond recognition. Everything from the Hybrix language down to the CPU is crafted to reveal how code becomes CPU instructions.

Built on a framework you can read

Newly created projects come with a ready-made game engine, text console, and sound player to help you get started quickly. The framework is open source, so you can learn from it, modify it, or replace it with your own inventions. Studio even shows you the assembly code for the garbage collector that manages memory.

Ever wondered how a garbage collector works? Hybrix's is less than 260 CPU instructions, short enough to read over in one sitting.

Running on the Chombit CPU

In Studio's debugger, you can step through your program, watch the CPU's registers change, and see how many cycles each line takes. The instruction set has 25 instructions, each with a documented machine code and cycle cost, budgeted from 200,000 cycles per video frame.

Studio's debugger: the call stack, the CPU tab with its conventional registers and the framed registers of the current function, and the cycle and heap counters

The CPU tab: conventional registers at the top, the current function's framed registers below.

Chombit's "framed registers" enable a function's stack frame to map directly onto CPU registers, with negative register indexes for function parameters and positive indexes for locals. Every variable has a fixed memory address for its entire lifetime.

Controlling chips and devices

Your program controls the hardware by storing numbers in memory: store $16 at $d0_0300, and the background turns purple. Even music works this way: an instrument is 222 bytes in memory, and your program queues events that tell the Jamdac synthesizer when to play each note.

Memory bytes
# background color
d0_0300: 15
# sprite x, y
d0_0400: 0c 00 08 00 ..
# sprite pixels
10_2000: 00 00 1a 1a 1a 1a 1a 00
10_2008: 00 1a 1a 19 1a 19 1a 1a
10_2010: 00 1a 1a 19 1a 19 1a 1a
10_2018: 00 1a 1a 1a 1a 1a 1a 1a
10_2020: 00 1a 19 1a 1a 1a 19 1a
10_2028: 00 1a 1a 19 19 19 1a 1a
10_2030: 00 00 1a 1a 1a 1a 1a 00
10_2038: 00 00 00 00 00 00 00 00
Video display

Tap a number to change it, or drag the smiley.

Most computers get more complicated the deeper you go, but Hybrix gets simpler: all the hardware definitions fit in a single source file, and you can write a real device driver for saving high scores in about 50 lines of code.

Where to start​

Start simple, even if you've never written code before: draw an animation or compose a song, then try a tutorial. You'll be learning the same language and tooling that made Chombit Chess.

Pure creativity​

Built for focus

The reward is making something you're proud of. We don't rely on psychological bait like points, streaks, or nags. Hybrix Studio has no ads: it's just you and your project. Step away for a month, and everything's right where you left it.

An easy yes for families and schools

Your work stays private until you choose to share it. Personal information is never sold. To protect the privacy of younger people, Hybrix displays nicknames instead of real names, and there's no way for strangers to contact you inside the app. Hybrix is intended for ages 13 and up.

Are you a teacher running a class or camp? You can request free access for your students.

A cartridge with your name on it

A Hybrix ROM cartridge

Release your finished project by exporting a virtual ROM cartridge: an image file depicting a title, your nickname, and a screenshot. The program itself is hidden in the picture's pixel colors. Share the file with a friend, and they can run it using the free player on the Hybrix website. For sharing Jamdac music, you can also export a chiptune file that anyone can play in the free Jamdac Jukebox web app.

The books and web players are free. Hybrix Studio is a one-time purchase of $249. Try it free for 30 days.

See pricing
Start free trial

For interviews, events, or partnerships, write to media@writenrun.com.