A toy RTOS inside Super Mario Bros. using emulator save states
Published on: 2025-06-17 00:15:43
This is another post about programming, which I almost never write about.
Click here to jump straight to trying this thing out for yourself.
In my previous post on Threads, I made an offhand comparison:
Threads are just emulator save states, coupled with a condition upon which they will be resumed.
At the time, I thought this a pretty okay analogy — but I couldn’t stop thinking about it. I’ve been turning it around in my mind for a while. I think it has serious untapped potential as a pedagogical tool.
So I added multithreading to Super Mario Bros. for the NES.
The Thing Itself
No buried ledes here.
What It Is
I should explain myself.
What you just watched happens to be a multithreaded NES emulation, with Super Mario Bros. as the threads.
There are three “threads” running, each a distinct instance of the game. Every so often, the emulator switches “threads”, swapping to a different instance of the game.
Each “thread” is assigned a different color palette, which we apply whe
... Read full article.