Operating systems & low level
Rust · x86_64 · limine
a hobby operating system, held together by duct tape
A kernel written from scratch in Rust, booted with Limine. It has a
terminal emulator, serial IO, interrupt handling, five different timer
sources (PIT, TSC, KVM, HPET and LAPIC), a real time clock, memory
management, PS/2 keyboard and mouse drivers, ACPI, basic PCI, a shell
and a RAM filesystem — plus a preemptive scheduler, single core
for now.
Next on the list: NVMe, USB, a libc port, and more architectures than
just x86_64.
Rust · Shell · distro
a Linux distribution assembled from source, package by package
A from-scratch distribution I contribute to. Every package is a recipe
— a pkg.json declaring its version and dependencies,
next to a shell script that points at an upstream tarball and defines how
to configure, build and install it. A Python front end draws a curses menu
of the whole recipes/ tree and builds whatever you tick.
Around thirty packages so far: glibc, the Linux kernel, the Limine
bootloader, bash, coreutils in both the GNU and the Rust flavours, OpenSSL,
curl, ncurses and the usual compression zoo.
Most of my work on it has been packaging — curl, OpenSSL, zlib,
libcap, libidn2, ca-certificates, xz, zstd, lz4, bzip2, libseccomp, file
and micro — plus the kernel config, wiring up uutils as an
alternative coreutils, and teaching the builder to skip anything it has
already built.
I also rewrote
ferris-strap in
Rust. You hand it a JSON config listing the packages you want and a repo to
pull recipes from, and it produces a minimal Ferris Linux environment you
can chroot into — roughly what debootstrap does for Debian.
Rust · bare metal · Bevy ECS
Flappy Bird, except it's an operating system
There is no OS under this game, because the game is the OS. It boots
straight into Flappy Bird: framebuffer driver, serial IO, interrupts,
timers, a memory allocator and a PS/2 keyboard driver underneath, with
the game itself running on Bevy's ECS — state management, basic
2D physics, sprite rendering, score and game over screens.
Inspired by
TetrisOS.
Rust · emulation
the CPU behind the NES and the Commodore 64
An emulator for the MOS 6502: the accumulator, index registers, stack
pointer and program counter, the full processor status register modelled
as bitflags, and a flat 64 KiB address space that instructions
decode and walk through one step at a time. A very direct way to learn
what a CPU actually is.
Languages & compilers
Rust · LLVM · compiler
my own programming language, front to back
A complete compiler pipeline written in Rust: a lexer, a recursive
descent parser, a semantic analyzer, and then two backends — a
tree-walking interpreter, or LLVM codegen that compiles the whole thing
down to native machine code.
The language itself has explicit and inferred types, functions with
arrow return types, implicit returns and formatted printing:
func add_three(i32 x, i32 y, i32 z) => i32 {
return x + y + z;
}
func main() => i32 {
let output: String = "the result";
let x: i32 = 21;
let y = -69; // inferred
print("{} is: {}", output, add_three(x, y, 420));
}
Graphics & simulation
The recurring theme: take something from a paper or a video, get it
working, then find out how fast it can be made to run.
Rust · CPU · GPU
rendering by following light around
A ray tracer written on the CPU first, so that every part of it —
ray generation, intersection, bounces, materials — had to be
understood rather than handed to a library. Inspired by
Sebastian Lague's video.
When the CPU version got too slow to iterate on, I wrote
a GPU version
in a compute shader, along with
a voxel variant
and a path tracer.
Rust · GLSL · SDF
rendering shapes defined by distance, not triangles
A real-time ray marcher running in an OpenGL compute shader through
glium. Instead of geometry, the scene is signed distance
functions — spheres blended with a smooth minimum, so they melt
into each other rather than intersect — and each pixel steps a ray
forwards until it hits something.
It renders into a texture at up to 1000 iterations per ray, with a free
flying camera and mouse look, so you can move through the scene while
it's being marched.
Rust · GLSL · compute
15,000 particles that never touch the CPU
Positions and velocities live in GPU buffers, a compute shader integrates
them every frame, and a vertex and fragment shader pair draws the result
— the CPU only sets up the camera and gets out of the way. With a
free flying camera to fly through the middle of it.
Rust · wgpu · WGSL
what light does when it gets too close
A simulation of rays bending through the gravitational field around a
black hole, written with wgpu and WGSL. Each ray carries a
trail of its last 64 positions, so the curve it takes stays visible as it
falls inwards, and a compute shader paints the whole field into a storage
texture every frame.
Rust · CPU
3D rendering with the GPU deliberately left out
A software rasterizer: softbuffer hands it a raw window
framebuffer, and everything after that — loading the model,
transforming vertices, projecting them and filling triangles pixel by
pixel — is done by hand on the CPU.
It loads models through
whirlwind_obj, an
OBJ parser I wrote for my engine, which meant one less dependency and one
more thing to debug.
Rust · wgpu · wasm
a small engine, written to find out how engines work
A renderer and engine built on wgpu, with its own ECS
— entities, components and a world to store them in — rather
than pulling one in. It handles textures, WGSL materials and model
loading through its own OBJ parser.
The same codebase compiles to a native desktop app, to WebAssembly for
the browser through wasm-bindgen, and to Android via winit's
native activity support.
Games
Rust · Bevy · voxel
a blazingly fast voxel game in pure Rust
A voxel sandbox built on Bevy: a culled mesher that keeps chunk rebuilds
cheap, procedural terrain generation with biomes, a first person character
controller, block placing and breaking, saving and restoring the world,
and Ferris entities wandering around in it.
There is also
an earlier version
where I wrote the voxel engine myself in OpenGL, before moving to Bevy.
The TODO list currently reads "greedy meshing or something" and "make it
into minecraft", which feels about right.
Rust · wgpu · shaders
chess, but rendered on the GPU with far too many effects
A chess game that pushes rendering onto the GPU so it can afford some
genuinely unnecessary shader effects. You can hand it a custom FEN string
on startup to begin from any position. The rules engine is, by my own
honest assessment, spaghetti — but it plays.
The plan is to move the game logic itself into compute shaders, which is
either a great idea or a terrible one.