Tag: lua
8 posts tagged with "lua".
Nine FPS under the clouds
Cattle Crisis opened its first level at 9 FPS on the H753. One day of hardware A/Bs later it holds 58, Dank Tomb stopped dying of OOM, and the biggest single win was a compiler flag I should have set weeks ago.
The Default Flips
Stage 9: the fixed-point core becomes THE runtime. Getting there took an executor split, a clock experiment, two optimisations executed for measuring zero, a one-byte regression that cost 19 carts, and a PLL trick that ended the night at 59fps on jumper wires.
The Ghost, the Ladder, and the Cartridge
One evening, three fronts: a haunted iterator that cloned the player, a link clock ladder re-measured rung by rung, and a physical cartridge that finally keeps its saves.
The Swap, Measured
z8lua lands behind a flag: a bug class from a C port, an allocator caught red-handed on the pad, a licensed PICO-8 pressed into service as an oracle, and a compatibility matrix instead of a feeling.
Measure First: the Runtime Baseline
Before any z8lua code lands, Stage 1 of the runtime migration: a permanent benchmark instrument, input tapes recorded from real play, and the numbers the new VM has to beat.
Why I Didn't Replace the PICO-8 Runtime
I sat down to decide whether the homegrown PICO-8 runtime should be replaced with an existing emulator. Twenty-one test cartridges, four codebase teardowns and two cross-compiles later, the answer was: keep everything, swap one organ.
A divide per pixel
Once the SPI panel was off the critical path, the frame became the cart's own Lua and the slow part moved inside it. A missing string builtin, then the real prize: a stretched-sprite blit doing an integer divide per pixel on a chip with no fast divide. The profiler found it; the obvious guess was wrong. About 41fps to about 58fps.
Running real PICO-8 Lua on a Cortex-M7
Vendoring Lua 5.4 into a bare-metal firmware, the 64-bit integer bug that printed 42 minus two-to-the-32, and why a hardware watchdog beat an instruction-count hook for stopping runaway carts.