| Age | Commit message (Collapse) | Author |
|
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 :).
|
|
|
|
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.
|
|
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`.
|
|
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.
|