gotnull

All posts

75 posts so far, newest first.

2026 73 posts

7 min Ghostveil Looking down through every portal Ghostveil's portal views now look down at the floor the way the room's own camera does. Most of the day went on deciding where Fantasma's feet belong in that view. 10 min Ghostveil Looking through a portal Ghostveil's portals project pixel artwork without scaling it. The same geometry lets the renderer skip drawing surfaces outside the view. 8 min Ghostveil Finding rooms that need both players Random search found 7 co-op rooms in four five-minute runs. Repairing the near misses, and aiming each repair at the solver's own shortcut, found 39 in the same time. 9 min Ghostveil Turnstiles that steer the fire Three Ghostveil rooms with no stones in them, where turning a turnstile changes where the fire runs. The generator has to prove the fire must move during the walk, and that each room has a wrong turn worth avoiding. 7 min Ghostveil Casting Fantasma's shadow Fantasma's shadow in Ghostveil is now cast by the room's light from her own outline in every frame, round and centred under her, and every shadow in a room is half as long as it was. In a small room, Fantasma pushes a pillar up into a pit that cuts a blue fire channel; it drops, bounces and sinks flush, and only then does the pit light blue, the spikes beyond it sink and the door opens; she then steps onto the filled pit, walks along the channel over the sunk spikes and out through the door 6 min Ghostveil Letting the pillar land first In Ghostveil's fire rooms the pit lit up and the door opened as soon as a pillar was pushed towards it. Now the room waits until the pillar has dropped, bounced and settled. 6 min Ghostveil Giving the rune pools a chapter Ghostveil's rune pools got five campaign rooms of their own, and the generator only kept a room that stopped working with the water held either way. 10 min Ghostveil A pool you can drain Ghostveil's rune pool is water Fantasma can wade until something weighs its drain plate, and then an open pit with live runes at the bottom. 4 min Ghostveil The fire stops killing Ghostveil's blue fire used to kill on contact and refuse moves for reasons nobody could see; now it only powers things, and spike floors carry the danger. 4 min Ghostveil Dropping a stone into a pit A stone in Ghostveil now drops into a pit like a slab of concrete, and counting its bounces once froze the game. 6 min Ghostveil Pulling the rules out of the game Ghostveil's puzzle rules move into plain Dart, and a solver finds the shortest solution to every room. Source-derived diagram of the reviewed normal draw and conditional drawing-buffer route 3 min Clutch Cargo Searching the instrument cluster for a drawing route An exact-image search for custom pixels in the J285 cluster closed one promising callback and found a conditional drawing-buffer route with a harder timing problem. 8 min Clutch Cargo Getting out of the reversing camera's way ClutchOS covered the reversing camera the first time I selected reverse with Home open. The fix is a small window manager that follows the factory camera request. 18 min Clutch Cargo A Home screen for ClutchOS Holding HOME on the pad now opens a Home screen instead of dropping into ES-DE. Built and tested on the Mac; the car has not seen it yet. 9 min Clutch Cargo Choosing emulator cores by running every game on the card Five of the head unit's emulator cores came from a microcontroller project. I replaced four of them, chosen by running every game on the card and timing the winners on the car's own Cortex-A9. 3 min Clutch Cargo Battery saves that survive the emulator A shared save module restores exact-size battery RAM, writes it only when it changes, and keeps the previous image as a recovery copy. 4 min Clutch Cargo A one-millisecond sleep that rounded every frame late Replacing a millisecond sleep with a microsecond deadline removed frame overruns in three hosts. Master System's fast Z80 had never reached the QNX build. Startup and core-rate measurements 5 min Clutch Cargo The 92-second return to the game library The library took 92 seconds to come back after every game. The first plausible fix did nothing; two metadata walks and an eager collection were the cause. 5 min Clutch Cargo Game audio on a MIB2 Finding the route that puts SNES audio through the dashboard speakers, and the 92-second library load it exposed along the way. 7 min Clutch Cargo Why the game library ran at 15 fps on the dashboard I blamed the display, then the textures, and both times I was wrong. Isolating one variable at a time found eight bits of shader arithmetic. 10 min Clutch Cargo Porting ES-DE to ARM QNX Cross-compiling the ES-DE frontend for the MIB2 head unit, and what the first native runs got wrong. 10 min Clutch Cargo Eleven emulators on the head unit Rusty Nail became a QNX launcher for eleven emulator paths on the MIB2. N64 failed on performance and then on a graphics plugin abort. 8 min Clutch Cargo A safe route into the factory menu, and reading a gamepad over USB A one-word menu retarget froze the MIB2 twice before revealing the rule for a safe route. Nineteen USB runs later SMB3 accepted controller reports. Measured NES core cadence and 400 by 240 mirror progression. Core callbacks and P4 presentation submissions are different measurements. 9 min Clutch Cargo NES on the dashboard, and mirroring the screen to the P4 A native NES core reaches nominal cadence on the MIB2, and the factory screen reaches the P4 panel as live video at 54.59 fps. 10 min Clutch Cargo Getting inside a MIB2 Three days from a locked Volkswagen head unit to a root Telnet shell and the first native frame on its display. 10 min Clutch Cargo A phone app for the dashboard panel A phone app that talks to the dashboard panel rather than the car, and the fault codes a battery disconnect wrote into eight modules. 10 min Clutch Cargo Folding mirrors on lock Reading the driver door module's memory, backing it up twice, and changing three bytes so the mirrors fold when I lock the car. Every refusal and dead end is in the record. 13 min Clutch Cargo The car ignores UDS and answers TP2.0 The first bytes the adapter ever sent me, and the discovery that the car ignores UDS and answers an older Volkswagen transport instead. 8 min Clutch Cargo Pairing an ESP32 with an OBD-II adapter over BLE Two days getting an ESP32 to talk to an OBD-II adapter over Bluetooth Low Energy. Everything negotiated correctly and not one byte arrived. The identity exchange: one command byte out, a coalesced stream back 9 min Rusty Nail Reading a Game Boy cartridge through a GBFlash The console's USB host port meets a cartridge reader that pretends to be a CH340 serial chip. By the end of the day the firmware read and validated a real cartridge header. 12 min Brain Drain Decrypting an EMOTIV EPOC headset without the vendor software Getting a 2013 EEG headset to emit packets and then decrypting them, once I stopped trusting the documentation and scored candidate keys against real data. 8 min Rusty Nail Speculative execution against the SNES sound chip The SNES core was losing four million cycles a frame waiting on a sound chip on another board. Predicting the answer lifted Super Mario World from 35 to about 50 fps. 8 min Rusty Nail A flight recorder for firmware Building a recorder that captures a good run and a bad run of the same firmware workload so a tool can find the first difference that matters. 8 min Rusty Nail Proving where the SNES bottleneck was Days optimising the HDMI coprocessor because every symptom said it was holding the SNES back. The measurements pointed at the wire instead. 9 min Rusty Nail The RP2040 as a SNES sound chip, at 97 per cent of realtime Two bodge wires taught the HDMI coprocessor to talk back and run the SNES sound chip with real Super Mario World music. It reached 97 per cent of realtime. Five levers priced on the H753: average and p99 cycles per frame per stage, against the 6.39M gate 9 min Rusty Nail Profiling the SNES core on the H7 The from-scratch SNES core matches the reference emulator to the cycle. Five optimisations measured on hardware, and a profiler that says the problem is memory. 10 min Rusty Nail The Amiga gets a mouse and boots Turrican II Mouse input for the emulated Amiga, then a commercial game whose custom trackloader refused to work until the floppy drive learned to spin. 7 min Rusty Nail The emulated Amiga boots Workbench 1.3 The Amiga core on the STM32H753 boots a real Workbench 1.3 floppy to the desktop, and what it took to get the floppy controller right. 13 min Rusty Nail A desktop flasher for the cartridge A host tool that turns one ROM into the matching H7 runtime, RP2040 receiver and cartridge image, and refuses to declare success until the cart reads back the exact bytes. 9 min Rusty Nail Kickstart 1.3 runs under budget on the STM32H753 First hardware numbers for the Amiga core: a real Kickstart 1.3 ROM executing deterministically at a p99 of 2.51M cycles per PAL frame, against a gate of 3.35M. 11 min Rusty Nail Mega Drive emulation over an 8 MHz jumper-wire link A Mega Drive emulator on a 480 MHz Cortex-M7 with perfect music beside a screen that tore in half. The fix was to make a slow frame arrive atomically. Probe 3's measured timeline: pattern 0 holds two non-looping sfx (short one leftmost) and ends at 2.1s; pattern 2 holds two looping sfx (short one leftmost) and ends after the longer channel; the end-loop flag then replays the opening exactly on schedule 7 min Rusty Nail Why Celeste sounded wrong The cart was byte-identical to the BBS copy, so the fault was in the synth: a music clock cutting bars to a quarter, and a noise fit matched to the wrong metric. 10 min Rusty Nail Planning USB floppy support Four transport dialects from 1998 and a FAT12 layer nobody ships, which is why the first firmware milestone is just reading descriptors. 6 min Rusty Nail The console's second shell Two days building the console's second shell, including a crash hunt that ended eight kilobytes from the stack floor. 10 min Rusty Nail Cattle Crisis from 9 fps to 58 One day of hardware A/B tests on the H753. The biggest single win was a compiler flag I should have set weeks ago. 8 min Rusty Nail Game Boy first light Two days from a feasibility study to DMG code on the TV, with the console's SPI video wire carrying two frame geometries at once. 14 min Rusty Nail A crash reporter for a bare-metal console Giving the console a crash reporter that survives the reset and emails me, and the ways an STM32H7 loses data across a warm reset. Pixel-exact re-render of all seventeen demos cycling in the 9x9 square 8 min Rusty Nail A 9 by 9 demoscene square in the launcher header The launcher's blinking sparkle became a 9 by 9 pixel demoscene with seventeen tiny effects dealt from a shuffled deck. 5 min Rusty Nail Redesigning the cartridge shell around the label The 3D-printed cartridge shell gets a flush sticker pocket and a chamfered corner, test-fitted virtually before printing anything. 7 min Rusty Nail What all the wires are for A tour of Rusty Nail as it stands, from the OS on screen to the four breakout boards and the cartridge shell with a 16 MiB flash chip inside. 12 min Rusty Nail A 3x palette scanout for the HDMI picture The HDMI picture was pixel-perfect and still looked soft. A full-resolution palette scanout fixed that, after an afternoon lost to a heap that only sometimes existed. 8 min Rusty Nail Why the speakers started clicking The morning after deleting the old Lua core, everything played and then the speakers started clicking. A command trace found three lines of channel semantics and a missing crossfade. 6 min Rusty Nail The fixed-point Lua core becomes the default Stage 9 of the runtime migration, ending the night at 59 fps on jumper wires after a one-byte regression that cost 19 carts. Link clock ladder: 6.4MHz clean at 45fps, 7.38MHz clean at 52fps, 8MHz reaches 60 but with a bad line every frame, 12.5MHz locks nothing 8 min Rusty Nail An evening of unrelated fixes Three unrelated fixes from one evening. The biggest was a cartridge that finally keeps its saves; the strangest was an iterator that duplicated the player. 6 min Rusty Nail z8lua lands behind a flag The new Lua core measured against the old one on identical silicon, with a licensed PICO-8 as the oracle and a per-cart compatibility matrix. 7 min Rusty Nail A runtime baseline before the Lua swap A permanent benchmark and input tapes recorded from real play, so the new Lua VM has numbers to beat before it lands. 10 min Rusty Nail Why I didn't replace the PICO-8 runtime Whether the homegrown PICO-8 runtime should be replaced with an existing emulator. After twenty-one test cartridges the answer was to keep everything and swap the Lua core. 4 min Rusty Nail Threading the HDMI funnel by hand The eight wires into the HDMI connector were the one part of the board I had decided to hand off. A script almost did it, then KiCad's push-and-shove router did. 10 min Rusty Nail Getting console frames onto the Feather RP2040 DVI Two days between the H7 and a real HDMI picture, including a missing ground return and a clock divider that misreported its rate. The sixteen PICO-8 palette colours as vertical bars with a white box bouncing over them - a pixel-exact re-render of what the smoke test draws 8 min Rusty Nail First light on the Feather RP2040 DVI The DVI board had the console's palette on a monitor within 45 minutes of arriving, despite a wrong-variant pinout diagram and a slicer typing G-code into my REPL. 8 min Rusty Nail Downloading PICO-8 carts over WiFi Rusty Nail can download carts from a pop-up launcher. The WiFi reason-15 failure was my own off-by-one, and a GPIO pin really did die on the bench. 6 min Rusty Nail Reading the framebuffer out of RAM The standalone build sends nothing back to a host, so before I could redesign the boot splash I had to work out how to screenshot a screen my Mac cannot see. 6 min Rusty Nail Planning a flash cartridge for the console Picking a W25Q flash chip for a physical PICO-8 cartridge and mapping how the firmware would read it. Nothing is built yet. 8 min Rusty Nail The HDMI board I bought before reading the datasheet I bought a 50-pin RGB888-to-HDMI board, then counted the pins. The Nucleo never had 24 to give, so the fix is probably a second microcontroller whose whole job is HDMI. 6 min Rusty Nail A divide per pixel Profiling the PICO-8 runtime found a stretched-sprite blit doing an integer divide on every pixel, on a chip with no fast divide. 6 min Rusty Nail Moving the SPI panel to DMA The SPI blit was a blocking row-by-row write that stalled the console for about 13 ms every frame. DMA fixed it and the data cache nearly broke it. 5 min Rusty Nail Swapping the ESP32 for a Bluetooth gamepad I picked an ESP32-C6 for the controller bridge and learned that BLE-only is a property of the silicon, so the fix was a different chip and one build flag. 6 min Rusty Nail The SPI panel and me I had a working HDMI path at 12:48am. The next morning I picked up the tiny SPI screen instead and spent nine hours reinventing flicker. 6 min Rusty Nail The SPI panel, from a blank screen to 25 MHz Getting the desktop off the USB stream and onto a real LCD, then climbing from 1 MHz to 25 MHz without losing the audio. The PCM5102A I2S DAC breakout, front and back - line-out jack and solder-jumper pads on the purple board, with the SCK/BCK/DIN/LCK/GND/VIN header along the bottom edge 5 min Rusty Nail Getting sound out of it Wiring an I2S DAC to the console over SAI and DMA, and why the audio stayed silent for most of a day. 6 min Rusty Nail Running real PICO-8 Lua on a Cortex-M7 Vendoring Lua 5.4 into bare-metal firmware, and why a hardware watchdog beat an instruction-count hook for stopping runaway carts. 5 min Rusty Nail How Rusty Nail is put together Rusty Nail is a windowed pixel desktop running bare metal on a Nucleo-H753ZI. This is the architecture, and why the display is an abstraction from the start. 1 min Starting this blog A place to write up the things I build, mostly low-level. Short note on why it exists.

2025 2 posts