<feed xmlns='http://www.w3.org/2005/Atom'>
<title>picow/stub, branch main</title>
<subtitle>Launcher for the PICO-8 Wasm Runtime</subtitle>
<id>http://src.lordello.net/picow/atom/stub?h=main</id>
<link rel='self' href='http://src.lordello.net/picow/atom/stub?h=main'/>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/'/>
<updated>2026-10-17T10:48:53Z</updated>
<entry>
<title>Add Trap Handling</title>
<updated>2026-10-17T10:48:53Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-17T10:48:53Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=1aa6444759c2e564f5b99c0cd65f7c2bb134758a'/>
<id>urn:sha1:1aa6444759c2e564f5b99c0cd65f7c2bb134758a</id>
<content type='text'>
We implemented trap handing with setjmp/longjmp. This _should_ be
very widely supported, but it was _one_ nicety of WAMR: it did
not rely on this mechanism and would instead return errors on
runtime calls in case of a trap.

The implementation is fairly straightforward: we set a global
`jmp_buf` when installing a handler and longjmp in case of a
trap. Note that the handler also keeps the trap code, because
the C standard only requires `if (setjmp(buf))` to be supported,
i.e. "the entire controlling expression of `if`", meaning even
if it does return the code passed to `longjmp`, we can't really
do anything with it.

Added a `Esc` key handler in the PICO-8 stub to check traps
work, and they do :).
</content>
</entry>
<entry>
<title>wire up SDL events</title>
<updated>2026-10-15T07:05:16Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-15T07:05:16Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=f97bb735065392d639462e90d9abd1bb5f738c61'/>
<id>urn:sha1:f97bb735065392d639462e90d9abd1bb5f738c61</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix Byte Order for Surface Pixels</title>
<updated>2026-10-12T18:31:10Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-12T18:31:10Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=e06434fd89345fdc4e931f6fa3904626d75097db'/>
<id>urn:sha1:e06434fd89345fdc4e931f6fa3904626d75097db</id>
<content type='text'>
I went down a deep rabbithole to understand the pixel order, and
it turns out that the Emscripten library code is setting the wrong
`format` value for what it actually uses, which threw me off.

We now set the correct pixel format tag, and handle pixel byte
ordering correctly on the host.

Some other minor fixes.
</content>
</entry>
<entry>
<title>Implement Partial Emscripten SDL API</title>
<updated>2026-10-11T22:13:15Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-11T22:13:15Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=c6f5cca39dad3f395e8b479f6106feb10e710695'/>
<id>urn:sha1:c6f5cca39dad3f395e8b479f6106feb10e710695</id>
<content type='text'>
Start implementing the surface-specific SDL API so that we can get
our stub PICO-8 engine to draw a mouse crosshairs to screen.

The Emscripten runtime still needs its own file, and we need to
convert everything over to `wasm2c`.
</content>
</entry>
<entry>
<title>WASM Main Loop</title>
<updated>2026-09-30T21:24:29Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-09-30T21:24:29Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=38417203681f89ad2d0aae20d8c3aa16c07e786a'/>
<id>urn:sha1:38417203681f89ad2d0aae20d8c3aa16c07e786a</id>
<content type='text'>
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.
</content>
</entry>
</feed>
