shazz/ZigMachine
A FantasyConsole compiled as WebAssembly and written in Zig
A Fantasy Console (or Fantasy Computer, not sure) written in Zig and running in the browser as a Web Assembly binary. The ZigMachine is dedicated to provide a fun sandbox to learn how to code oldskool effects as no advanced features are provided, only the basics of the 80s computers and video game consoles.
This project is inspired by WAB and CODEF by my friend NoNameNo who... already more than 10 years ago... provided a way to code oldskool effects in the browser without Flash but only HTML5 and javascript. Time to go one step further. 0% Flash, 0% HTML, 0% Javascript, only Zig!
Screenshots and live version below!
Live website with the latest build: ZigMachine (Click on the + and - buttons to change channels!)
The specs of the ZigMachine will definitively evolve over time but for now they try to match what I would have loved to get in the 80-90s:
In addition to the fantasy console and the ZigOS, a library for classic oldsk00l demo effects is provided featuring:
I started to port some of my favorites Atari and Amiga cracktros (from WAB) to show how to use the ZigMachine. Check the source code and the channels in the live demo.
For the moment, only Zig is supported to code stuff on the ZigMachine (so the name...) but maybe one day, some custom 68K like assembly code or probably inline Web Assembly. Who knows :) Want to add things? Please leave a message in the Discussions
The project status is available here: https://github.com/users/shazz/projects/2/
The default (and only) target for this build is wasm32-freestanding-musl
.
To build the wasm module, run:
For Web Assembly
% zig build -Drelease=true -Dwasm
Note: build.zig
specifies various wasm-ld parameters. For example, it sets the initial memory size and maximum size to be xxx pages, where each page consists of 64kB. Use the --verbose
flag to see the complete list of flags the build uses.
Start up the server in the html directory:
cd docs
python3 -m http.server 3333
Go to your favorite browser and type to the URL http://localhost:3333
or http://localhost:3333/debug.html
for a debug view of each logical framebuffer.