Zig implementation of the Eternal Software Initiative VM
Find a file
rodolpheh 3da335ba54
All checks were successful
/ Build executable for Linux x64 (push) Successful in 1m7s
/ Build executable for Windows x64 (push) Successful in 1m9s
/ Build executable for Linux ARM64 (push) Successful in 1m10s
Fix typo in CI matrix
2026-07-21 00:06:35 +01:00
.forgejo/workflows Fix typo in CI matrix 2026-07-21 00:06:35 +01:00
src Only build one IO module 2026-07-20 23:33:07 +01:00
.gitignore Commit kinda working VM 2026-07-07 15:40:57 +01:00
build.zig Only build one IO module 2026-07-20 23:33:07 +01:00
build.zig.zon Make it cross-build for windows and run in Wine 2026-07-16 22:34:43 +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.