<feed xmlns='http://www.w3.org/2005/Atom'>
<title>picow/src/picow.c, branch main</title>
<subtitle>Launcher for the PICO-8 Wasm Runtime</subtitle>
<id>http://src.lordello.net/picow/atom/src/picow.c?h=main</id>
<link rel='self' href='http://src.lordello.net/picow/atom/src/picow.c?h=main'/>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/'/>
<updated>2026-10-29T10:31:08Z</updated>
<entry>
<title>Implement Cart Shutdown</title>
<updated>2026-10-29T10:31:08Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-29T10:31:08Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=f9950fce6f7b7a3743920f0d787fb1857aa05769'/>
<id>urn:sha1:f9950fce6f7b7a3743920f0d787fb1857aa05769</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Multicart Loading with BBS</title>
<updated>2026-10-27T14:26:20Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-27T14:26:20Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=8dda4698251ac7c724005a158d9c11e90a44c7e9'/>
<id>urn:sha1:8dda4698251ac7c724005a158d9c11e90a44c7e9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Implement Audio Device and Remaining ASM Consts</title>
<updated>2026-10-26T07:42:53Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-26T07:32:08Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=4957ca8373273721017fc8106b52d5bc6b2a0180'/>
<id>urn:sha1:4957ca8373273721017fc8106b52d5bc6b2a0180</id>
<content type='text'>
We abstract over SDL's audio subsystem and implement an audio
device that fits into PICO-8's model. We fixed the implementation
for the PICO-8 window focus and key buffer and can now actually
boot into PICO-8 games with working sounds and controls!

There are a few issues that remain:

1. There is no "exit" option in the pause menu, I think it thinks
   that we are on the BBS, and maybe there is someway to fix this?
2. The clipboard textarea is not implemented at all; we should
   keep a text buffer in `pw_input` and interact with SDL's
   clipboard system
3. Multicart's don't always work; in particular Undune II tries
   to download from the BBS, I would like to shim this somehow
   to support both `LOAD("FOO.P8")` and `LOAD("#FOO")` forms
   transparently.
</content>
</entry>
<entry>
<title>Improve Gamepad Handling</title>
<updated>2026-10-24T08:48:45Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-24T08:48:45Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=02da08e9d84371c558da6347210c00e3966f2dc5'/>
<id>urn:sha1:02da08e9d84371c558da6347210c00e3966f2dc5</id>
<content type='text'>
There were a few cases where we would have stale input information
becaues the `pw_input` only receives events while the game is
running. This fixes that by:

- Reseting the player count on game start
- Clearing button states for disconnected players
- Improve handling of the POOM player 2 support in case a second
  player connects
</content>
</entry>
<entry>
<title>Various Small Bug Fixes</title>
<updated>2026-10-23T21:03:39Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-23T20:07:14Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=1c4eada99c6f98eae40c676d261c8d4fc1de6079'/>
<id>urn:sha1:1c4eada99c6f98eae40c676d261c8d4fc1de6079</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Started Implementing ASM Constants</title>
<updated>2026-10-19T20:47:49Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-19T20:47:49Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=312c3c345b5b72a69ba6ee1bf50697eed18c2775'/>
<id>urn:sha1:312c3c345b5b72a69ba6ee1bf50697eed18c2775</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Refactor Multicart Loading</title>
<updated>2026-10-19T18:55:01Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-19T18:55:01Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=381e246e73f271be2821dd9208edd2aa09bfc583'/>
<id>urn:sha1:381e246e73f271be2821dd9208edd2aa09bfc583</id>
<content type='text'>
When starting to implement the ASM constants, I noticed that the
multicart support would be _WAYYYYY_ easier if all the multicarts
are just passed in as embedded cart data.

Here, we modify the cart module to introduce a new "cartdat" type
that represents a cart export (either a single cart, for the regular
case, or multiple carts for the multicart case). This simplifies
lots of code, and allows us to use the ASM constants for passing in
cart data without additional glue logic.

It mimics how the PICO-8 export works for multi-cart code as well.

Lastly, cart names now include the `.p8` extension in the name,
to match how they work with the multicart export. I'm not sure how
this will interact with splore multi-cart loading (i.e.
`LOAD("#SOMECART")`).
</content>
</entry>
<entry>
<title>Minor Bug Fixes</title>
<updated>2026-10-18T11:51:41Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-18T11:51:41Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=0783cdf83f98bb8e1359892fa318b93f71d10b44'/>
<id>urn:sha1:0783cdf83f98bb8e1359892fa318b93f71d10b44</id>
<content type='text'>
</content>
</entry>
<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>Use `wasm2c` instead of WAMR</title>
<updated>2026-10-17T08:52:27Z</updated>
<author>
<name>Nicholas Rodrigues Lordello</name>
<email>n@lordello.net</email>
</author>
<published>2026-10-17T08:52:27Z</published>
<link rel='alternate' type='text/html' href='http://src.lordello.net/picow/commit/?id=d3c95fce3f5c8b910d3dc04ed5d8c1673944baf0'/>
<id>urn:sha1:d3c95fce3f5c8b910d3dc04ed5d8c1673944baf0</id>
<content type='text'>
Instead of interpreting Wasm, compile it ahead of time to C and
run that instead:

- it is much faster (no interpreter overhead)
- it is easier to implement host functions, they are just C calls

This works well for us since we only ever load a single Wasm blob
(the PICO-8 runtime that `picow` is built with).

There was some fun figuring out how big-endian stuff works (WRT
memory layout), but otherwise it was pretty straight forward.

Note that traps are still not working, I need to figure that out
still...
</content>
</entry>
</feed>
