Zig implementation of the Eternal Software Initiative VM
  • Zig 93.2%
  • Odin 6.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
rodolpheh e976c52bfe
Some checks failed
/ Build executable for Linux x64 (push) Has been cancelled
/ Build executable for Windows x64 (push) Has been cancelled
/ Build executable for Linux ARM64 (push) Has been cancelled
Exhaust event poll to avoid latency
2026-08-07 13:34:45 +01:00
.forgejo/workflows Fix typo in CI matrix 2026-07-21 00:06:35 +01:00
src Exhaust event poll to avoid latency 2026-08-07 13:34:45 +01:00
.gitignore Commit kinda working VM 2026-07-07 15:40:57 +01:00
build.zig Add Zig-built SDL and statically link 2026-08-06 18:38:01 +01:00
build.zig.zon Add Zig-built SDL and statically link 2026-08-06 18:38:01 +01:00
README.md Update README 2026-07-20 23:33:16 +01:00

Eternal Software Zig VM

Static Badge

This is a Zig implementation of the Eternal Software Initiative VM.

To make it more "flexible", and to learn, input and display are provided through a dynamically loaded library. There are currently only two possible implementation

  • stdio: input is provided through stdio (Windows not supported), and output through stdout, each frame provided as a PPM image. It can be piped to ffplay with the following command: LD_LIBRARY_PATH=./zig-out/lib ./eternal-vm vmlinux.bootimage | ffplay -autoexit -f image2pipe -framerate 30 -probesize 32 -vf "scale=800:522:flags=neighbor" -hide_banner -loglevel error -i -
  • fensterl: keyboard input is about 80% supported. Should work on Linux (X11), Windows, and MacOS. Only works on Linux so far.

Build and use

The build.zig file will build the main executable, the dynamic libraries, and the original (console only) code.

# Build a small executable, it is roughly as fast as ReleaseFast. Use the fensterl module.
zig build -Doptimize=ReleaseSmall

# Run the mandelbrot program
LD_LIBRARY_PATH=./zig-out/lib ./zig-out/bin/eternal-vm mandelbrot.bootimage

Implement an IO module

You can implement your own module, it should implement the following methods:

*void init();
void deinit(ctx: *void);
void setDisplay(ctx: *void, data: *uint32_t);
int32_t getInput(ctx: *void);

Then build it and name it libevmio.so or evmio.dll depending on your OS, put it along the executable and launch your capsule.