diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-09-30 23:24:29 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-09-30 23:24:29 +0200 |
| commit | 38417203681f89ad2d0aae20d8c3aa16c07e786a (patch) | |
| tree | c4da3adb566ad76a88c59534f210cb547535e95e /Makefile | |
| parent | 4c075349a678119cc4bc08e5a969a3c773866cae (diff) | |
WASM Main Loop
Getting the full PICO-8 bindings working right off the bat is way
too daunting: instead create a small stub so that we can wire up
the WASM code to do the main PICO-8 WASM setup:
1. Build the environment (stubbed out for now, but in theory this
would allocate space to store environment variable strings).
2. Call the `_main` function which sets a "main loop" callback;
making sure to allocate memory for `argv`.
And then the main loop: call the main loop callback function with
the Emscripten `dynCall` builtin and then the PICO-8 specific
audio mixing function; this was determined experimentally by
attaching a debugger to a running exported PICO-8 cartridge.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1,9 +1,10 @@ -include config.mk -CC ?= cc -AR ?= ar -HOSTCC ?= cc -PICO8 ?= pico8 +CC ?= cc +AR ?= ar +HOSTCC ?= cc +PICO8 ?= pico8 +WAT2WASM ?= wat2wasm ARCH ?= $(shell uname -m) CFLAGS += -std=c99 -Wall -Wextra -O2 -MMD @@ -65,6 +66,7 @@ $(OUT)/lib/wamr/%.o: lib/wamr/%.c $(SYSTEM)/sysroot.h $(SYSTEM)/sysroot.c: $(TOOLS)/generate-sysroot \ $(SYSTEM)/pico8.data.pod \ $(SYSTEM)/pico8.wasm \ + $(SYSTEM)/stub/pico8.wasm \ $(SYSTEM)/unknown.p8.png @ echo "TOOL\t$(SYSTEM)/sysroot.h $(SYSTEM)/sysroot.c" @ $< $(SYSTEM) @@ -83,6 +85,11 @@ $(SYSTEM)/%.p8.png: carts/%.p8.png @ mkdir -p $(dir $@) @ cp $< $@ +$(SYSTEM)/stub/%.wasm: stub/%.wat + @ echo "WAT2WASM\t$@" + @ mkdir -p $(dir $@) + @ $(WAT2WASM) $< -o $@ + $(TOOLS)/%: tools/%.c @ echo "CC\t$@" @ mkdir -p $(dir $@) |
