<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tiziano Basile</title>
    <description>The latest articles on DEV Community by Tiziano Basile (@basteez).</description>
    <link>https://dev.to/basteez</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F77918%2F093df924-d3af-4559-b4fe-0b3ae58fdc8d.png</url>
      <title>DEV Community: Tiziano Basile</title>
      <link>https://dev.to/basteez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/basteez"/>
    <language>en</language>
    <item>
      <title>Bonooru Devlog #2: My own firmware, as a Pro Controller</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Tue, 24 Nov 2026 07:16:55 +0000</pubDate>
      <link>https://dev.to/basteez/bonooru-devlog-2-my-own-firmware-as-a-pro-controller-28hb</link>
      <guid>https://dev.to/basteez/bonooru-devlog-2-my-own-firmware-as-a-pro-controller-28hb</guid>
      <description>&lt;p&gt;The Switch 2 now plays &lt;em&gt;Ode to Joy&lt;/em&gt; on Link's ocarina from my own firmware. 62 notes out of 62, every one at the right pitch, timed by the controller board's own clock, and the firmware says it applied every note at most 14 µs late.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/basteez/bonooru" rel="noopener noreferrer"&gt;Bonooru&lt;/a&gt; is my side project to play arbitrary melodies on the ocarina in &lt;em&gt;The Legend of Zelda: Ocarina of Time&lt;/em&gt; on Switch 2. It does that by pretending to be a wired controller. The chain is a desktop app on the PC, a "bridge" RP2040 board on USB, a UART link, and a "controller" RP2040 board that the Switch 2 sees as a Pro Controller. &lt;a href="https://bstz.it/p/bonooru-devlog-0/" rel="noopener noreferrer"&gt;Devlog #0&lt;/a&gt; explains the idea and the plan. &lt;a href="https://bstz.it/p/bonooru-devlog-1/" rel="noopener noreferrer"&gt;Devlog #1&lt;/a&gt; is the two days of measuring the ocarina itself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpl0MFKw0AQBuBXGeak0OASikiRgtkeFDyEJCJoimySjVnYzYTJSiil7-6mjXrwOPzMxz9zxJoajRtsLU11p9jDc1b2AKl8LzGV9xXfbK8GpkrDWLMZ_AieGnVYnRPfaVDDAFZ5zdcl7iGKoMSXPAG5kyWGcQtJFqiKTfOpIUtjsRbRm2a60PFkpPyQ5NwILTH0NM3OXCHJFu0hK2B9K-6EWERZBLGm3jNZq_m_6g7QGnaTYv2jyeKv2-PT7tI_ZQL56yx6_hr0fDK-7iA-b-MKnWanTIObI4aj3fyyRrfqy3o8nb4BIsBkYQ%3Ftype%3Dpng%26bgColor%3Dwhite" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpl0MFKw0AQBuBXGeak0OASikiRgtkeFDyEJCJoimySjVnYzYTJSiil7-6mjXrwOPzMxz9zxJoajRtsLU11p9jDc1b2AKl8LzGV9xXfbK8GpkrDWLMZ_AieGnVYnRPfaVDDAFZ5zdcl7iGKoMSXPAG5kyWGcQtJFqiKTfOpIUtjsRbRm2a60PFkpPyQ5NwILTH0NM3OXCHJFu0hK2B9K-6EWERZBLGm3jNZq_m_6g7QGnaTYv2jyeKv2-PT7tI_ZQL56yx6_hr0fDK-7iA-b-MKnWanTIObI4aj3fyyRrfqy3o8nb4BIsBkYQ%3Ftype%3Dpng%26bgColor%3Dwhite" alt="The Bonooru chain. This epic built the controller board's firmware; the bridge is still someone else's" width="1136" height="136"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The Bonooru chain. This epic built the controller board's firmware; the bridge is still someone else's&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Where we were
&lt;/h2&gt;

&lt;p&gt;At the end of Epic 1 the Switch 2 had played the same melody, but through &lt;a href="https://github.com/knflrpn/2wiCC" rel="noopener noreferrer"&gt;2wiCC&lt;/a&gt; by knflrpn, someone else's controller firmware. I had a measured profile of the ocarina (which button plays which note, how short a press can be, how fast notes can follow each other) and nothing of my own on the boards.&lt;/p&gt;

&lt;p&gt;The goal of Epic 2 was milestone M3: my own controller firmware enumerates as a wired Pro Controller, enforces the safety rules, and plays a hard-coded melody on the console with at most one frame of jitter. Seven stories, seven PRs (&lt;a href="https://github.com/basteez/bonooru/pull/15" rel="noopener noreferrer"&gt;#15&lt;/a&gt; to &lt;a href="https://github.com/basteez/bonooru/pull/19" rel="noopener noreferrer"&gt;#19&lt;/a&gt;, &lt;a href="https://github.com/basteez/bonooru/pull/23" rel="noopener noreferrer"&gt;#23&lt;/a&gt;, &lt;a href="https://github.com/basteez/bonooru/pull/24" rel="noopener noreferrer"&gt;#24&lt;/a&gt;), from 21 to 23 November.&lt;/p&gt;

&lt;p&gt;The stories were not built in the order you'd expect. The parts that need no console came first: the build, the wire protocol, the playback core, the UART link and its watchdog. The USB side, the bit the console actually talks to, came sixth. That way, when I finally plugged the board into the Switch, everything behind the USB endpoint had already been tested on my Mac for a day.&lt;/p&gt;
&lt;h2&gt;
  
  
  A skeleton that blinks
&lt;/h2&gt;

&lt;p&gt;Story 2.1 (&lt;a href="https://github.com/basteez/bonooru/pull/15" rel="noopener noreferrer"&gt;PR #15&lt;/a&gt;) is the boring one, and the one everything else stands on. pico-sdk 2.3.1 is a git submodule, with only TinyUSB 0.18.0 initialised inside it. The Arm GNU Toolchain 15.2.Rel1 and picotool 2.3.1 are pinned with their published checksums. One CMake project builds two UF2 files, &lt;code&gt;bridge.uf2&lt;/code&gt; and &lt;code&gt;controller.uf2&lt;/code&gt;, and a third preset builds the host tests for the PC.&lt;/p&gt;

&lt;p&gt;At this stage each board did one thing: blink the onboard WS2812 RGB LED through a PIO driver, blue at 1 Hz for the bridge and amber at 2 Hz for the controller, so I can tell them apart on the breadboard at a glance. Every GPIO number lives in one header, &lt;code&gt;pins.h&lt;/code&gt;, and CI fails if a grep finds a pin number anywhere else. That rule sounds pedantic until two boards share a breadboard and a wrong pin can drive one board's TX into the other's.&lt;/p&gt;
&lt;h2&gt;
  
  
  One protocol, one library, 239 vectors
&lt;/h2&gt;

&lt;p&gt;Story 2.2 (&lt;a href="https://github.com/basteez/bonooru/pull/16" rel="noopener noreferrer"&gt;PR #16&lt;/a&gt;) wrote the link protocol as a pure C99 library, &lt;code&gt;ocb_proto&lt;/code&gt;. No pico-sdk include, no heap, no global state. Frames are &lt;code&gt;type | seq | len | body | crc16le&lt;/code&gt;, wrapped in COBS (Consistent Overhead Byte Stuffing, which removes every &lt;code&gt;0x00&lt;/code&gt; from the frame so a single &lt;code&gt;0x00&lt;/code&gt; can mark where one frame ends), and checked with CRC-16/CCITT-FALSE.&lt;/p&gt;

&lt;p&gt;The PC app will be written in Rust later, so the library is tested against language-neutral text vectors rather than against itself: 239 cases in 7 files, covering every message, the COBS and CRC edge cases, maximum-length frames, an empty frame, a bad CRC, an overlong frame and the 8-byte neutral controller state. The Rust codec will have to pass the same files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# HELLO, seq 0: crc16("01 00 01 01") = d164, sent LE as "64 d1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;One line of &lt;a href="https://github.com/basteez/bonooru/blob/f999406/firmware/common/proto/vectors/messages.txt" rel="noopener noreferrer"&gt;&lt;code&gt;firmware/common/proto/vectors/messages.txt&lt;/code&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The code review found one important bug here: when a COBS decode overflowed its output buffer, the decoder reported it in a different order than the architecture asks for (COBS first, then length, then CRC). Small, but it's exactly the kind of disagreement between two implementations that the vectors exist to catch, so the fix came with new vector cases that failed against the old decoder first.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core: what is allowed to reach the console
&lt;/h2&gt;

&lt;p&gt;Story 2.4 (&lt;a href="https://github.com/basteez/bonooru/pull/17" rel="noopener noreferrer"&gt;PR #17&lt;/a&gt;) is the playback logic, again in plain C tested on the PC with a fake clock. Three modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IDLE&lt;/strong&gt;: nothing is pressed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DIRECT&lt;/strong&gt;: the PC sets the state live (to navigate menus, for example).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PLAYING&lt;/strong&gt;: the board plays a queue of timed events (up to 512, 12 bytes each) from its own clock.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpVj8EKgkAQhl9l2JNWEnT0EEi7hCAmuh2iIqZ2KsFV0tWL-O65FVGnYeb_vh-mZ5dKEfNZY9AQz_FWo_a6xaEE2E-O4HlLCHkk7G7n68DDVKykD5mQp0wG8j9NomAXxusxlkEqwXm01BIUFSpSriXf-rfagpsE5oDnqjYW-DT8EAU2Bqij0oATi61MgwimIGLujt6_zmZMU60xV8zvmbmTtu8pumJbGDYMT70bRjQ%3Ftype%3Dpng%26bgColor%3Dwhite" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpVj8EKgkAQhl9l2JNWEnT0EEi7hCAmuh2iIqZ2KsFV0tWL-O65FVGnYeb_vh-mZ5dKEfNZY9AQz_FWo_a6xaEE2E-O4HlLCHkk7G7n68DDVKykD5mQp0wG8j9NomAXxusxlkEqwXm01BIUFSpSriXf-rfagpsE5oDnqjYW-DT8EAU2Bqij0oATi61MgwimIGLujt6_zmZMU60xV8zvmbmTtu8pumJbGDYMT70bRjQ%3Ftype%3Dpng%26bgColor%3Dwhite" alt="Controller modes. Every abort returns NEUTRAL and latches until the app says STOP or HELLO" width="621" height="298"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Controller modes. Every abort returns NEUTRAL and latches until the app says STOP or HELLO&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In PLAYING a safety mask lets through only the buttons the ocarina needs, so a corrupted event can never press HOME or open a menu in the middle of a song. A test pushes all 65,536 button values through the mask. Every abort (link lost, USB gone, an event that arrives too late) sends the state to NEUTRAL, clears the queue and latches, so the board doesn't resume playing by itself after a glitch.&lt;/p&gt;
&lt;h2&gt;
  
  
  The UART link
&lt;/h2&gt;

&lt;p&gt;Story 2.6 (&lt;a href="https://github.com/basteez/bonooru/pull/18" rel="noopener noreferrer"&gt;PR #18&lt;/a&gt;) is the controller's side of the link: UART0 at 460800 baud, an interrupt that drains the receive FIFO including the error bits (framing, parity, break, overrun), frame decoding, a go-back-N retransmission scheme so a lost or corrupted &lt;code&gt;QUEUE_EVENT&lt;/code&gt; is resent rather than skipped or duplicated, and a STATUS frame every 50 ms.&lt;/p&gt;

&lt;p&gt;The bridge on my bench still runs knflrpn's &lt;a href="https://github.com/knflrpn/2wiCC_Comms" rel="noopener noreferrer"&gt;2wiCC_Comms&lt;/a&gt;, which copies bytes between USB and UART unchanged. It has no flow control and drops bytes silently when its 1 KB buffer fills, so my bench script paces its writes to the UART rate. The first soak failed on bugs in that script, not in the firmware; the one that passed sent 20,000 events with 2% of frames corrupted, 2% dropped and garbage in between:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Soak run (H.5)&lt;/th&gt;
&lt;th&gt;Events&lt;/th&gt;
&lt;th&gt;Resends&lt;/th&gt;
&lt;th&gt;Rewinds&lt;/th&gt;
&lt;th&gt;Semantic errors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;seed 1, impaired&lt;/td&gt;
&lt;td&gt;20,000, all in order&lt;/td&gt;
&lt;td&gt;36&lt;/td&gt;
&lt;td&gt;1,806&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;seed 2, impaired&lt;/td&gt;
&lt;td&gt;20,000, all in order&lt;/td&gt;
&lt;td&gt;34&lt;/td&gt;
&lt;td&gt;1,772&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;clean&lt;/td&gt;
&lt;td&gt;20,000, all in order&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The other part of this story is electrical. When only one of the two boards is powered, its TX pin must not push current into the other's RX. So the controller keeps its TX pin high-impedance at power-up, and only drives it after its own RX line has been idle-high for 1 ms, which means the bridge is alive. With a multimeter: TX 0 V with the controller alone, 3.28 V once the peer idles high.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2liivdgi9369ohnvvrpz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2liivdgi9369ohnvvrpz.jpg" alt="Two RP2040-Zero boards on a breadboard, wired by UART" width="800" height="1067"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The bench: the bridge RP2040-Zero at the top (still 2wiCC_Comms), my controller firmware at the bottom, UART and GND between them. The wiring is ugly; the GND continuity was measured first.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The link watchdog
&lt;/h2&gt;

&lt;p&gt;Story 2.7 (&lt;a href="https://github.com/basteez/bonooru/pull/19" rel="noopener noreferrer"&gt;PR #19&lt;/a&gt;) answers a question that matters more than any other in this project: what happens if the PC or the bridge disappears while a note is pressed?&lt;/p&gt;

&lt;p&gt;The bridge sends a &lt;code&gt;HEARTBEAT&lt;/code&gt; every 20 ms. If the controller sees none for 80 ms, or sees a UART break (an unplugged wire reads as a break, because the RX pin has a pull-down), it aborts: NEUTRAL, queue cleared, an &lt;code&gt;EVENT LINK_LOST&lt;/code&gt; to the app, then TX released. On the bench, three runs of the "stop the heartbeat" test gave &lt;code&gt;LINK_LOST&lt;/code&gt; 81.6, 81.1 and 81.3 ms after the last heartbeat. Pulling the wire by hand, ten rounds in a row, gave one abort per round and nothing left pressed.&lt;/p&gt;

&lt;p&gt;The test that failed here twice was, again, the bench script. A bouncing replug of the wire left half a frame in the controller's receiver, and the script never resent the event that frame had eaten. Later, the bounce of one replug arrived 77 to 104 ms after the previous round had ended and the script took it for the next unplug. The firmware did the right thing in every one of those runs. I'm starting to think that half of embedded work is debugging your own test tools.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Switch 2 meets a stranger
&lt;/h2&gt;

&lt;p&gt;Then Story 2.3 (&lt;a href="https://github.com/basteez/bonooru/pull/23" rel="noopener noreferrer"&gt;PR #23&lt;/a&gt;): make the controller board a USB device the console accepts.&lt;/p&gt;
&lt;h3&gt;
  
  
  Clean-room, on purpose
&lt;/h3&gt;

&lt;p&gt;2wiCC has no licence, so I can't read its code and then write mine; that would make Bonooru a derivative of something I have no permission to use. The Linux &lt;code&gt;hid-nintendo&lt;/code&gt; driver is GPL, which would force a licence I didn't choose. So the whole Pro Controller conversation was rebuilt from public descriptions and captures, used for facts only (byte values, offsets, sequences), never for code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dekuNukem's &lt;a href="https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering" rel="noopener noreferrer"&gt;Nintendo_Switch_Reverse_Engineering&lt;/a&gt; notes: the &lt;code&gt;0x80&lt;/code&gt; USB commands, the &lt;code&gt;0x30&lt;/code&gt; input report, the subcommands, the SPI flash map.&lt;/li&gt;
&lt;li&gt;Chromium's &lt;a href="https://github.com/chromium/chromium/blob/main/device/gamepad/nintendo_controller.cc" rel="noopener noreferrer"&gt;&lt;code&gt;nintendo_controller.cc&lt;/code&gt;&lt;/a&gt; and SDL's &lt;a href="https://github.com/libsdl-org/SDL/blob/main/src/joystick/hidapi/SDL_hidapi_switch.c" rel="noopener noreferrer"&gt;&lt;code&gt;SDL_hidapi_switch.c&lt;/code&gt;&lt;/a&gt;: what a host does when it opens a wired Pro Controller.&lt;/li&gt;
&lt;li&gt;mzyy94's &lt;a href="https://mzyy94.com/blog/2020/03/20/nintendo-switch-pro-controller-usb-gadget/" rel="noopener noreferrer"&gt;USB gadget write-up&lt;/a&gt; and its capture log, and tmk's &lt;a href="https://gist.github.com/tmk/9725596c6726b561ad2bf1f1e07e1523" rel="noopener noreferrer"&gt;&lt;code&gt;lsusb -v&lt;/code&gt; dump&lt;/a&gt;: the real descriptors and a real Switch 1 talking to a real controller.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of it lives in &lt;code&gt;ocb_p2&lt;/code&gt;, another pure C99 library: descriptors, the &lt;code&gt;0x80&lt;/code&gt; commands, the subcommand answers, the emulated SPI flash, the &lt;code&gt;0x30&lt;/code&gt; report. It knows nothing about TinyUSB or the RP2040, so it is tested and fuzzed on the PC. A thin TinyUSB glue on core 0 connects it to the hardware.&lt;/p&gt;

&lt;p&gt;There is one rule the library is strict about: the console must never be able to update or rewrite my controller. SPI writes and erases answer "write protected", the MCU firmware update path and the feature reports that unlock the controller's memory are refused and counted. And refusing things is where the first attempt broke.&lt;/p&gt;
&lt;h3&gt;
  
  
  Attempt 1: the pairing loop
&lt;/h3&gt;

&lt;p&gt;The first time I plugged the board into the Switch 2, my bench script printed PASS: handshake done, &lt;code&gt;console_ready&lt;/code&gt; 1 after 24 s, the console polling the IN endpoint every 8000 µs. No controller icon on the screen.&lt;/p&gt;

&lt;p&gt;The debug build keeps a log of every request the console sends and leaves it inside the STATUS frames, so I could read the Switch 2's side of the handshake. It went through the expected init and then asked for subcommand &lt;code&gt;01&lt;/code&gt;: Bluetooth pairing. My firmware refused it, as the "change nothing" rule said. The console asked again. And again. About 30 times, until the log was full.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;restart bus-reset, restart mount, usb 80 05, usb 80 01, usb 80 02, sub 03, HANDSHAKE,
usb 80 04, sub 02, sub 08, sub 10, sub 10, sub 01, REFUSED 01, sub 01, REFUSED 01, ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;mzyy94's full capture showed what a real controller does: it answers &lt;code&gt;01&lt;/code&gt; with &lt;code&gt;81 01 03&lt;/code&gt;, and the console's MCU request &lt;code&gt;21&lt;/code&gt; with &lt;code&gt;A0 21&lt;/code&gt; and a 34-byte standby report. Neither answer pairs, stores or configures anything, so both fit the rule. The rule was right; my reading of "refuse anything that could change state" was too broad.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="no"&gt;OCB_P2_SC_BT_PAIRING&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/* D34: the console sends this during its wired init (S12: 01 04 +
     * its address and name) and repeats it until answered; a NACK
     * stalled the Switch 2 (bench H.15 attempt 1). The real controller
     * answers 81 01 03 (S12; S13 same shape). Nothing is paired or
     * stored: the host address is discarded, no state changes. */&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;uint8_t&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="no"&gt;OCB_P2_PAIRING_STATUS&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;reply_sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;OCB_P2_ACK_PAIRING&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;a href="https://github.com/basteez/bonooru/blob/f999406/firmware/controller/profile_p2/p2.c#L387-L395" rel="noopener noreferrer"&gt;&lt;code&gt;firmware/controller/profile_p2/p2.c&lt;/code&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The whole captured init, 28 output reports, is now a host test. And the debug log learned to compress repeats, so the next loop would read &lt;code&gt;sub 01, REFUSED 01, (repeated 57 more)&lt;/code&gt; instead of filling the buffer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Attempt 2: the inputs that went nowhere
&lt;/h3&gt;

&lt;p&gt;Second try. This time the console went all the way through its init, almost request for request like the Switch 1 in the capture, and finished with subcommand &lt;code&gt;30&lt;/code&gt;: player lights. A console that assigns a player slot has accepted the controller. Still no icon. I pressed D-pad down five times from the bench script, every press was acknowledged, nothing moved on the HOME screen.&lt;/p&gt;

&lt;p&gt;That one was simple once I looked: in that build the USB report was &lt;em&gt;always&lt;/em&gt; NEUTRAL. The path from core 1 (where the link and the scheduler live) to core 0 (where the USB report is built) was a stub that returned NEUTRAL, waiting for Story 2.5. My presses reached core 1 and stopped there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptklFLwzAUhf_KJU8TM8i6iWMPA60vPihC8W0gMblbg20Sk3Raxv67tx2yrvoUwvlO7j2HHJhyGtmKRfxs0Cp8MHIXZL2xAF6GZJTx0iYoQEYovkxSJWRjMe9E5WwKrqowwMSp9zefXXVcMV2v8xUsBYgb3h8zmMQkUxN7PZ8SUBAw6xRB-hyu4ekuH5kzmJTS6ljKD_xjzAYw-eeiH2G1DBqM9U2CmlKO91n0VEsEvBb3Z-TZJQS3pyAEEhESpBJBfNO7Ab2je0wBTyX9Ts04iCWHmYBNI4S-pX017o1Cen7rOBQvj2SWOg636Lrw0gRjd_-VMR_HohmLwQwqdCEGTJfbV7KlzSuzK9OoYUHAZb6Ck4uyWXC2as8pT_E4IEEtLKGOG8s4qzHU0mi2OjBC6-7baNzKpkrsePwBwkipgQ%3Ftype%3Dpng%26bgColor%3Dwhite" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptklFLwzAUhf_KJU8TM8i6iWMPA60vPihC8W0gMblbg20Sk3Raxv67tx2yrvoUwvlO7j2HHJhyGtmKRfxs0Cp8MHIXZL2xAF6GZJTx0iYoQEYovkxSJWRjMe9E5WwKrqowwMSp9zefXXVcMV2v8xUsBYgb3h8zmMQkUxN7PZ8SUBAw6xRB-hyu4ekuH5kzmJTS6ljKD_xjzAYw-eeiH2G1DBqM9U2CmlKO91n0VEsEvBb3Z-TZJQS3pyAEEhESpBJBfNO7Ab2je0wBTyX9Ts04iCWHmYBNI4S-pX017o1Cen7rOBQvj2SWOg636Lrw0gRjd_-VMR_HohmLwQwqdCEGTJfbV7KlzSuzK9OoYUHAZb6Ck4uyWXC2as8pT_E4IEEtLKGOG8s4qzHU0mi2OjBC6-7baNzKpkrsePwBwkipgQ%3Ftype%3Dpng%26bgColor%3Dwhite" alt="The Switch 2's wired init as my firmware logged it, attempt 2 (simplified)" width="584" height="855"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The Switch 2's wired init as my firmware logged it, attempt 2 (simplified)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Attempt 3: the console waits for you
&lt;/h3&gt;

&lt;p&gt;For the third attempt the debug build got a real handoff: core 1 publishes its state through a sequence lock (more on that below), core 0 reads it into the report. First a check on the Mac with no console: five D-pad presses, &lt;code&gt;Down&lt;/code&gt; seen five times in the USB reports.&lt;/p&gt;

&lt;p&gt;Then the Switch 2. Same init, &lt;code&gt;console_ready&lt;/code&gt; 1 after 9.2 s. No icon, nothing in the Controllers menu. Then I sent A, and Zelda launched from the HOME screen.&lt;/p&gt;

&lt;p&gt;That's the finding I didn't expect: &lt;strong&gt;the Switch 2 doesn't show a wired controller until its first input.&lt;/strong&gt; It assigns a player slot, it polls the reports, but until a button is pressed there is no icon and no menu entry. I couldn't find this written anywhere public, so attempt 1's lesson ("a PASS from my script isn't a pass") almost made me chase a bug that didn't exist.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhe1qsgtkvycwp2wo5n0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbhe1qsgtkvycwp2wo5n0.jpg" alt="A Switch 2 with its screen off, wired to the boards and a laptop" width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The whole bench: the Mac drives the bridge, the controller goes into the Switch 2's top USB-C port. Screen off on purpose: no game images here. And yes, sorry about the limoncello tablecloth.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Other things the console taught me in the same session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It polls every 8 ms&lt;/strong&gt;, whatever the descriptor asks. Mine asks for 1 ms; the Mac polls the same build at about 2 ms. The architecture had assumed 1 ms, so that assumption is now marked refuted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sleep is a power cut.&lt;/strong&gt; The Switch 2 removes USB power while it sleeps, so the controller boots again on wake, and becomes ready 1.7 s after the console's first request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS has opinions.&lt;/strong&gt; With "Allow accessories to connect" on "Ask", a pending prompt left the board suspended and gone from the USB tree. That failed one test until a replug.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  A melody from the board's own clock
&lt;/h2&gt;

&lt;p&gt;Story 2.5 (&lt;a href="https://github.com/basteez/bonooru/pull/24" rel="noopener noreferrer"&gt;PR #24&lt;/a&gt;) put the pieces into their final shape and played the first melody.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpVkU1vgkAQhv_KZE81Sgr20pDGxHrxgBeQ9FCaBthBSBeGLkvRGv97hw9NvW0mz7zzzOxZpCRRuCJT1KV5rA14flQBNG1y0HGdw8Z5jxjSCI7L1Rq1pYhqyDSV4K93kfjoeQCPuXDt70EV1ddLoh9X8-EJXWzSXNKBSbCsFQSbLaNNmqNsFeoBfXBgt_0FU5SoF1CTUihnUzRW8t7IvhrZt-Ehl_ZFdQqDV5gDpclnvRyC7eOTDRpr4s2oAvxBfRry78PZid2AtfBbUTr6S2oThZC0WYY6EoN82NPhyJZxoRI6jgv0kzm9Ms3oD42JTTOb2rx_bUxeV5x8nqFsJjB4402CruCTwXJwFAvBR-FZUrhnYXIs-_-SmMWtMuJy-QM1JY61%3Ftype%3Dpng%26bgColor%3Dwhite" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpVkU1vgkAQhv_KZE81Sgr20pDGxHrxgBeQ9FCaBthBSBeGLkvRGv97hw9NvW0mz7zzzOxZpCRRuCJT1KV5rA14flQBNG1y0HGdw8Z5jxjSCI7L1Rq1pYhqyDSV4K93kfjoeQCPuXDt70EV1ddLoh9X8-EJXWzSXNKBSbCsFQSbLaNNmqNsFeoBfXBgt_0FU5SoF1CTUihnUzRW8t7IvhrZt-Ehl_ZFdQqDV5gDpclnvRyC7eOTDRpr4s2oAvxBfRry78PZid2AtfBbUTr6S2oThZC0WYY6EoN82NPhyJZxoRI6jgv0kzm9Ms3oD42JTTOb2rx_bUxeV5x8nqFsJjB4402CruCTwXJwFAvBR-FZUrhnYXIs-_-SmMWtMuJy-QM1JY61%3Ftype%3Dpng%26bgColor%3Dwhite" alt="The two cores of the controller RP2040" width="1304" height="230"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The two cores of the controller RP2040&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Core 1 runs a loop with no sleep and no interrupts of its own, polling the 1 MHz timer and applying each event when its time comes. The whole program runs from RAM (about 32 KB copied at boot), so a flash cache miss can't delay a note. The state crosses to core 0 through a sequence-locked double buffer: the writer makes a counter odd, fills the inactive slot, makes it even; the reader copies and checks that the counter didn't move in a way that means a torn copy. It tries three times, then gives up and reports NEUTRAL.&lt;/p&gt;

&lt;p&gt;My first version of that check was wrong. An exhaustive test of every interleaving of writer and reader steps found a case where the reader accepted a slot the writer was rewriting: a torn state, half one note and half the next. The fix was to count half publishes, not whole ones. The test now runs over 7 million interleavings under AddressSanitizer in about a second. The Cortex-M0+ barrier needed a look too: GCC's &lt;code&gt;__atomic_thread_fence&lt;/code&gt; compiles to &lt;code&gt;dmb ish&lt;/code&gt;, an option ARMv6-M reserves, so the firmware uses the SDK's &lt;code&gt;__dmb()&lt;/code&gt; (&lt;code&gt;dmb sy&lt;/code&gt;), and a CI gate counts the barriers in the disassembly.&lt;/p&gt;
&lt;h3&gt;
  
  
  The firmware measures itself
&lt;/h3&gt;

&lt;p&gt;I have no logic analyser, so the timing is measured in two layers: the firmware times itself, and a microphone listens to the console.&lt;/p&gt;

&lt;p&gt;The timeline build carries &lt;em&gt;Ode to Joy&lt;/em&gt; from Epic 1, 158 events, generated from the measured profile. The PC only sends HELLO and START. For every applied event the firmware records how late it was against its due time; for every USB poll, the interval since the previous one. Three runs on the Switch 2 (H.18):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measure&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Lateness at apply, max (3 runs)&lt;/td&gt;
&lt;td&gt;10 / 14 / 10 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lateness, mean&lt;/td&gt;
&lt;td&gt;about 5 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Events in the first histogram bucket&lt;/td&gt;
&lt;td&gt;158 / 158&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IN poll interval: median, p95&lt;/td&gt;
&lt;td&gt;8000 µs, 8000 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Core 1 loop, max&lt;/td&gt;
&lt;td&gt;106 to 117 µs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Core 1 stack, high-water mark&lt;/td&gt;
&lt;td&gt;1228 to 1244 B (limit 1536)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retries, fallbacks, reboots&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A note can be at most 14 µs late at the board. The "late" threshold, at which the core would abort the piece, is one poll period (8000 µs): about 570 times the worst lateness seen.&lt;/p&gt;
&lt;h3&gt;
  
  
  The microphone disagrees, and that's fine
&lt;/h3&gt;

&lt;p&gt;Then the second layer (H.19): the Mac's microphone near the console speaker, the same melody, an onset detector comparing the gaps between notes with the score. 62 notes, 62 audible, 62 at the right pitch, within −3 to +0 cents. The 95th percentile of the inter-onset error was &lt;strong&gt;18.14 ms&lt;/strong&gt;, which is 1.088 frames at 60 fps: above the one-frame target.&lt;/p&gt;

&lt;p&gt;Where do 18 ms come from, if the board is accurate to 14 µs? From two things the firmware can't change:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A state change waits for the next USB poll: anywhere from 0 to 8 ms.&lt;/li&gt;
&lt;li&gt;The game samples input once per frame: anywhere from 0 to 16.67 ms. For the gap between two notes, two independent errors like that give a p95 of 0.776 frame, 12.94 ms, even with a perfect scheduler.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The analysis tool computes both bounds and checks what's left over: firmware bound 8.01 ms (14 µs of lateness plus one poll), game floor 12.94 ms, residual +2.92 ms against a 4 ms allowance for the analyser's own noise. Verdict: &lt;strong&gt;EXPLAINED&lt;/strong&gt;. The acceptance criterion allowed exactly that branch, "≤ 1 frame, or the gap explained with the self-timing data", because I knew from the start that part of the jitter belongs to the console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNolUMFqwzAM_RWhUwtJiEvXtT30sFtPO2w71TvItZIa7LjYDksp_fcpBATSe096D_TEa7SMR5we1xulUhsupAeA4opn0Pjtght6MKPtucAq5LXGWZ9qmlyGi0YTKVnwVHjgnDVWcvXz9QH36P2COpfCHyUGE8fBLlxPgaHzMSZY3Q9v64VV0CURFhCY8pjYwvnzDLKj8XdOfizJoksYtFDXJ9i0s2IowaVtWrWtYC8lUwVq0xwEq12ze5e2b9RWbLAS-xTIWTw-sdw4zE-w3NHoC75e_67hVIg%3Ftype%3Dpng%26bgColor%3Dwhite" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNolUMFqwzAM_RWhUwtJiEvXtT30sFtPO2w71TvItZIa7LjYDksp_fcpBATSe096D_TEa7SMR5we1xulUhsupAeA4opn0Pjtght6MKPtucAq5LXGWZ9qmlyGi0YTKVnwVHjgnDVWcvXz9QH36P2COpfCHyUGE8fBLlxPgaHzMSZY3Q9v64VV0CURFhCY8pjYwvnzDLKj8XdOfizJoksYtFDXJ9i0s2IowaVtWrWtYC8lUwVq0xwEq12ze5e2b9RWbLAS-xTIWTw-sdw4zE-w3NHoC75e_67hVIg%3Ftype%3Dpng%26bgColor%3Dwhite" alt="Where the jitter comes from, in ms (H.18 and H.19)" width="700" height="500"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Where the jitter comes from, in ms (H.18 and H.19)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The board's bar is invisible on that chart. That's the point.&lt;/p&gt;
&lt;h2&gt;
  
  
  Two watchdogs, and a chip that lies about one of them
&lt;/h2&gt;

&lt;p&gt;The link watchdog of Story 2.7 covers a dead PC. Story 2.5 adds the other case: a dead core. If either core hangs with a note pressed, the board must reset itself, the USB must disappear, and the console must see nothing pressed, within 100 ms.&lt;/p&gt;

&lt;p&gt;The rules: each core watches the other's pass counter. If core 1 sees core 0 stuck for 20 ms, it reboots the chip at once. If core 0 sees core 1 stuck for 20 ms, it switches the report to NEUTRAL and stops feeding the 60 ms hardware watchdog. Worst case 20 + 60 + 5 = 85 ms, and that sum is a compile-time assertion: change a constant past 100 ms and the build fails.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNp90T1vgzAQBuC_cvJYgQQZOjBE6ke2KgNJprbD1T4wEtjofASpUf57bdomGapO9vK89_p8UtobUpUKgkLPHbaMQ35cvTmAenKucy3k-RqePFOxE-ypAh3vUMRjckIMDftPcrCGVQFD-AuWt7D8B16nLLamQHJhTB_eSwCxBNp2Izg__6LyirY0CWN_qck0eo5suzns64eXDIL4MUBDZGLHFPAjbkdaZDNj9DOKtsa3GdynkoBNap4q9BhkSVlenNgS8Hr3XsFh9wiGBLWlkMF37bkTGyuLTZsZmUJIVGVqIB6wM6o6qZg7pM8w1ODUizqfvwD3forU%3Ftype%3Dpng%26bgColor%3Dwhite" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNp90T1vgzAQBuC_cvJYgQQZOjBE6ke2KgNJprbD1T4wEtjofASpUf57bdomGapO9vK89_p8UtobUpUKgkLPHbaMQ35cvTmAenKucy3k-RqePFOxE-ypAh3vUMRjckIMDftPcrCGVQFD-AuWt7D8B16nLLamQHJhTB_eSwCxBNp2Izg__6LyirY0CWN_qck0eo5suzns64eXDIL4MUBDZGLHFPAjbkdaZDNj9DOKtsa3GdynkoBNap4q9BhkSVlenNgS8Hr3XsFh9wiGBLWlkMF37bkTGyuLTZsZmUJIVGVqIB6wM6o6qZg7pM8w1ODUizqfvwD3forU%3Ftype%3Dpng%26bgColor%3Dwhite" alt="Liveness rules on the controller" width="436" height="702"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Liveness rules on the controller&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To test it I built two debug flavours that hang one core on purpose 50 ms into the first note. The first bench run failed: the Mac saw the device vanish about 180 ms after the press. It turned out macOS takes about &lt;strong&gt;113 ms&lt;/strong&gt; to notice a removed USB device, so the host can't measure a 20 ms reset. So the board now measures it: at the reset it writes the stall-to-reset interval into a watchdog scratch register, which survives the reset, and reports it after boot. Core 0 hung: &lt;strong&gt;20.0 ms&lt;/strong&gt;, five runs out of five.&lt;/p&gt;

&lt;p&gt;Core 1 hung: the board said &lt;strong&gt;270 ms&lt;/strong&gt;. That's a fail, by a lot. Except the host saw NEUTRAL reports keep coming until about 77 to 79 ms after the hang, then the device vanish 115 ms later, the macOS delay again. The board was resetting on time; it was measuring wrong. To get "time until the hardware watchdog fires" I had called &lt;code&gt;watchdog_get_time_remaining_us()&lt;/code&gt;, and the pico-sdk header says, for the RP2040:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;On RP2040 this method returns the last value set instead of the remaining time due to a h/w bug.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So now the firmware computes it from the last time core 0 fed the watchdog:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="nf"&gt;ocb_live_watchdog_stall_to_reset_us&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="n"&gt;peer_last_change_us&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="n"&gt;last_feed_us&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="n"&gt;reset_us&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;last_feed_us&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="no"&gt;OCB_WDT_TIMEOUT_MS&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000u&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reset_us&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;peer_last_change_us&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0u&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reset_us&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;peer_last_change_us&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="no"&gt;UINT32_MAX&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="no"&gt;UINT32_MAX&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;a href="https://github.com/basteez/bonooru/blob/f999406/firmware/controller/core/live.c#L97-L105" rel="noopener noreferrer"&gt;&lt;code&gt;firmware/controller/core/live.c&lt;/code&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Second run: &lt;strong&gt;80.0 ms&lt;/strong&gt; (79,990 µs), host and board agree within 5 ms, the board came back with nothing pressed. Both within the 100 ms budget.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hang&lt;/th&gt;
&lt;th&gt;Detected&lt;/th&gt;
&lt;th&gt;Reset after the stall&lt;/th&gt;
&lt;th&gt;macOS sees the removal&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;core 0 (5 runs)&lt;/td&gt;
&lt;td&gt;by core 1, 20 ms&lt;/td&gt;
&lt;td&gt;20.0 ms&lt;/td&gt;
&lt;td&gt;median 113.1 ms later&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;core 1&lt;/td&gt;
&lt;td&gt;by core 0, 20 ms (NEUTRAL from then)&lt;/td&gt;
&lt;td&gt;80.0 ms&lt;/td&gt;
&lt;td&gt;114.4 ms later&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What went wrong, and what I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;My refusal rule was too broad.&lt;/strong&gt; "Change nothing" became "refuse everything", and the console looped on the pairing request. Answering it the way a real controller does changes nothing either.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A green script is not a pass.&lt;/strong&gt; Attempt 1 printed PASS with no controller on screen. The criterion is now "the first input acted on", checked by me.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The console hides wired controllers until the first input.&lt;/strong&gt; Not a bug, but it cost an attempt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 1 ms poll was an assumption; the console polls at 8 ms.&lt;/strong&gt; Measured, recorded, the architecture note updated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The RP2040 watchdog can't tell you how long it has left.&lt;/strong&gt; Read the SDK header before trusting a register.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Mac adds ~113 ms to every USB removal.&lt;/strong&gt; The board measures its own reset now.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;My seqlock was wrong&lt;/strong&gt; until an exhaustive interleaving test showed a torn read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many failures were my bench tools&lt;/strong&gt;, not the firmware: a soak sender bug, a missed resend after a bouncing wire, a bounce taken for an unplug, a fresh-boot check that sent HELLO before reading. Every one was fixed and re-run.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;I plan and build Bonooru with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMad Method&lt;/a&gt; and AI agents (Claude). Each story gets a file with its acceptance criteria and every open decision recorded; an agent implements it, a fresh-context agent reviews it, and the findings are fixed or recorded. What needs hardware is mine: I ran every bench step at the Switch and the Mac, the agent wrote the probe tools and recorded the numbers exactly as measured, including the failed attempts.&lt;/p&gt;

&lt;p&gt;Epic 2 is 7 PRs. At the end, the firmware has 39 host tests (ctest) that run under AddressSanitizer and UndefinedBehaviorSanitizer with no hardware, plus CI gates for pin numbers, library purity, memory barriers, RAM placement and the core 1 stack. The rules, decisions and bench numbers live in &lt;a href="https://github.com/basteez/bonooru/blob/f999406/docs/test-plan.md" rel="noopener noreferrer"&gt;&lt;code&gt;docs/test-plan.md&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/basteez/bonooru/blob/f999406/docs/link-protocol.md" rel="noopener noreferrer"&gt;&lt;code&gt;docs/link-protocol.md&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/basteez/bonooru/blob/f999406/docs/usb-controller-emulation.md" rel="noopener noreferrer"&gt;&lt;code&gt;docs/usb-controller-emulation.md&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;The controller is mine now; the bridge isn't. Next epic: my own bridge firmware, and the PC driving the controller through it, end to end.&lt;/p&gt;

&lt;p&gt;In Epic 1 a melody played through someone else's firmware. Today it plays through mine, and I know where every millisecond goes.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is an unofficial fan project for personal, offline fun. It is not affiliated with, endorsed or sponsored by Nintendo. The Legend of Zelda and Nintendo Switch are trademarks of Nintendo. No game code, assets or console modifications are involved.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>iot</category>
      <category>opensource</category>
      <category>programming</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>Bonooru Devlog #1: Measuring an ocarina before writing any firmware</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Mon, 23 Nov 2026 19:01:17 +0000</pubDate>
      <link>https://dev.to/basteez/bonooru-devlog-1-measuring-an-ocarina-before-writing-any-firmware-58h5</link>
      <guid>https://dev.to/basteez/bonooru-devlog-1-measuring-an-ocarina-before-writing-any-firmware-58h5</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://bstz.it/p/bonooru-devlog-1/" rel="noopener noreferrer"&gt;my blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The Switch 2 just played &lt;em&gt;Ode to Joy&lt;/em&gt; on Link's ocarina, 62 notes out of 62, three times in a row, without me touching the controller once and without a single line of my own firmware involved, which is an odd place for a firmware project to start; this post is about the two days of measuring that came before it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/basteez/bonooru" rel="noopener noreferrer"&gt;Bonooru&lt;/a&gt; is my side project to play arbitrary melodies on the ocarina in &lt;em&gt;The Legend of Zelda: Ocarina of Time&lt;/em&gt; on Switch 2 by pretending to be a wired controller, and &lt;a href="https://bstz.it/p/bonooru-devlog-0/" rel="noopener noreferrer"&gt;Devlog #0&lt;/a&gt; explains the idea, the two boards and the plan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PC (desktop app)
   │ USB
   ▼
bridge (RP2040-Zero)
   │ UART
   ▼
controller (RP2040-Zero)
   │ USB
   ▼
Switch 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this epic I had a spec, an architecture, a UX design and a backlog of 12 epics, all of it on paper, and on the hardware side two RP2040-Zero boards on a breadboard flashed with &lt;a href="https://github.com/knflrpn/2wiCC" rel="noopener noreferrer"&gt;2wiCC&lt;/a&gt; and &lt;a href="https://github.com/knflrpn/2wiCC_Comms" rel="noopener noreferrer"&gt;2wiCC_Comms&lt;/a&gt; by knflrpn, the two-board controller firmware that &lt;a href="https://riidraw.com" rel="noopener noreferrer"&gt;RiiDraw&lt;/a&gt; uses; the only thing I had actually checked was that a command typed in a terminal could press A on the console. (During this epic the project was still called "Ocarina Bot", so some files linked below carry the old name.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0h1j16bo8wmmzgxzdy8s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0h1j16bo8wmmzgxzdy8s.png" alt="Wiring diagram of the two RP2040-Zero boards between the PC and the Switch 2" width="800" height="454"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The same two-board wiring as in Devlog #0. During Epic 1 the bridge ran 2wiCC_Comms and the controller board ran 2wiCC.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The whole plan rests on facts about the game that I had only read in community guides, which buttons play which notes, how the pitch modifiers work, how short a note can be and how long it can last, and if any of those were wrong the score compiler, the mapping file and the timing rules of my firmware would all rest on guesses. So Epic 1 meant no firmware of mine and no app yet, just measuring first on my own Switch 2 and getting a melody out early enough to hear the whole thing work end to end, what's usually called a walking skeleton. It took six stories and seven PRs over two days.&lt;/p&gt;
&lt;h2&gt;
  
  
  By hand, with a tuner
&lt;/h2&gt;

&lt;p&gt;The cheapest test needs no hardware at all, just a real Joy-Con 2, the game in ocarina free play and a tuner app on my phone, so that's where I started (&lt;a href="https://github.com/basteez/bonooru/pull/5" rel="noopener noreferrer"&gt;PR #5&lt;/a&gt;). The community chart says L, R, A, Y and X play D4, F4, A4, B4 and D5; the pairing was right, but every note sounded one octave higher, D5, F5, A5, B5, D6, and the same went for all 19 fingerings in the chart, so from then on the project uses the &lt;em&gt;sounding&lt;/em&gt; pitch everywhere (profile, UI, docs) and keeps the chart names only to cross-reference guides. The playable range is B4 to F6, 19 chromatic pitches, with the D-pad shifting a note by ±1 semitone, the left stick by ±2 and both together by ±3.&lt;/p&gt;

&lt;p&gt;The rest of the session was about how the ocarina behaves over time. Holding a button sustains the note, but it starts to waver after about 2 s and stops by itself at about 6 s; pressing a new button while one is held cuts the old note, and releasing the new one brings the first note back, so the old button has to be released; changing the D-pad while a note sounds steps the pitch at once, while the stick glides, so portamento is possible. Free play survived 100 notes in a row and a minute of idling without closing, and two of the answers changed actual decisions. D-pad ← is a toggle that both opens and closes the ocarina, and notes are only accepted about 2 s after opening, so the app won't take the ocarina out by itself: it can't see the screen, and an automatic press would close an ocarina the user had already opened. ZL, on the other hand, opens the song menu, ZR does nothing and the right stick moves the camera, which confirmed the allow-list for my firmware (only L, R, A, X, Y, the D-pad and the left stick reach the console while a song plays) and made masking ZL a feature rather than a restriction.&lt;/p&gt;

&lt;p&gt;The test I was most nervous about was row 1.8. The game has 12 official songs with in-game effects, and if a melody happens to contain one the song triggers and free play ends mid-piece; my hope was to dodge that by playing one note on an alternative fingering. I played Zelda's Lullaby on natural notes and it was recognised, then with the first B as A + stick↑ and it was recognised again, then with the first D as Y + D↑ + stick↑, with the same result, so the game matches songs by pitch rather than by button, whatever the tempo, and the mitigation in the risk register went from "alternative fingering" to "warn only": the score compiler will detect official song sequences and warn about them.&lt;/p&gt;
&lt;h2&gt;
  
  
  A sender for someone else's queue
&lt;/h2&gt;

&lt;p&gt;Measuring timing by hand is hopeless, so I needed a script that sends timed controller states to the 2wiCC bridge (&lt;a href="https://github.com/basteez/bonooru/pull/7" rel="noopener noreferrer"&gt;PR #7&lt;/a&gt;): a throwaway one-file Python spike, MIT like the rest of the repo, with the 2wiCC binaries used for testing only and never committed, since 2wiCC has no licence and I only read its README and sources to describe the behaviour in my own words. The wire format is ASCII lines at 460800 baud, 8N1:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+SPM BUF&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;switch to buffered playback (power-up mode is real-time)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+QD hhhhhh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;queue one 60 Hz frame, 3 digital bytes, sticks centred&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+QF hh…hh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;queue one frame, 3 digital + 6 analog bytes (12-bit sticks)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+SPM RT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;back to real-time: the backlog is discarded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;+QD 000000&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;neutral&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The 2wiCC queue holds 1024 frames and plays one per frame, and my input files are rows of &lt;code&gt;time buttons hat stick&lt;/code&gt; in the same canonical state my own firmware will use later, with a single &lt;code&gt;encode()&lt;/code&gt; function that knows the 2wiCC layout. Most of the thinking went into pacing, because if you fill the queue too much a Ctrl+C has a long backlog to throw away, and if you let it run empty 2wiCC keeps the last state, which on an ocarina means a note that never ends; so the pacer keeps the lead, frames sent minus frames played as estimated from the host clock, between 1 and 30 frames, and treats an empty queue as a hard error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_lead&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;t0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;lines_to_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="no"&gt;PREAMBLE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sent&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;played&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;played&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;lead&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sent&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;played&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lead&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;Underrun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"host fell behind at frame {self.sent}/{n} (lead {lead}); stopping"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;played&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;max_lead&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;lines_to_bytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Trimmed from &lt;a href="https://github.com/basteez/bonooru/blob/2f90b00/spikes/send_2wicc.py#L431-L454" rel="noopener noreferrer"&gt;&lt;code&gt;spikes/send_2wicc.py#L431-L454&lt;/code&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmez5x1t1c8oxbj087sli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmez5x1t1c8oxbj087sli.png" alt="One run of send_2wicc.py: preamble and prefill, top-ups every half frame, and the stop sequence on every exit path" width="800" height="440"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;One run of send_2wicc.py: preamble and prefill, top-ups every half frame, and the stop sequence on every exit path&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The stop sequence has to run on every exit, and code review found two ways a second signal could skip it, so &lt;code&gt;play()&lt;/code&gt; now ignores SIGINT, SIGTERM and SIGHUP as the first statement of its &lt;code&gt;finally&lt;/code&gt;, before sending &lt;code&gt;+SPM RT&lt;/code&gt; and &lt;code&gt;+QD 000000&lt;/code&gt;, with a regression test that fails with the old order.&lt;/p&gt;

&lt;p&gt;In the first session commands from the PC mostly worked, but replies came back as &lt;code&gt;+2wicc��&lt;/code&gt; and &lt;code&gt;+GQS&amp;lt;&amp;lt;48&amp;lt;�&lt;/code&gt; and the stop probes were inconsistent; the culprit, a little embarrassingly, was the breadboard, where the two GND pins sat on power rails I hadn't bridged, so the boards had no common ground. Once the rails were bridged (0.1 Ω measured from GND to GND) everything behaved, a ground continuity check became step one of every session in the test plan, and every result from before the fix went in the bin. After that the L R A Y X scale played in order, D5 F5 A5 B5 D6 on the tuner, and Ctrl+C in the middle of a note stopped it at once with exit code 130; the first run of the scale didn't play at all, though, because the game was showing a "connect controller" prompt, and that turned out to be a pattern: after the controller is connected, powered on or re-plugged, the first injected input is ignored and the second one works, so from then on every session sacrificed its first A.&lt;/p&gt;
&lt;h2&gt;
  
  
  The stick bends
&lt;/h2&gt;

&lt;p&gt;I expected the left stick to work like a button with a threshold, where past some deflection it counts as "up" and the pitch jumps by 2 semitones, so I wrote trials to find that threshold (&lt;a href="https://github.com/basteez/bonooru/pull/8" rel="noopener noreferrer"&gt;PR #8&lt;/a&gt;) and a helper, &lt;code&gt;listen_trial.py&lt;/code&gt;, that plays a trial file while recording the MacBook microphone and reports the pitch of every press. It turns out there's no threshold at all: the stick bends the pitch gradually, close to linear in cents (1 cent = 1/100 of a semitone), about 25 cents per 0x10 step of the 8-bit stick value, with no dead zone, and reaches the full ±2 semitones only at full travel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbk2nuabzot91jl3pzhx7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbk2nuabzot91jl3pzhx7.png" alt="Pitch bend of A5 vs left stick deflection (test plan row 1.6, one note per step, cents vs the A5 at rest). The last down step is 99 % of travel (0xFF)." width="799" height="571"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Pitch bend of A5 vs left stick deflection (test plan row 1.6, one note per step, cents vs the A5 at rest). The last down step is 99 % of travel (0xFF).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Half travel gives about ±105 cents, which a tuner happily reads as the next semitone but which is 5 cents away from being wrong. Diagonals were another surprise, because the stick at full travel in a corner gives about ±142 cents, the same as a diagonal on the circle, which fits the game clamping the stick vector to the unit circle and bending by its vertical component (0.707 × 200 ≈ 141); so the profile uses a pure vertical stick at full travel, &lt;code&gt;ly = 0x00&lt;/code&gt; up and &lt;code&gt;ly = 0xFF&lt;/code&gt; down with &lt;code&gt;lx&lt;/code&gt; centred.&lt;/p&gt;

&lt;p&gt;Then I tried all 45 combinations (5 buttons × D-pad none/↑/↓ × stick none/↑/↓), and every one gave the model pitch, button + D-pad ±1 + stick ±2, by nearest note. Nine modifier states give seven offsets, from −3 to +3, so the 45 inputs cover the 19 pitches with one to four fingerings each: G♯5, A♯5 and C6 can be played four ways, B4, C5, E6 and F6 only one. The game also isn't tuned to A4 = 440 Hz, since A5 reads about 894 Hz, roughly 27 cents sharp, and on X the D-pad shifts by about ±115 cents instead of 100; every note still reads as the right note, so I wrote both down and moved on.&lt;/p&gt;
&lt;h3&gt;
  
  
  Then the microphone
&lt;/h3&gt;

&lt;p&gt;The first live calibration reported no sound for an A5 that was clearly there (894 Hz, +28 c), because two problems had stacked up: the signal-to-noise ratio was computed over the whole band, where sub-200 Hz room noise dominated, and the ffmpeg avfoundation capture was silently dropping about 9 % of the samples, so the analysis windows drifted late and the "noise before the press" window contained the note itself. In a later session the same capture delivered only 78 % of real time, so it was replaced by a lossless capture through PortAudio (&lt;code&gt;sounddevice&lt;/code&gt;) with its own self-test (a 1 kHz tone for 60 s, delivered-sample ratio 1.00000), and levels are now measured at the expected pitch instead of over the whole band. Something similar had already happened by hand, when one reading of the D-pad bend said 311 Hz instead of 932 Hz because the tuner had locked onto a subharmonic (932 / 3) during the change; holding both for 2 s fixed it, and in hindsight it was a fair warning of what automated pitch detection would do to me later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flz2h3wqn1vrgrjycu1us.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flz2h3wqn1vrgrjycu1us.png" alt="The measurement loop used from Story 1.3 on" width="800" height="114"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The measurement loop used from Story 1.3 on&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How fast it can play
&lt;/h2&gt;

&lt;p&gt;The next question was how fast the bot can play (&lt;a href="https://github.com/basteez/bonooru/pull/9" rel="noopener noreferrer"&gt;PR #9&lt;/a&gt;), which comes down to four numbers, each defined as the smallest value that passes 20 out of 20 tries. The trial generator writes every time in frames, interleaves the steps in shuffled rounds so that a step isn't always at the same phase of the game's frame, and adds a warm-up press and controls to every file: blanks, which must stay silent, a gap of 0 frames, which must read as one held note, and a gap of 30 frames, which must clearly read as two.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Detail&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Shortest press that always sounds&lt;/td&gt;
&lt;td&gt;2 frames (33.3 ms)&lt;/td&gt;
&lt;td&gt;20/20 on all five buttons; 1 frame sounds only 16 to 18 of 20, and a 1-frame press still sounds for 0.1 to 0.2 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shortest release between two presses of the same button&lt;/td&gt;
&lt;td&gt;5 frames (83.3 ms), my choice&lt;/td&gt;
&lt;td&gt;20/20 at 4 frames on A, L and Y; R and X not fully resolved&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How early a modifier must be set&lt;/td&gt;
&lt;td&gt;0 frames&lt;/td&gt;
&lt;td&gt;set in the same frame as the button, no wrong pitch longer than about 35 ms, 20/20 at every lead from 0 to 5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frame rate while playing&lt;/td&gt;
&lt;td&gt;60 Hz (16.67 ms)&lt;/td&gt;
&lt;td&gt;240 fps phone video of the screen, median run of 4 identical capture frames&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The retrigger gap turned out not to be a clean yes or no: while the button is up the note decays, and the dip between the two notes deepens smoothly with the gap.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fubh81oj1q77su7ei23uw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fubh81oj1q77su7ei23uw.png" alt="Same-button retrigger on A: retriggers detected out of 20 per gap (test plan row 2.2; threshold 11.8 dB from the pooled controls)" width="799" height="571"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Same-button retrigger on A: retriggers detected out of 20 per gap (test plan row 2.2; threshold 11.8 dB from the pooled controls)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So "retrigger" is a threshold on a continuous dip, and the threshold depends on the button; X (D6) is quiet at the microphone, with a full dip only about 13 dB above the noise, so 4 frames gave 18/20 and I couldn't tell the game apart from the microphone. I picked 5 frames for the profile and wrote down that it's a choice rather than a measured limit.&lt;/p&gt;

&lt;p&gt;For jitter I played a 30 s passage of sixteenth notes at 120 BPM, 240 notes, through the 2wiCC queue three times: 237 to 240 notes matched each run, the error on the interval between two note starts had a σ of 8.07 to 11.67 ms (0.48 to 0.70 of a frame), p95 between 18.8 and 21.1 ms and a worst case of 22.9 ms, always under the one-frame target, with a median latency of 123 to 139 ms from the scheduled press to the sound. The per-note latency fell into two clusters one frame apart, which is what you'd expect if the game samples input once per 60 Hz frame and my host-clocked sender isn't phase-locked to it. Keep in mind that this measures 2wiCC's queue and my Mac's clock rather than my own firmware's scheduler, which gets its turn in Epic 2.&lt;/p&gt;
&lt;h3&gt;
  
  
  When the analysers were wrong
&lt;/h3&gt;

&lt;p&gt;Most of what I learned in this story was about measuring rather than about the game, because three of my analysers kept producing numbers that looked plausible and were wrong. The broadband signal-to-noise ratio made room noise "sound" at 5 to 14 dB and made the quiet X fail, while measured at the expected pitch X notes are 14 to 23 dB and blanks at most 6.8 dB; short-window YIN, a common pitch detector, locked onto f/2, f/3 or 2f on noisy notes, so X read as G4 or D5 and lead errors of over 1000 cents appeared out of nowhere until I switched to spectral peaks searched near the expected pitch; and generic onset detection found about 385 onsets for 240 notes, with a latency search that locked onto the wrong offsets and invented a drift, until per-button envelopes with one latency per run fixed it. Each fix has a synthetic test for its trap, and there's a caveat I also kept in the profile: these numbers come from analysers I revised after seeing the recordings, so the borderline values (1-frame presses, 2 to 3 frame gaps, the jitter σ) should be confirmed later, in the timing epic, on fresh recordings with a frozen analyser.&lt;/p&gt;
&lt;h2&gt;
  
  
  A whole melody
&lt;/h2&gt;

&lt;p&gt;All of the above went into the bundled mapping profile, &lt;code&gt;app/profiles/oot-switch2-1.1.1.toml&lt;/code&gt; (&lt;a href="https://github.com/basteez/bonooru/pull/10" rel="noopener noreferrer"&gt;PR #10&lt;/a&gt;), with the buttons, the modifiers, the stick bytes, the range, the timing, the fingering cost weights and all 45 fingerings, and with a tag on every value saying where it came from (&lt;code&gt;MEASURED&lt;/code&gt;, &lt;code&gt;MARGIN&lt;/code&gt; for a measured value plus a safety margin, &lt;code&gt;OWNER CHOICE&lt;/code&gt;, &lt;code&gt;ESTIMATE&lt;/code&gt; or &lt;code&gt;DESIGN DEFAULT&lt;/code&gt;) plus the test plan row, so that nothing ends up labelled as measured unless it actually was.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="k"&gt;[timing]&lt;/span&gt;
&lt;span class="c1"&gt;# MARGIN: measured 2 frames (33.3 ms), profile 3 frames (50 ms), margin +1 frame (test plan row 2.1, U7).
&lt;/span&gt;&lt;span class="na"&gt;min_press_frames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="c1"&gt;# OWNER CHOICE: 5 frames (83.3 ms), NOT a measured limit (test plan row 2.2, U2).
&lt;/span&gt;&lt;span class="na"&gt;min_gap_same_button_frames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="c1"&gt;# MARGIN: measured 0 frames, profile 1 frame (16.7 ms), margin +1 frame (test plan row 2.3, U5).
&lt;/span&gt;&lt;span class="na"&gt;modifier_lead_frames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# MARGIN: measured 6500 ms, profile 6000 ms, margin 500 ms (test plan row 1.10, U1; Story 1.6).
&lt;/span&gt;&lt;span class="na"&gt;max_sustain_ms&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6000&lt;/span&gt;
&lt;span class="c1"&gt;# DESIGN DEFAULT (not measured): lead before the first event of a timeline.
&lt;/span&gt;&lt;span class="na"&gt;start_lead_ms&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Comments shortened; full file: &lt;a href="https://github.com/basteez/bonooru/blob/2f90b00/app/profiles/oot-switch2-1.1.1.toml#L68-L95" rel="noopener noreferrer"&gt;&lt;code&gt;app/profiles/oot-switch2-1.1.1.toml#L68-L95&lt;/code&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The 45 fingerings were transcribed from the measured table rather than generated from the model, and a test checks them against the model, so the two stay independent; pitches are MIDI numbers of the sounding pitch (A = 81 = A5), and the profile is tied to a game version, so if a patch ever changes the mapping I'll write a new file rather than new code. The &lt;code&gt;max_sustain_ms&lt;/code&gt; value came at the very end of the epic, from timing held notes on A five times per length: up to 6.5 s the note lasted until the release every time, at 7 s it stopped by itself three times out of five, and the 10 s controls stopped between 6599 and 7157 ms, so the profile takes 6000 ms. I didn't measure L, R, Y and X and decided to assume they behave like A, which the profile comment says, and the session had an extra noise source, an air fryer running in the room, so any odd pitches in those recordings were dinner.&lt;/p&gt;

&lt;p&gt;The last story was about playing a whole melody, from a hand-written note list through the measured profile to the console (&lt;a href="https://github.com/basteez/bonooru/pull/11" rel="noopener noreferrer"&gt;PR #11&lt;/a&gt;). I picked the &lt;em&gt;Ode to Joy&lt;/em&gt; theme (Beethoven, public domain) and transposed it to G major at G5 so it fits the range, 62 notes and 64 beats from D5 to D6, and a generator reads every value from the TOML, picks the chart fingering for each note and applies the timing rules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# A (bars 1-4): 3 3 4 5 | 5 4 3 2 | 1 1 2 3 | 3. 2 2
B5 1
B5 1
C6 1
D6 1
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;a href="https://github.com/basteez/bonooru/blob/2f90b00/spikes/samples/story-1-6/ode-to-joy.melody" rel="noopener noreferrer"&gt;&lt;code&gt;spikes/samples/story-1-6/ode-to-joy.melody&lt;/code&gt;&lt;/a&gt;: sounding pitch and length in beats&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The first run at 60 BPM sounded generally good, with some notes missing; the analyser said 56 of 62 notes were audible and every audible note was at the right pitch, and the second run was the same, except that this time I watched the screen and saw that during the silent notes nothing happened at all, as if the button hadn't been pressed. So I started cutting the melody into pieces. With notes 1 to 16 shifted 4 s later and everything 2wiCC sent back logged, note 7 was cut short and note 8 was missing, the event moved with the notes rather than with the elapsed time, and the firmware said nothing at all; notes 6 to 8 on their own played fine three times out of three, while notes 1 to 8 failed in the same way twice out of two. Seventeen identical A5 notes all sounded, but I heard a longer pause after the 7th and the 14th, and I heard it before the analyser did. Then I capped every press at 400 ms, with a neutral gap before every note, and notes 1 to 8 played 8 out of 8, and the full melody 62 out of 62 after re-analysis.&lt;/p&gt;

&lt;p&gt;As far as I can tell, with long (legato) presses the game ends a held note 0.54 to 0.91 s after it starts roughly every seventh sounded note, then ignores input for up to about a second, so a note that follows by hand-over (the next button pressed as the old one is released) gets lost. The audio really is silent, the later notes stay on schedule and 2wiCC reports nothing; I have no idea what the mechanism is, so for now it stays a hypothesis, and the workaround for the spike is staccato, every press capped at 400 ms. For the real pipeline I'd rather split long notes into repeated short presses so durations stay audible, but that's a follow-up I haven't tested yet.&lt;/p&gt;

&lt;p&gt;There was one more missing note, and that one was on me, or rather on Beethoven. At 90 BPM, with the cap, I heard the second note of the last phrase go missing, while the analyser said every note sounded and the recording showed both B5 presses at full level: the file used Beethoven's syncopated entry, where the B5 starts on beat 4 and is tied over the bar line, and with a 400 ms cap that becomes a short early B5 followed by almost a second of silence over the downbeat, which my ear heard as a hole. I switched to the simplified rhythm most people know, with two B attacks on beats 1 and 2, the same 62 notes and 64 beats, and it finally sounded the way I remember it.&lt;/p&gt;

&lt;p&gt;The three official runs at 90 BPM with the final file were 62 out of 62 audible and in tune each time, within −3 to +2 cents, and they sounded fine to me (the third has one raw "cut" flag on a D6 that faded to 300 of its 400 ms, which reads as the quiet X note fading rather than a drop). I haven't shown 60 BPM with the final file, the 120 BPM stress run or legato playing, and of everything in this epic, the times my ear and the analyser disagreed were the most useful: once the ear was right, with the pause after the seventh note, and once the score was "wrong", with the syncopation, and recording both side by side is the only reason I found out.&lt;/p&gt;

&lt;p&gt;I plan and build Bonooru with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMad Method&lt;/a&gt; and AI agents (Claude), and the spike stories were split in two: the generators, the sender, the analysers and the tests need no console, so an agent wrote them alone, while everything that needs the Switch I ran at the console myself, with the agent preparing the trial files and recording the numbers exactly as measured. At the end of the epic &lt;code&gt;spikes/&lt;/code&gt; had 570 tests, none of which needs hardware, and all the measurements live in &lt;a href="https://github.com/basteez/bonooru/blob/2f90b00/docs/test-plan.md" rel="noopener noreferrer"&gt;&lt;code&gt;docs/test-plan.md&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/basteez/bonooru/blob/2f90b00/docs/ocarina-input-mechanics.md" rel="noopener noreferrer"&gt;&lt;code&gt;docs/ocarina-input-mechanics.md&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Everything in &lt;code&gt;spikes/&lt;/code&gt; will be thrown away; what I keep from Epic 1 is the profile and the measurements, along with the slightly uncomfortable feeling of having spent two days on someone else's firmware, which is why the next devlog is about my own controller firmware on the RP2040 and the first time the Switch 2 accepts it as a controller.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is an unofficial fan project for personal, offline fun. It is not affiliated with, endorsed or sponsored by Nintendo. The Legend of Zelda and Nintendo Switch are trademarks of Nintendo. No game code, assets or console modifications are involved.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>embedded</category>
      <category>python</category>
      <category>raspberrypi</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Bonooru Devlog #0: Teaching a Switch 2 to play the ocarina</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Mon, 23 Nov 2026 11:41:57 +0000</pubDate>
      <link>https://dev.to/basteez/bonooru-devlog-0-teaching-a-switch-2-to-play-the-ocarina-3hb8</link>
      <guid>https://dev.to/basteez/bonooru-devlog-0-teaching-a-switch-2-to-play-the-ocarina-3hb8</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://bstz.it/p/bonooru-devlog-0/" rel="noopener noreferrer"&gt;my blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I want Link to play anything I give him on his ocarina, whether it's a MIDI file, a tune I type in, &lt;em&gt;Ode to Joy&lt;/em&gt; or the theme of some other game, and I want him to do it on my own Switch 2, in the real game, with no mods and without me pressing a single button; this is the first post about how I'm building that.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Legend of Zelda: Ocarina of Time&lt;/em&gt; came out again on Switch 2, and in this version the ocarina is played with buttons: five buttons give five notes, and the D-pad and the left stick bend them up or down, which turns it into a 19-note chromatic instrument, from B4 to F6, that you play with a controller. &lt;a href="https://github.com/basteez/bonooru" rel="noopener noreferrer"&gt;Bonooru&lt;/a&gt; is my side project that plays that instrument for you, and it's made of a desktop app, which turns a score into a timeline of button presses, and two tiny RP2040-Zero boards, which pretend to be a wired Pro Controller and press the buttons on time. It doesn't play the game for you, it deliberately leaves the 12 official songs alone, and it doesn't touch the console or the game; it's offline, single player, and just for fun.&lt;/p&gt;

&lt;p&gt;The name comes from the game itself: Bonooru is one of the two scarecrows in &lt;em&gt;Ocarina of Time&lt;/em&gt;, the one at Lake Hylia who listens to a melody Link makes up on the ocarina and remembers it, which, for a project about teaching Link songs he doesn't know, felt like a fairly obvious choice.&lt;/p&gt;

&lt;p&gt;The idea isn't entirely mine, either. &lt;a href="https://riidraw.com" rel="noopener noreferrer"&gt;RiiDraw&lt;/a&gt; already uses two RP2040-Zero boards to draw pictures automatically in another Switch game, and I had it running on my console, which was a fairly strong hint that the same two boards could press ocarina buttons just as well as they draw pictures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two boards and three wires
&lt;/h2&gt;

&lt;p&gt;The hardware is two RP2040-Zero boards (a Raspberry Pi RP2040 chip on a board the size of a stamp), three jumper wires and two USB-C data cables, and that's really all of it, with no soldering involved.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg6fp6x0wlghwvyuttixy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg6fp6x0wlghwvyuttixy.jpg" alt="The two RP2040-Zero boards on a breadboard, wired to a MacBook and to a Switch 2 in handheld mode resting on the keyboard" width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;My setup: the two boards on the breadboard, one cable to the Mac and one to the Switch 2. The Mac screen is blurred, and the Arduino Uno underneath isn't part of it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8sdenurtf7hkf0uwu6ur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8sdenurtf7hkf0uwu6ur.png" alt="Wiring diagram: PC to bridge RP2040-Zero over USB-C, bridge GP0 TX to controller GP1 RX, controller GP0 TX to bridge GP1 RX, GND to GND, controller to Switch 2 over USB-C" width="800" height="454"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The wiring: TX to RX, RX to TX, ground to ground, while 5V and 3V3 stay unconnected. (A schematic: pins are drawn by name, not where they sit on the board.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fikrrs1y9rkmtn89rkmz1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fikrrs1y9rkmtn89rkmz1.png" alt="The whole system: the app on the PC, the bridge board, the controller board and the console" width="800" height="97"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The whole system: the app on the PC, the bridge board, the controller board and the console&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The RP2040-Zero has exactly one USB port, which has to act as a USB &lt;em&gt;device&lt;/em&gt; towards the Switch 2, and since the PC needs a data link of its own, the work is split between two boards: the &lt;em&gt;bridge&lt;/em&gt; talks USB to the PC and UART to the other board, and the &lt;em&gt;controller board&lt;/em&gt; talks UART to the bridge and USB to the console. UART here is just two data wires at 3.3 V plus a common ground, and it's the same layout RiiDraw and its firmware, 2wiCC, use, so I knew it worked on my console before writing a line of code. A USB-to-serial adapter, or a second USB port bit-banged in software with &lt;a href="https://github.com/sekigon-gonnoc/Pico-PIO-USB" rel="noopener noreferrer"&gt;Pico-PIO-USB&lt;/a&gt;, would also work; the second might come back later as an experiment.&lt;/p&gt;

&lt;p&gt;The console also has to accept the controller board as a controller, and there were three candidates: a HORI Pokkén pad (0F0D:0092), which is plain HID with no handshake but which I'd only seen in community reports on Switch 2; a Switch 2 Pro Controller (057E:2069), whose handshake includes a key exchange that one open-source project handles; and the wired Switch 1 Pro Controller (057E:2009), which RiiDraw and 2wiCC already use on my console. I went with the last one, the only one I'd actually seen working, even if it needs "Pro Controller Wired Communication" turned on in the system settings and a small handshake that I'll write from public reverse-engineering notes. The firmware keeps the profile behind one interface, so if Nintendo ever drops it another profile can take its place without touching the protocol or the app.&lt;/p&gt;

&lt;p&gt;The firmware for both boards is my own, in C on &lt;a href="https://github.com/raspberrypi/pico-sdk" rel="noopener noreferrer"&gt;pico-sdk&lt;/a&gt; and &lt;a href="https://github.com/hathach/tinyusb" rel="noopener noreferrer"&gt;TinyUSB&lt;/a&gt;. 2wiCC has no licence, so I only use its published binaries for early experiments and read its sources to understand the behaviour, without copying any code, and everything in the repo is MIT.&lt;/p&gt;
&lt;h2&gt;
  
  
  Keeping time
&lt;/h2&gt;

&lt;p&gt;What the ocarina cares about is when each button goes down, and since the game runs at 60 frames per second, the goal is to start every note within one frame (16.7 ms) of where it should be, without drifting over a whole song. A PC can't really promise that, because Windows can delay a thread by 1 to 15 ms, USB serial buffers data, and any pause in the app ends up in the music; RiiDraw, which sends its picture frame by frame, ran into desync problems on big drawings.&lt;/p&gt;

&lt;p&gt;The way around it is that the PC doesn't keep time at all: the app compiles the whole piece into a list of events, each one saying "at time &lt;em&gt;t&lt;/em&gt;, in microseconds from the start, the controller state becomes &lt;em&gt;s&lt;/em&gt;", and streams them ahead of time to the controller board, which buffers them and applies each one from a 1 MHz hardware timer. All the app has to do is keep that buffer from running empty, with credit-based flow control, where the controller board tells the app how much room it has left.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fscfxe5dklh9rdp6376h6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fscfxe5dklh9rdp6376h6.png" alt="Planned controller firmware: frames in from the UART, events out to USB on a hardware clock" width="800" height="1468"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Planned controller firmware: frames in from the UART, events out to USB on a hardware clock&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The one rule in the spec that outranks everything else is not to hurt the console. The wiring is only GP0, GP1 and GND, never 5 V or 3.3 V, and the firmware never touches the power path; while a song plays, the controller board only lets through the inputs the ocarina needs (L, R, A, X, Y, the D-pad and the left stick), never Home, Capture, + or −, and it refuses any controller firmware-update request from the console. If the link drops mid-song, because I trip over the cable or the app crashes, a watchdog on the controller board releases every button on its own within 100 ms, since a stuck note is merely annoying, while a button held down in a system menu is something I'd rather not find out about.&lt;/p&gt;

&lt;p&gt;The app and the controller board speak one small binary protocol, and the bridge in the middle doesn't understand it: it's a frame-aware pipe that forwards whole frames from USB to UART, plus a heartbeat of its own so the controller board knows the bridge is still alive. Frames are COBS-encoded (Consistent Overhead Byte Stuffing, which guarantees that &lt;code&gt;0x00&lt;/code&gt; never appears inside a frame, so it can mark the end of one and the receiver resyncs at the next zero after any garbage), and each one carries a CRC-16 checksum to catch corrupted bytes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type:u8 | seq:u8 | len:u8 | body[len] | crc16:u16le
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A controller state is 8 bytes, with 16 button bits, the D-pad as a hat value, two sticks and a flags byte, and those 8 bytes are the same for every profile, with only the profile module turning them into a USB report. The main messages are &lt;code&gt;HELLO&lt;/code&gt; and &lt;code&gt;INFO&lt;/code&gt; to start a session and check versions, &lt;code&gt;SET_STATE&lt;/code&gt; for real-time input from the on-screen gamepad, &lt;code&gt;QUEUE_EVENT&lt;/code&gt; to buffer timed states, &lt;code&gt;START&lt;/code&gt; and &lt;code&gt;STOP&lt;/code&gt; for playback, and &lt;code&gt;STATUS&lt;/code&gt; so the app can show what's going on. I chose binary over a text protocol like 2wiCC's because it's smaller and the CRC catches errors, even if an ASCII line is easier to type in a terminal; for debugging, the app will get a hidden panel that shows and sends raw frames.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a score to button presses
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foz71i0ioxohm29cn0wss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foz71i0ioxohm29cn0wss.png" alt="The score pipeline in the app" width="800" height="1407"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The score pipeline in the app&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The ocarina plays one note at a time and covers 19 semitones, so most music has to be squeezed into it: one voice, transposed to fit, and whatever still doesn't fit is shown note by note so the user can decide what to do with it. Many pitches can be played in more than one way, with a button plus some modifiers, so the fingering step uses dynamic programming to find the sequence that changes modifiers the least. All the game-specific numbers, which button plays which pitch, how long a press has to be, how long a note can last, live in a mapping profile, a TOML file per game version, so if a game update ever changes the mapping it will take a new file rather than new code. When I wrote the plan most of those numbers came from community guides and were marked &lt;code&gt;HYPOTHESIS&lt;/code&gt;, and measuring them is what the first epic is about.&lt;/p&gt;

&lt;p&gt;The app is written in Rust with &lt;a href="https://github.com/emilk/egui" rel="noopener noreferrer"&gt;egui&lt;/a&gt;/eframe, one native binary per OS (Windows, Linux and macOS), with no toolchain or runtime to install and no terminal to open: you import a song, see it on a piano roll with the fingering of every note, listen to a preview on the PC and then play it on the console. There's also an on-screen gamepad to walk Link to a quiet spot and take out the ocarina, three status lights for the three links, and a wizard that flashes both boards, where you hold BOOT, plug the board in and pick its role. The look evokes the game without borrowing anything from it, so no logos, no character art and no screenshots.&lt;/p&gt;

&lt;p&gt;My first plan was actually Python, but before committing to it I had an agent build a throwaway Rust + egui spike, with device discovery, a piano roll, an audio preview and the flasher logic, and measure it on my Mac:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Rust + egui spike&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Release binary&lt;/td&gt;
&lt;td&gt;10.9 MB (4.8 MB zipped)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cold start to first frame&lt;/td&gt;
&lt;td&gt;~115 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frame time with ~2,000 notes on screen&lt;/td&gt;
&lt;td&gt;p95 1.5 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Idle CPU&lt;/td&gt;
&lt;td&gt;0.2 %&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Python + PySide6 option would have shipped about 113 MB, with LGPL obligations and antivirus false positives from the packager, so the choice turned out to be an easy one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it's going
&lt;/h2&gt;

&lt;p&gt;The roadmap tackles the hardware risks first. Before I wrote any code, the Switch 2 had already accepted an RP2040-Zero pressing A, through RiiDraw, and I'd settled on the wired Pro Controller; next comes measuring the ocarina, then my own controller and bridge firmware, the app with its status lights and gamepad, a first song on the console, timing checks on three operating systems, flashing from the app and, eventually, a 1.0, with a live MIDI keyboard and a calibration wizard as optional extras. What worried me most was that the ocarina wouldn't behave the way the community chart says, and that the scope was too big for a fun project, with the first real song only arriving halfway through; the answer to both is to check the ocarina by hand before writing any code and to get a script playing a whole melody through existing firmware as early as possible, what's usually called a walking skeleton. I'll consider 1.0 done when someone who isn't me can wire two boards, flash both from the app and play a one-minute piece covering all 19 pitches with zero wrong notes.&lt;/p&gt;

&lt;p&gt;I plan and build Bonooru with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMad Method&lt;/a&gt; and AI agents (Claude). It started as a set of notes in my org-roam vault inside Emacs, which became a spec with eight ADRs, then 21 architecture decisions, a UX spec with HTML mockups (&lt;a href="https://github.com/basteez/bonooru/pull/1" rel="noopener noreferrer"&gt;PR #1&lt;/a&gt;) and finally 12 epics and 79 stories (&lt;a href="https://github.com/basteez/bonooru/pull/2" rel="noopener noreferrer"&gt;PR #2&lt;/a&gt;, &lt;a href="https://github.com/basteez/bonooru/pull/4" rel="noopener noreferrer"&gt;PR #4&lt;/a&gt;). Every story then goes through the same loop, a story file with acceptance criteria, a dev agent that implements it, a code review and fixes I approve, and whatever needs the console I run at the console myself. The project was called "Ocarina Bot" until the end of the first epic, so some early files still carry that name.&lt;/p&gt;

&lt;p&gt;Before writing any firmware, the next step is to grab a real controller, a tuner and a microphone and find out how the ocarina actually behaves, and, without spoiling too much, the community chart turns out to be right about the buttons and wrong about something else.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is an unofficial fan project for personal, offline fun. It is not affiliated with, endorsed or sponsored by Nintendo. The Legend of Zelda and Nintendo Switch are trademarks of Nintendo. No game code, assets or console modifications are involved.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>embedded</category>
      <category>rust</category>
      <category>raspberrypi</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Wild Shift Devlog #6: I couldn't find my own @</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Tue, 17 Nov 2026 18:14:06 +0000</pubDate>
      <link>https://dev.to/basteez/wild-shift-devlog-6-i-couldnt-find-my-own--2kbm</link>
      <guid>https://dev.to/basteez/wild-shift-devlog-6-i-couldnt-find-my-own--2kbm</guid>
      <description>&lt;p&gt;Sixth update on &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, my GitHub Game Off 2026 entry (theme: &lt;strong&gt;SHIFT&lt;/strong&gt;). &lt;a href="https://bstz.it/p/wild-shift-devlog-5/" rel="noopener noreferrer"&gt;Devlog #5&lt;/a&gt; covered the first playtest and the new tutorial. This post is a mirror of the &lt;a href="https://basteez.itch.io/wild-shift/devlog/1786885/devlog-6-i-couldnt-find-my-own-turning-the-background-down" rel="noopener noreferrer"&gt;sixth devlog on itch.io&lt;/a&gt;. You can also play the current build in the browser on the &lt;a href="https://basteez.itch.io/wild-shift" rel="noopener noreferrer"&gt;game page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Small devlog, one bug: &lt;strong&gt;I couldn't find my own player.&lt;/strong&gt; I was looking at screenshots of the tutorial and kept losing the &lt;code&gt;@&lt;/code&gt; in the grass. When everything on screen is the same white glyph on the same black background, the player, the bosses, the tutorial text and the scenery all shout at the same volume. So this update turns the background down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyevcnrs0wa318s4npfuj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyevcnrs0wa318s4npfuj.png" alt="Before: the tutorial text and the player blend into the scenery" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Before: the &lt;code&gt;@&lt;/code&gt;, the dummy, the checklist and the hints all blend into the grass.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Turning the background down
&lt;/h2&gt;

&lt;p&gt;The game uses two colours, ink and near-black, and that isn't changing. What I can change is how much ink each thing gets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The scenery is dithered.&lt;/strong&gt; Grass, rocks and water now keep one pixel in four. They read as texture, and everything drawn in full ink (you, the bosses, the tree ring around the arena) comes forward on its own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Water is &lt;code&gt;=&lt;/code&gt; now.&lt;/strong&gt; The old &lt;code&gt;~&lt;/code&gt; turned into a row of slashes once it was dithered, which looked like rain. &lt;code&gt;=&lt;/code&gt; dithers into a calm double line, and it's also very much a programming language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actors get some room.&lt;/strong&gt; Grass never grows right next to you or a boss: the ground around every actor is cleared, so nothing touches their outline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2dngjr5p9a8jo3337bx5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2dngjr5p9a8jo3337bx5.png" alt="After: dithered scenery and the tutorial in the console" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After: the tutorial lives in the console, and the arena only has what you need to fight.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Text goes where text belongs
&lt;/h2&gt;

&lt;p&gt;The tutorial checklist (&lt;code&gt;[PASS] test_move&lt;/code&gt;…) was drawn in big letters right on the battlefield. But it's literally the output of a test runner, so now it runs where test runners print: in the &lt;strong&gt;console&lt;/strong&gt; under the arena. The checklist sits on the left, the current instruction on the right, and your hits (&lt;code&gt;console.log("-10")&lt;/code&gt;, &lt;code&gt;CRITICAL: 30 dmg&lt;/code&gt;) scroll under it. The practice mode's frame counter moved there too.&lt;/p&gt;

&lt;h2&gt;
  
  
  The top bar
&lt;/h2&gt;

&lt;p&gt;The two lines at the top of the screen were easy to miss, and it turned out there was a reason: the pixel font has no space above its capitals, so the first row sat flush against the edge of the screen and looked cut off. The boss signature and your &lt;code&gt;hp: 0b11111&lt;/code&gt; are now an inverted title bar, like an IDE tab. The comment under it got a line for each mode too, so the tutorial says &lt;code&gt;// TODO: write the tests first&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5p5bxxt03y17wu89gnoy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5p5bxxt03y17wu89gnoy.png" alt="Segfault's SIGSEGV INCOMING warning under the title bar" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Segfault's &lt;code&gt;SIGSEGV INCOMING&lt;/code&gt; warning now gets its own inverted strip under the title bar.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;Same as before: I direct and playtest, AI agents (Claude) write the code from specs I approve with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD Method&lt;/a&gt;, and every story is a pull request with a code review and automated tests (&lt;strong&gt;132 test files&lt;/strong&gt; now). This one started as a quick prototype that I could look at before anything was planned, and two rounds of "still too busy" later it became a story. Lesson from the last devlog applied: every step was checked in the exported web build, not just in the tests. That's how the sky comment got un-dithered again: at 1x, dithered text simply turns into dots.&lt;/p&gt;

&lt;p&gt;Everything is public in the &lt;a href="https://github.com/basteez/the-debugger-0x3-wild-shift" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;Still the same list, now with a calmer screen: a second round of playtests, the browser check (Chrome, Firefox, Safari), real music to replace my placeholder loops, and the jam submission (my target is November 29, Game Off closes December 1). The new build is live on this page. If you lose the &lt;code&gt;@&lt;/code&gt; again, tell me.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>gamedev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Wild Shift Devlog #5: Someone else played it</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Tue, 17 Nov 2026 15:48:35 +0000</pubDate>
      <link>https://dev.to/basteez/wild-shift-devlog-5-someone-else-played-it-39om</link>
      <guid>https://dev.to/basteez/wild-shift-devlog-5-someone-else-played-it-39om</guid>
      <description>&lt;p&gt;Fifth update on &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, my GitHub Game Off 2026 entry (theme: &lt;strong&gt;SHIFT&lt;/strong&gt;). &lt;a href="https://bstz.it/p/wild-shift-devlog-4/" rel="noopener noreferrer"&gt;Devlog #4&lt;/a&gt; covered save, gamepad and practice mode. This post is a mirror of the &lt;a href="https://basteez.itch.io/wild-shift/devlog/1786585/devlog-5-someone-else-played-it-a-tutorial-a-fairer-and-a-backlog-burn-down" rel="noopener noreferrer"&gt;fifth devlog on itch.io&lt;/a&gt;. You can also play the current build in the browser on the &lt;a href="https://basteez.itch.io/wild-shift" rel="noopener noreferrer"&gt;game page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The first person who isn't me played &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, and the bug report was short: &lt;em&gt;"I can't work out what to do."&lt;/em&gt; Fair. A debugger that needs a debugger isn't a great look. So this devlog is about the oldest fix in the book: watching someone use your thing and then rewriting it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The playtest (Epic 8)
&lt;/h2&gt;

&lt;p&gt;The first external playtester got further than the bug report suggests. Eventually they worked out that the highlighted &lt;code&gt;;&lt;/code&gt; wasn't a floppy disk, and they even got the boss to say &lt;code&gt;// patched&lt;/code&gt; a couple of times. They just didn't know how. After reading the instructions on this page, the next questions were the right ones: &lt;em&gt;is it vulnerable after it fires? when the &lt;code&gt;;&lt;/code&gt; is highlighted? do I have to hit it from the inside?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two problems hid behind those questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nothing taught the controls one at a time.&lt;/strong&gt; The duck's tutorial lines showed up in a small bubble &lt;em&gt;during&lt;/em&gt; the first boss fight, while a spinning loop was trying to eat you. Reading while dodging is not onboarding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The weak spot was hard to read and hard to hit.&lt;/strong&gt; The Infinite Loop's &lt;code&gt;;&lt;/code&gt; is its only weak point, and it was a single inverted character on a ring that spins faster every lap. Missing it gave no feedback at all.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A tutorial that runs like a test suite
&lt;/h2&gt;

&lt;p&gt;Before Boss 1 there is now a short tutorial, framed as the only thing a programmer trusts: a test suite. You stand in The Clearing next to a training dummy, &lt;code&gt;{;}&lt;/code&gt;, that never fights back. A checklist sits in the middle of the screen, and each line flips from &lt;code&gt;[ ]&lt;/code&gt; to &lt;code&gt;[PASS]&lt;/code&gt; when you actually do the thing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;test_move&lt;/code&gt;: walk around.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test_actions&lt;/code&gt;: J runs the left live bit, K the right one. A is a slash, D is a dash.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test_shift&lt;/code&gt;: Q and E rotate the register until the live bits read &lt;code&gt;A D&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test_combo&lt;/code&gt;: J then K, fast. That's Dash Strike.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test_patch&lt;/code&gt;: dash through the dummy's &lt;code&gt;;&lt;/code&gt; while it's lit. &lt;code&gt;// patched&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test_crit&lt;/code&gt;: hit it again while it's patched and watch the damage triple.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When all six pass: &lt;code&gt;ALL TESTS PASSED.&lt;/code&gt; / &lt;code&gt;deploying to production...&lt;/code&gt;, and the real fight starts. It only runs on your first run. You can skip it by holding Esc or Backspace, and replay it any time from the title with &lt;strong&gt;[T]&lt;/strong&gt;. If you play on a gamepad, the prompts show pad buttons instead of keys.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv9e3ehp0e8ply79q2hfx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv9e3ehp0e8ply79q2hfx.png" alt="The tutorial checklist halfway through" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The tutorial checklist, halfway through the suite.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkwn4agirp2jkvd4wieir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkwn4agirp2jkvd4wieir.png" alt="All six tests passed" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;All six tests passed. Next stop: production.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hitting the &lt;code&gt;;&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A bigger target.&lt;/strong&gt; The &lt;code&gt;;&lt;/code&gt; hitbox is now twice as wide (1 tile instead of half a tile). If you're close enough to look right, you're close enough to count.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A clear "open" signal.&lt;/strong&gt; While the &lt;code&gt;;&lt;/code&gt; is open, a marker points at it from inside the ring and a small bar counts down the frames you have left. Closed, it's just a plain glyph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Misses talk back.&lt;/strong&gt; Hit the body instead of the &lt;code&gt;;&lt;/code&gt; and the log tells you why: &lt;code&gt;// miss: ";" is closed&lt;/code&gt; or &lt;code&gt;// miss: aim for the ";"&lt;/code&gt;. The answer to "do I have to hit it from the inside?" is now on screen: no, you have to hit the &lt;code&gt;;&lt;/code&gt;, from any side, while it's open.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzhsztggcdslg34xdwjas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzhsztggcdslg34xdwjas.png" alt="The open semicolon on the Infinite Loop" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The open &lt;code&gt;;&lt;/code&gt; (the inverted cell on the left of the ring), with its marker pointing at it from inside.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Paying off the backlog (Epic 9)
&lt;/h2&gt;

&lt;p&gt;Every code review in this project writes down what it decided not to fix. After eight epics that list had grown to about 400 lines, so I had all of them checked against the current code. Most were already fixed by later work, needed a human (me, with a browser), or weren't worth it before the deadline. The handful that were real became six small stories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No more accidental starts.&lt;/strong&gt; Coming back to the title from the tutorial, the ending or practice, the game ignores input for half a second, so a mashed key doesn't throw you into a new run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[N] asks twice.&lt;/strong&gt; Starting a new run now takes a second press (&lt;code&gt;PRESS N AGAIN: WIPE PROGRESS&lt;/code&gt;). And once you've beaten the game, the title starts a fresh run instead of dropping you back in front of the final boss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Honest assist.&lt;/strong&gt; Toggling &lt;strong&gt;[B] debug build&lt;/strong&gt; mid-fight now says &lt;code&gt;NEXT ATTEMPT&lt;/code&gt;, because that's when it applies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unplug, pause.&lt;/strong&gt; If your gamepad disconnects mid-fight, the game pauses instead of letting you die.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A tougher save.&lt;/strong&gt; If one value in the save file is broken, only that value resets. The rest of your progress survives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quieter misses.&lt;/strong&gt; No miss messages while the loop is blinking out of existence, or for Echo replays.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;Same as before: I direct and playtest, AI agents (Claude) write the code from specs I approve with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD Method&lt;/a&gt;, and every story is a pull request with a code review and automated tests. This time the playtest feedback went straight into new stories: the two Epic 8 stories went from a Slack message to a deployed build on the same day. The suite went from 121 to &lt;strong&gt;131 test files&lt;/strong&gt;, and CI now also runs the tests in a shuffled order, which immediately caught a test that only passed because of the order it ran in.&lt;/p&gt;

&lt;p&gt;One more bug report came from the screenshots for this very post: in the exported web build the tutorial checklist was invisible. Every test passed, because the tests read the text file directly, while the export quietly emptied three lists of strings on the way into the build. It's fixed, and a new test now scans the code for the pattern that caused it. Lesson re-learned: the build you ship is the only build that counts.&lt;/p&gt;

&lt;p&gt;Everything is public in the &lt;a href="https://github.com/basteez/the-debugger-0x3-wild-shift" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;More people playing it: a second round of playtests with the tutorial in place, and the browser check (Chrome, Firefox, Safari). Then the music. Confession: I can't compose, and the loops you hear now are still placeholders, so finding real music for three bosses is the next puzzle. Then the jam submission: my internal deadline is November 29, and Game Off itself closes on December 1. The current build is playable on this page, and if you get stuck, that's a bug report I want.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>showdev</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Wild Shift Devlog #4: Don't lose your run</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Sun, 15 Nov 2026 16:49:02 +0000</pubDate>
      <link>https://dev.to/basteez/wild-shift-devlog-4-dont-lose-your-run-4k86</link>
      <guid>https://dev.to/basteez/wild-shift-devlog-4-dont-lose-your-run-4k86</guid>
      <description>&lt;p&gt;Fourth update on &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, my GitHub Game Off 2026 entry (theme: &lt;strong&gt;SHIFT&lt;/strong&gt;). &lt;a href="https://bstz.it/p/wild-shift-devlog-1/" rel="noopener noreferrer"&gt;Devlog #1&lt;/a&gt; covered the register and the shift, &lt;a href="https://bstz.it/p/wild-shift-devlog-2/" rel="noopener noreferrer"&gt;Devlog #2&lt;/a&gt; the first two bosses, &lt;a href="https://bstz.it/p/wild-shift-devlog-3/" rel="noopener noreferrer"&gt;Devlog #3&lt;/a&gt; the final boss and the ending. This post is a mirror of the &lt;a href="https://basteez.itch.io/wild-shift/devlog/1777465/devlog-4-dont-lose-your-run-save-gamepad-practice-mode-and-placeholder-music" rel="noopener noreferrer"&gt;fourth devlog on itch.io&lt;/a&gt;. You can also play the current build in the browser on the &lt;a href="https://basteez.itch.io/wild-shift" rel="noopener noreferrer"&gt;game page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The game is complete, and now it has to survive other people. Since the last devlog &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt; got its audio plumbing, a final sound pass, save and resume, a gamepad, a practice mode and a few quality-of-life switches. Less &lt;code&gt;console.log("boss")&lt;/code&gt;, more &lt;code&gt;return 0;&lt;/code&gt; with a nice exit code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sound (Epic 7, part 1)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Music plumbing.&lt;/strong&gt; Each fight now has its own track and the game crossfades into it. In phase 3 a glitched variant of the track fades in step with the original, and while Breakpoint is active the music drops into a muffled loop, like someone put a pillow on the speakers. Dying and retrying is an instant cut, so you never wait for a song to catch up with your second attempt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heads up: the tracks you hear right now are placeholders.&lt;/strong&gt; They are generated loops that only prove the wiring works. I'm composing the real ones in BeepBox, and they'll drop in under the same file names with no code change. Please don't judge the music yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Final SFX pass.&lt;/strong&gt; 15 sound effects, all generated procedurally by a small script, so they are mine by construction. The two shift directions now have distinct clicks, every boss attack has its own tell cue (a sound before a hit, same rule as the visual tells), and the duck got a proper squeak.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Don't lose your run (Epic 7, part 2)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Save and resume.&lt;/strong&gt; The game remembers the highest boss you reached. The title screen resumes from there, and &lt;strong&gt;[N]&lt;/strong&gt; starts a new run. Mute is remembered too. If saving isn't available (private window, blocked storage), it silently falls back to a normal session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[B] debug build.&lt;/strong&gt; An optional assist toggle for people who want to see the story: 8 HP instead of 5, a shorter Breakpoint cooldown, and slower boss tells. Damage numbers stay the same. It's saved, and it's named after the only thing a debugger really wants.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gamepad.&lt;/strong&gt; Stick or d-pad to move, face and shoulder buttons for the actions and shifts, the right trigger for Breakpoint, Start to pause. Any button advances the title, intro and ending screens, so you can play start to finish without touching the keyboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[F] fullscreen.&lt;/strong&gt; On the title and the pause screen, by key, click or pad.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practice (Epic 7, part 3)
&lt;/h2&gt;

&lt;p&gt;The title screen now has &lt;strong&gt;[P] practice&lt;/strong&gt;: a fight against the &lt;code&gt;/* test */&lt;/code&gt; dummy with a hit log and a &lt;code&gt;frames N&lt;/code&gt; counter, available in every build. You can cycle through loadouts with L, so you can try a combo before you have earned it in the run. It writes nothing to your save and has no intro. Esc takes you back to the title.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbpdd4z7bhupnllxgc8dp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbpdd4z7bhupnllxgc8dp.png" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The title screen with the new options. ([N] new run shows up once you have a save.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffton08bp024ubvqlh4zp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffton08bp024ubvqlh4zp.png" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Practice mode: the `/&lt;/em&gt; test &lt;em&gt;/` target, the hit log and the frame counter.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fko20ezgwz69167rvgm1w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fko20ezgwz69167rvgm1w.png" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The pause screen now has mute, debug build and fullscreen rows.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring the run
&lt;/h2&gt;

&lt;p&gt;The last code story is a small playtest harness: the game prints &lt;code&gt;[metrics]&lt;/code&gt; lines with the time to the first shift, the time and deaths per boss, and a total for a full run. No gameplay value changed, it only counts. I'll use it to tune what the numbers say is too hard or too easy, instead of what I feel at 1 a.m.&lt;/p&gt;

&lt;p&gt;I also added a build-size check to CI (the web build must stay under 32 MB), and the README, credits and this page's copy are done. The credits include &lt;strong&gt;mumble-speech&lt;/strong&gt;, my own library, for the duck's voice.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;Same as before: I'm the director and the playtester, AI agents (Claude) write the code from specs I approve with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD Method&lt;/a&gt;, and every story is a pull request with code review and automated tests. The test suite went from 112 to &lt;strong&gt;121 test files&lt;/strong&gt;. Everything is public in the &lt;a href="https://github.com/basteez/the-debugger-0x3-wild-shift" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;What's left is the part only people can do: a full-run playtest, a browser check (Chrome, Firefox, Safari), the final BeepBox music, and the jam submission, with a deadline on November 29. If you want to help break it, the current build is playable on this page.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>gamedev</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Wild Shift Devlog #3: SIGSEGV incoming</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Fri, 13 Nov 2026 09:40:25 +0000</pubDate>
      <link>https://dev.to/basteez/wild-shift-devlog-3-sigsegv-incoming-l4h</link>
      <guid>https://dev.to/basteez/wild-shift-devlog-3-sigsegv-incoming-l4h</guid>
      <description>&lt;p&gt;Third update on &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, my GitHub Game Off 2026 entry (theme: &lt;strong&gt;SHIFT&lt;/strong&gt;). &lt;a href="https://bstz.it/p/wild-shift-devlog-1/" rel="noopener noreferrer"&gt;Devlog #1&lt;/a&gt; covered the register and the shift, &lt;a href="https://bstz.it/p/wild-shift-devlog-2/" rel="noopener noreferrer"&gt;Devlog #2&lt;/a&gt; the first two bosses. This post is a mirror of the &lt;a href="https://basteez.itch.io/wild-shift/devlog/1774453/devlog-3-sigsegv-incoming-segfault-two-new-combos-an-intro-and-an-ending" rel="noopener noreferrer"&gt;third devlog on itch.io&lt;/a&gt;. You can also play the current build in the browser on the &lt;a href="https://basteez.itch.io/wild-shift" rel="noopener noreferrer"&gt;game page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The last bug is in. Since the last devlog &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt; got its final boss, two new combos, an intro and an ending. For the first time the run has a beginning, a middle and a &lt;code&gt;return 0;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two new combos (Epic 6)
&lt;/h2&gt;

&lt;p&gt;With all four bits in the register (&lt;code&gt;[A, D, L, N]&lt;/code&gt;) there are new pairs to read, and two of them are now real combos:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ghost Echo (&lt;code&gt;L→N&lt;/code&gt;).&lt;/strong&gt; Echo, then Null Dodge: you turn intangible and leave a &lt;strong&gt;decoy&lt;/strong&gt; where you started. For two seconds the boss aims at the decoy instead of you. If an attack hits the decoy while the boss's weak window is &lt;code&gt;L→N&lt;/code&gt;, the boss is &lt;strong&gt;Patched&lt;/strong&gt;. You don't hit the boss, you let it hit itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dereference (&lt;code&gt;N→A&lt;/code&gt;).&lt;/strong&gt; Press K while your Null Dodge is still active and you thrust 3 tiles forward, intangible, piercing everything in the line. It's the strongest single hit in the game, and with Patched plus Clean Catch it goes from 30 to 68. Press it too late and you get a plain slash instead: &lt;em&gt;dereference after free is undefined behaviour.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Segfault: the bug that touches memory it shouldn't
&lt;/h2&gt;

&lt;p&gt;The final boss is &lt;strong&gt;Segfault&lt;/strong&gt;, a glitch dragon of &lt;code&gt;▓▒░#@!&lt;/code&gt; glyphs, 1000 HP, crawling back and forth across the top third of the arena. The sky comment reads &lt;code&gt;// HACK: do not read past this line&lt;/code&gt;, and nobody listened.&lt;/p&gt;

&lt;p&gt;Its three phases want the three combos you've been collecting: &lt;code&gt;D→L&lt;/code&gt; (Echo Dash through the claw), then &lt;code&gt;N→A&lt;/code&gt; (Dereference), then &lt;code&gt;L→N&lt;/code&gt; (Ghost Echo). Every combo you learned in the run has a job here.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Access Violation.&lt;/strong&gt; The claw's arc and the exact rectangle it will sweep are drawn for half a second before it swipes. Step out of the box and you're fine. Stay in it and you learn something.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Corrupt Memory.&lt;/strong&gt; 8 to 12 floor tiles get marked &lt;code&gt;░&lt;/code&gt;, then turn into &lt;code&gt;▓&lt;/code&gt; hazards for four seconds. Walking onto one costs 1 HP. The marks are always shown for a full second first: no damage you didn't see coming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Dump&lt;/strong&gt; (phase 3). The whole floor becomes a checkerboard. Half of it is safe (&lt;code&gt;·&lt;/code&gt;), half of it isn't, and you have three seconds to dance on the right squares.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2atftsf9d6nnfmymtiua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2atftsf9d6nnfmymtiua.png" alt="Segfault and Corrupt Memory" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Segfault in the top band, phase 2, with Corrupt Memory's &lt;code&gt;▓&lt;/code&gt; tiles spread over the floor.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fteg1dkperkw75urrtdgu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fteg1dkperkw75urrtdgu.png" alt="Access Violation tell" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Access Violation's tell: the claw arc and the box it's about to sweep.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  SIGSEGV: the theme turns against you
&lt;/h3&gt;

&lt;p&gt;This is the one I was waiting for. In phases 2 and 3 the screen gets a &lt;strong&gt;red border&lt;/strong&gt; and the sky row flashes &lt;code&gt;SIGSEGV incoming&lt;/code&gt;. One second later the boss &lt;strong&gt;rotates your register by two slots&lt;/strong&gt;. &lt;code&gt;[A, D, L, N]&lt;/code&gt; becomes &lt;code&gt;[L, N, A, D]&lt;/code&gt;, and the combo you had under your fingers is now somewhere else.&lt;/p&gt;

&lt;p&gt;It's always telegraphed, it never lands on top of another attack, and it's followed by a long recovery (90 frames, 150 if Breakpoint is cut) so you have time to read the new window and punish. Red is reserved for exactly two things in this game: Breakpoint and SIGSEGV.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4y7eftv0g34rul7szv3j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4y7eftv0g34rul7szv3j.png" alt="SIGSEGV incoming" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;&lt;code&gt;SIGSEGV incoming&lt;/code&gt;: red border, and the register is still &lt;code&gt;[A, D, L, N]&lt;/code&gt;...&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhksxf20ot0svaoa4273d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhksxf20ot0svaoa4273d.png" alt="Register rotated by SIGSEGV" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;...one second later it's &lt;code&gt;[L, N, A, D]&lt;/code&gt;, and J→K is suddenly Ghost Echo.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reserved Write
&lt;/h3&gt;

&lt;p&gt;In phase 3 the four &lt;code&gt;reserved&lt;/code&gt; cells under the register start blinking. Then the boss writes a &lt;strong&gt;garbage bit &lt;code&gt;?&lt;/code&gt;&lt;/strong&gt; into your ring for ten seconds. &lt;code&gt;?&lt;/code&gt; does nothing: its solo action is a NOP and it forms no combo with anything. Five bits, one of them useless, and the windows keep sliding. When it expires your register goes back exactly as it was.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fapryee0bgysr1yi64mjj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fapryee0bgysr1yi64mjj.png" alt="Reserved Write garbage bit" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Reserved Write: the register reads &lt;code&gt;ADLN?&lt;/code&gt; and the &lt;code&gt;? A&lt;/code&gt; window is dead weight.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Beat it and the dragon collapses into the line it should have been: &lt;code&gt;if (idx &amp;lt; len) buf[idx] = val;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A beginning and a &lt;code&gt;return&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Intro.&lt;/strong&gt; Three quick panels, about 8 seconds: 2 a.m., stuck on a bug; squeeze the duck (&lt;code&gt;QUACK&lt;/code&gt;); the screen tears into glyphs and you land in The Clearing. The duck hands you your first two bits: &lt;em&gt;"Quack. Explain the bug to me. Use these."&lt;/em&gt; Any key skips it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ending.&lt;/strong&gt; The next morning, back at the desk. The four &lt;code&gt;reserved&lt;/code&gt; cells light up one by one until the register reads &lt;code&gt;0xFF&lt;/code&gt;, a commit types itself out (&lt;code&gt;c0ffee1 fix: wild shift&lt;/code&gt;), and the duck gets the last word: &lt;em&gt;"Quack. Works on your machine now."&lt;/em&gt; A real run also shows your clear time and how many hits you took, then the credits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnlvjd3ro7q1y3abge9w0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnlvjd3ro7q1y3abge9w0.png" alt="The ending" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The ending: the register finally full at &lt;code&gt;0xFF&lt;/code&gt;, and the commit that fixes everything.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The credits list my own font, Wildshift8, and the duck's voice, &lt;a href="https://github.com/basteez/mumble-speech" rel="noopener noreferrer"&gt;&lt;strong&gt;mumble-speech&lt;/strong&gt;&lt;/a&gt;, my own library. The audio line still says &lt;code&gt;TBD&lt;/code&gt;: music comes next.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Yes, the "FIGHT 3 / boss index 2" text in the middle of the arena is still the scene-flow placeholder. It goes away in polish.)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Every word in its place
&lt;/h2&gt;

&lt;p&gt;The last story of the epic was a text audit. Every line of game text now lives in data and is checked against the design doc by a test: exactly &lt;strong&gt;10 duck lines&lt;/strong&gt; (the budget I set at the start), 3 fixed lines (one per boss) and 3 sky comments. If someone adds an 11th duck line, the build fails. The duck is chatty, but within limits.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;Same as before: I'm the director and the playtester, AI agents (Claude) write the code from specs I approve with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD Method&lt;/a&gt;, and every story is a pull request with code review and automated tests. The test suite went from 95 to &lt;strong&gt;112 test files&lt;/strong&gt;. Everything is public in the &lt;a href="https://github.com/basteez/the-debugger-0x3-wild-shift" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The plan had Epic 6 for November 22–25. It was merged on November 13, so the whole game is now playable start to finish with more than two weeks left before the deadline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;The game is complete but quiet. Next is the part that makes it feel finished: music, the final sound pass, save and resume, a browser and performance check, and a full-run playtest with real people. If you want to help break it, the current build is playable right here on this page.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>gamedev</category>
      <category>programming</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Wild Shift Devlog #2: It's always the semicolon</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Thu, 12 Nov 2026 09:47:40 +0000</pubDate>
      <link>https://dev.to/basteez/wild-shift-devlog-2-its-always-the-semicolon-3nje</link>
      <guid>https://dev.to/basteez/wild-shift-devlog-2-its-always-the-semicolon-3nje</guid>
      <description>&lt;p&gt;Second update on &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, my GitHub Game Off 2026 entry (theme: &lt;strong&gt;SHIFT&lt;/strong&gt;). If you missed it, &lt;a href="https://bstz.it/p/wild-shift-devlog-1/" rel="noopener noreferrer"&gt;Devlog #1&lt;/a&gt; covered the register and the shift. This post is a mirror of the &lt;a href="https://basteez.itch.io/wild-shift/devlog/1771895/devlog-2-its-always-the-semicolon-infinite-loop-null-pointer-and-a-duck-that-talks" rel="noopener noreferrer"&gt;second devlog on itch.io&lt;/a&gt;. You can also play the current build in the browser on the &lt;a href="https://basteez.itch.io/wild-shift" rel="noopener noreferrer"&gt;game page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Two bosses down, one to go. Since the last devlog &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt; got its first two real bugs to fix, a duck that talks, and two new bits for the register.&lt;/p&gt;

&lt;h2&gt;
  
  
  Infinite Loop: the first real bug (Epic 3)
&lt;/h2&gt;

&lt;p&gt;Last time I promised a snake made of code. Here it is: &lt;strong&gt;Infinite Loop&lt;/strong&gt;, a ring of 24 &lt;code&gt;{ }&lt;/code&gt; segments biting its own tail, with an iteration counter &lt;code&gt;i = 0&lt;/code&gt; floating above it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It never stops.&lt;/strong&gt; The ring spins, drifts toward you and gets 5% faster on every lap. &lt;code&gt;i++&lt;/code&gt; ticks up as it goes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's always the semicolon.&lt;/strong&gt; The point where head meets tail is the loop condition, a &lt;code&gt;;&lt;/code&gt; that travels around the ring. Once per lap it opens for 1.5 seconds, and that's the only place you can hurt it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weak windows.&lt;/strong&gt; Every phase has an ordered pair of bits that "reproduces" the bug. Hit the boss with it and it's &lt;strong&gt;Patched&lt;/strong&gt; for 3 seconds: your damage goes from ×0.5 (&lt;code&gt;// resisted&lt;/code&gt;) to ×1.5 (&lt;code&gt;CRITICAL&lt;/code&gt;, in caps, with a flash). Phase 1 wants &lt;code&gt;A→D&lt;/code&gt; (Dash Strike through the open &lt;code&gt;;&lt;/code&gt;), phase 2 wants &lt;code&gt;D→A&lt;/code&gt;, so you have to shift back and forth to patch and then cash in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three phases, four attacks.&lt;/strong&gt; &lt;strong&gt;Head Rush&lt;/strong&gt; (the head uncoils and charges), &lt;strong&gt;Constrict&lt;/strong&gt; (the ring re-centres on you and shrinks: dash &lt;em&gt;through&lt;/em&gt; the body to get out), and in phase 3 a &lt;strong&gt;Nested Loop&lt;/strong&gt;: it splits into an outer and an inner ring, each with its own &lt;code&gt;;&lt;/code&gt;, and they open in turn. Outer ring, &lt;code&gt;A→D&lt;/code&gt;. Inner ring, &lt;code&gt;D→A&lt;/code&gt;. Switching rings means switching windows. Plus a &lt;strong&gt;&lt;code&gt;;&lt;/code&gt; Spit&lt;/strong&gt; projectile, because of course.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyybqo735pwp3n4u41kuj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyybqo735pwp3n4u41kuj.png" alt="Infinite Loop closing around the player" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Infinite Loop in phase 2 (&lt;code&gt;i = 3&lt;/code&gt;) closing around the player. On the left, the duck is still nagging me to shift.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The duck gets a voice
&lt;/h3&gt;

&lt;p&gt;The rubber duck now lives in a text bubble under the register and teaches the fight with jokes: &lt;em&gt;"See the semicolon? It's always the semicolon. Hit it when it opens."&lt;/em&gt; If you just stand there, it nudges you (&lt;em&gt;"Go on, shift. It's waiting."&lt;/em&gt;) and after a few seconds the loop starts anyway.&lt;/p&gt;

&lt;p&gt;The lines are typed out with a squeak and a gibberish voice made with &lt;a href="https://github.com/basteez/mumble-speech" rel="noopener noreferrer"&gt;&lt;strong&gt;mumble-speech&lt;/strong&gt;&lt;/a&gt;, a small library of mine that turns text into gibberish speech. Its v0.3.0 added a Godot web build, so the duck can talk in the browser too. No voice acting, just a very confident duck.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defeat and Harvest
&lt;/h3&gt;

&lt;p&gt;When the bug dies, it collapses into the line of code it should have been: &lt;code&gt;for (i = 0; i &amp;lt; n; i++) { }&lt;/code&gt;. Then the &lt;strong&gt;Harvest&lt;/strong&gt; screen shows the bit it dropped and the new windows it opens in your ring.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwm1oaqnrtgeow0r9tq6b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwm1oaqnrtgeow0r9tq6b.png" alt="Harvest screen after Infinite Loop" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Harvest: Infinite Loop drops LOOP. The register becomes &lt;code&gt;[A, D, L] = 0x07&lt;/code&gt; and &lt;code&gt;D→L&lt;/code&gt; unlocks Echo Dash.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  LOOP, Echo Dash and Breakpoint (Epic 4)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LOOP (&lt;code&gt;L&lt;/code&gt;) = Echo.&lt;/strong&gt; It replays your last solo move from where you're standing now, at 70% damage. Slash, step away, Echo: a second slash where you are. It has a 1.5 s cooldown, and if you haven't done anything yet it just does nothing (no cooldown wasted).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Echo Dash (&lt;code&gt;D→L&lt;/code&gt;).&lt;/strong&gt; Dash, then Echo: a second dash you can point in a new direction, invulnerable the whole way through with no gap. It's how you pass &lt;em&gt;through&lt;/em&gt; a boss, and against the next one it does more than that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Breakpoint (&lt;code&gt;Space&lt;/code&gt;).&lt;/strong&gt; Freezes the simulation for up to 2 seconds, but shifting still works. The screen dithers, a red breakpoint dot appears, and you get to think. 12 s cooldown. &lt;em&gt;Finally, a debugger that works.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duck hints.&lt;/strong&gt; If you're stuck, the duck tells you the weak window: &lt;code&gt;"Quack. Weak window: D→A."&lt;/code&gt;. It speaks on Breakpoint (once per phase) and every third death on the same boss. In the Nested Loop phase it names the window of the ring that opens next.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Null Pointer: a ghost that points at nothing (Epic 5)
&lt;/h2&gt;

&lt;p&gt;The second bug is &lt;strong&gt;Null Pointer&lt;/strong&gt;, a ghost made of &lt;code&gt;null&lt;/code&gt; glyphs. It's &lt;strong&gt;invisible&lt;/strong&gt;: you only see it while it attacks, for a few frames when you hit it, and for a second after an Echo Dash goes through it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Finding it.&lt;/strong&gt; A column of falling &lt;code&gt;null&lt;/code&gt; glyphs drifts under it, and it hums, panned left or right by where it is. The sky comment reads &lt;code&gt;// FIXME: who owns this pointer?&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pointer Grab:&lt;/strong&gt; a &lt;code&gt;*&lt;/code&gt; appears behind you, then it grabs. &lt;strong&gt;Null Rain:&lt;/strong&gt; five marked areas, then &lt;code&gt;null&lt;/code&gt; falls on them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dangling Pointers&lt;/strong&gt; (phase 2): two decoy ghosts. They don't hum, and hitting one just dispels it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NullPointerException.&lt;/strong&gt; Swing a slash at nothing while the ghost is close and you're stunned for a third of a second. Don't attack blindly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch (hold &lt;code&gt;R&lt;/code&gt;).&lt;/strong&gt; Reveals the ghost and its decoys, shows the name of its next attack, the bit it will drop and its weak window. You move at half speed and can't act while you hold it, so it's a peek, not a crutch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsv279jjcvzjkjyvpu10r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsv279jjcvzjkjyvpu10r.png" alt="Pointer Grab tell" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Pointer Grab's tell: a `&lt;/em&gt;&lt;code&gt; lands right behind the player (&lt;/code&gt;@&lt;code&gt;) while the ghost closes in. &lt;/code&gt;[D, L]` is live, so Echo Dash is one K away.*&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8m4ji7bg916gp2k2suqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8m4ji7bg916gp2k2suqz.png" alt="Null Rain" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Null Rain: five areas marked, and the column of &lt;code&gt;null&lt;/code&gt; glyphs that gives the invisible ghost away.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faqmz80zh8ujcs2qo2rks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faqmz80zh8ujcs2qo2rks.png" alt="Holding Watch on Null Pointer" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Holding Watch: the ghost shows up, with its next attack (&lt;code&gt;pointer_grab&lt;/code&gt;), its drop (&lt;code&gt;N&lt;/code&gt;) and its weak window (&lt;code&gt;D→L&lt;/code&gt;).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At the start of the fight the duck introduces the two new skills (&lt;em&gt;"Hold R. Pointers point *somewhere*."&lt;/em&gt;). Beat it and it collapses into &lt;code&gt;if (ptr != null) ptr.deref();&lt;/code&gt; and drops &lt;strong&gt;NULL&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Null Dodge (&lt;code&gt;N&lt;/code&gt;):&lt;/strong&gt; half a second of intangibility, at half speed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clean Catch:&lt;/strong&gt; if an attack passes through you during a Null Dodge, your next damaging hit deals ×1.5, on top of Patched.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;(The "FIGHT N / boss index N" text in the middle of the arena is still a placeholder from the scene flow: it goes away in polish.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Fun fact: the GDD planned Epic 5 for November 18–21. It was done on November 12, so I'm almost a week ahead of schedule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Housekeeping
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The game is live on itch.io as a web build (about 28 MB), with a deploy from CI. Running it in a real browser found two pause bugs (resume with &lt;code&gt;P&lt;/code&gt; or a click when fullscreen eats &lt;code&gt;Esc&lt;/code&gt;, and a game frozen after a focus-loss pause), both fixed.&lt;/li&gt;
&lt;li&gt;The web build budget went from 30 to 32 MB to make room for the voice and the second boss.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;Same as before: I'm the director and the playtester, AI agents (Claude) write the code from specs I approve with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD Method&lt;/a&gt;, and every story is a pull request with code review and automated tests. The test suite went from 55 to &lt;strong&gt;95 test files&lt;/strong&gt;. Everything is public in the &lt;a href="https://github.com/basteez/the-debugger-0x3-wild-shift" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;One bug left, and it's the worst kind. It reads and writes memory it shouldn't, and it doesn't care that the register is &lt;em&gt;yours&lt;/em&gt;. Plus an intro and an ending, so the run finally has a beginning and a &lt;code&gt;return&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>buildinpublic</category>
      <category>coding</category>
      <category>gamedev</category>
      <category>github</category>
    </item>
    <item>
      <title>Wild Shift Devlog #1: Your weapon is a byte</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Tue, 10 Nov 2026 13:48:19 +0000</pubDate>
      <link>https://dev.to/basteez/wild-shift-devlog-1-your-weapon-is-a-byte-1l9h</link>
      <guid>https://dev.to/basteez/wild-shift-devlog-1-your-weapon-is-a-byte-1l9h</guid>
      <description>&lt;p&gt;It's November again, which means GitHub Game Off. Last year I built &lt;a href="https://bstz.it/p/adding-interactive-cockpit-controls-to-grav-sync/" rel="noopener noreferrer"&gt;Grav-Sync&lt;/a&gt; in plain JavaScript; this year the theme is &lt;strong&gt;SHIFT&lt;/strong&gt; and my entry is &lt;strong&gt;The Debugger 0x03: Wild Shift&lt;/strong&gt;, a top-down boss rush made with Godot 4.7. You can follow it on &lt;a href="https://basteez.itch.io/wild-shift" rel="noopener noreferrer"&gt;itch.io&lt;/a&gt;, and this post is a mirror of the &lt;a href="https://basteez.itch.io/wild-shift/devlog/1767483/devlog-1-your-weapon-is-a-byte-building-the-register" rel="noopener noreferrer"&gt;first devlog I published there&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The idea in one line:&lt;/strong&gt; your weapon is a bit register. Shift it left or right mid-fight, and the two leftmost bits become your two action buttons. A present-day developer and their rubber duck get pulled into a fantasy RPG where the monsters are literal software bugs: Infinite Loop, Null Pointer and Segfault.&lt;/p&gt;

&lt;h2&gt;
  
  
  Day 1: making it run in the browser (Epic 1)
&lt;/h2&gt;

&lt;p&gt;Before writing any gameplay, I wanted the boring stuff to work: a Godot 4.7 project that runs at a locked 60 Hz with pixel-perfect integer scaling, a web export that stays under 30 MB, and a CI pipeline that runs the tests on every pull request.&lt;/p&gt;

&lt;p&gt;Then the shell of the game:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;title screen with "press to start"&lt;/strong&gt;, because browsers won't play audio before your first input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Clearing&lt;/strong&gt;, the arena, framed by an IDE-style HUD: register panel on the left, log panel at the bottom, line numbers down the edge&lt;/li&gt;
&lt;li&gt;the whole scene flow with placeholders (Title → Intro → Fight → Harvest → … → Ending)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;auto-pause&lt;/strong&gt; when you switch tabs, so the boss doesn't kill you while you read Slack&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Days 2–3: the shift has to feel good (Epic 2)
&lt;/h2&gt;

&lt;p&gt;The goal of Epic 2 was simple to say and hard to do: &lt;em&gt;shifting should feel great in an empty arena, before there's anything to fight.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The register is a ring.&lt;/strong&gt; &lt;code&gt;Q&lt;/code&gt; rotates it &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt;, &lt;code&gt;E&lt;/code&gt; rotates it &lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt;. It only contains the bits you own, so you can never end up in a dead state. The HUD also shows its byte value, so your build is literally &lt;code&gt;0x03&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shift juice:&lt;/strong&gt; the register slides with a small overshoot bounce, a mechanical key-click (two different sounds for left and right), and your weapon inverts for 4 frames.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ATTACK and DASH:&lt;/strong&gt; a 3-hit slash chain and an 8-frame invulnerable dash.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ordered combos:&lt;/strong&gt; the order matters. &lt;code&gt;[A, D]&lt;/code&gt; (attack then dash) is &lt;strong&gt;Dash Strike&lt;/strong&gt;, &lt;code&gt;[D, A]&lt;/code&gt; is just a dash followed by a slash.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hit feedback:&lt;/strong&gt; hit-stop, glyph particles flying off the target, and every hit printed as a &lt;code&gt;console.log&lt;/code&gt; line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1h758dr4yv9d3mng8388.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1h758dr4yv9d3mng8388.png" alt="The 3-hit slash chain on the practice target" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The 3-hit slash chain on the practice target: glyph particles and damage logged to the console.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fncrcpy7wrof6f87j52rj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fncrcpy7wrof6f87j52rj.png" alt="The register after one shift, with the Dash Strike window active" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;After one &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; the active window is &lt;code&gt;[A, D]&lt;/code&gt;: J→K fires a Dash Strike.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Death and retry:&lt;/strong&gt; you have 5 HP, shown as &lt;code&gt;0b11111&lt;/code&gt;. When you die you get &lt;code&gt;Process exited with code 1&lt;/code&gt;, and one key puts you back at the start of the fight in under 2 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A practice target:&lt;/strong&gt; &lt;code&gt;/* test */&lt;/code&gt;, with infinite HP and a frame counter, so I can check the combo numbers on screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnmrb71qyejuitswm25yx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnmrb71qyejuitswm25yx.png" alt="The death screen: Process exited with code 1" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under the hood the whole simulation is deterministic: it runs on a fixed 60 Hz clock, with seeded randomness and recorded input replays. That means a bug I find while playing can be replayed exactly in a test.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The "FIGHT 1 / boss index 0" text in the screenshots is a placeholder: the arena is still waiting for its first boss.)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's made
&lt;/h2&gt;

&lt;p&gt;I'm making this solo, as director and playtester. The code is written by AI agents (Claude), following specs I write and approve with the &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD Method&lt;/a&gt;, the same workflow I described in &lt;a href="https://bstz.it/p/a-bmad-workflow-end-to-end-shipping-a-feature-the-spec-driven-way/" rel="noopener noreferrer"&gt;BMAD, end to end&lt;/a&gt;: game brief → GDD → architecture → one spec per story. Every story is a pull request with code review and automated tests (55 test files by the end of Epic 2). All the design docs are public in the &lt;a href="https://github.com/basteez/the-debugger-0x3-wild-shift" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next up
&lt;/h2&gt;

&lt;p&gt;The first real bug: &lt;strong&gt;Infinite Loop&lt;/strong&gt;, a snake made of code that repeats its attacks… until you find its weak window. Plus the rubber duck, who finally gets a voice, powered by &lt;a href="https://github.com/basteez/mumble-speech" rel="noopener noreferrer"&gt;mumble-speech&lt;/a&gt;, my own library: v0.3.0 added Godot web support, so the duck can talk in the browser too.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>githubgameoff</category>
      <category>gamejam</category>
      <category>gamedev</category>
      <category>godotengine</category>
    </item>
    <item>
      <title>The NeuroDEVergent</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Tue, 10 Nov 2026 13:44:59 +0000</pubDate>
      <link>https://dev.to/basteez/the-neurodevergent-52bp</link>
      <guid>https://dev.to/basteez/the-neurodevergent-52bp</guid>
      <description>&lt;p&gt;When I need to focus on something demanding I put my headphones on and start some thrash metal, at a volume any ENT doctor would probably advise against. I've tried white noise too, which is what everyone recommends, but it has never worked for me; thrash does, and it doesn't even matter whether the track is instrumental or has vocals. My theory is that the tight, precise rhythms act as white noise in place of white noise, filling the space where my head would otherwise go looking for something else to do. If you want to try it, my suggestion is Metallica's &lt;em&gt;...And Justice for All&lt;/em&gt;, which is the album I put on when I need maximum focus, although, being a bass player, I usually listen to &lt;a href="https://www.youtube.com/watch?v=vumrar1k928" rel="noopener noreferrer"&gt;this version with the bass put back in the mix&lt;/a&gt;: I like the original, but I'd rather hear the bass.&lt;/p&gt;

&lt;p&gt;For years I took this as one of my fixations, one of the many things that have always made me feel a bit different from everyone else. Last week I was diagnosed with combined-type ADHD, along with giftedness, and to be honest I still haven't quite worked out what that changes; all I know is that quite a few of those things now have an explanation slightly more serious than "that's just how I am".&lt;/p&gt;

&lt;p&gt;I've felt different from other people since I was a kid although back then, at least on the inside, it didn't weigh on me; if anything, I simply felt smarter, I had interests other kids my age didn't have, like science, the human body and space, and I was into video games at a time, the second half of the '90s, when they weren't yet the mainstream thing they are today. Above all I wanted to be a grown-up and that too has only found an explanation now because apparently that urge to be a grown-up was tied precisely to the giftedness.&lt;/p&gt;

&lt;p&gt;Growing up, though, that feeling of being different turned into something less harmless, and in my teens it became a feeling of being better than others. I'd already been bullied in primary school in a way I don't want to talk about here and I was bullied again in middle school, where it was mostly psychological; to this day I couldn't say how much of it came from that sense of superiority and how much from the fact that I really was different, probably a bit of both.&lt;/p&gt;

&lt;p&gt;Then came the inability to make friends or at least to have social interactions that actually fulfilled me; the few friendships I'd managed to build I lost anyway because I got bored quickly of people as much as of situations and I'd end up distancing myself by behaving like a jerk.&lt;/p&gt;

&lt;p&gt;Then came the trouble concentrating: I'd drift off, procrastinate constantly, and I did it mostly with the activities that required the most mental effort, which, coming from someone who's a developer for a living, sounds almost like a joke. It was while trying to understand what was wrong that I came across ADHD and at first I didn't really see myself in it; only when I stopped watching TikTok and Instagram content and moved on to more serious sources I started to actually understand the subject: the books and videos of Dr Valerio Rosso and the work of various American psychologists and psychiatrists.&lt;/p&gt;

&lt;p&gt;In there I started recognising myself in quite a few things: first of all the difficulty concentrating and getting constantly distracted by low-value things, but also feeling drained by context switching, which happens to me even when I'm not getting distracted at all; then the difficulty with relationships, which I've already talked about.&lt;/p&gt;

&lt;p&gt;There were other things, though, that I never saw myself in: I don't have the physical hyperactivity, the mental kind yes, and I'm not the type who loses things. Even the famous poor sense of time works differently in my case from how it's usually described, because it's not that I lose track of time during the day, it's more of a long-term thing: I'm 37 and I don't realise it, I feel much younger, as if I still had all the time in the world ahead of me.&lt;/p&gt;

&lt;p&gt;About four years ago I had a first assessment at the public mental health centre in my city, with one of the psychiatrists there. I wasn't given any specific test, and four things were enough to rule out ADHD: I did well at school, I'd taught myself to play bass, I'd taught myself English, and I'm in a long-term relationship with my partner. At the time I was puzzled, then I let it go and for a while I didn't think about it any more. In hindsight, nearly all the things I'd been given as proof that I couldn't have ADHD are exactly the ones giftedness makes possible, and which had therefore ended up hiding it.&lt;/p&gt;

&lt;p&gt;The nagging doubt came back this year, in June, during a more exhausting period than usual, both for concentration and for organising my life, which is something I've always sucked at. This time I looked for a serious professional and found one almost by chance, among ADHD podcasts: Dr Stefano Bramante, a psychiatrist and the man behind the &lt;em&gt;Brain on Fire&lt;/em&gt; podcast, who has also published a mock ADHD assessment on YouTube. He first referred me to one of his collaborators, Dr Daniele Tatano, a psychologist, who did an initial assessment that Dr Bramante then validated with his own; because of their availability, though, I had to wait until September.&lt;/p&gt;

&lt;p&gt;It was a completely different experience from four years earlier. Over six weeks I had two sessions with Dr Tatano and one with Dr Bramante, cognitive tests, questionnaires to fill in myself and others for my partner and my mother to fill in, interviews, and they even wanted to see my primary and middle school reports. I liked the approach, structured and not superficial at all, but what surprised me most was seeing it confirmed in black and white, between the interviews and the school reports, that as a kid I really was very intelligent, and that the feeling of being different I talked about at the beginning wasn't just in my head.&lt;/p&gt;

&lt;p&gt;Then there's work, where all of this shows up in fairly recognisable ways, at least now that I know what to look for. I need new problems to stay engaged with a project, and my brain switches on with urgency: I tend to put off difficult tasks, but when the deadline gets close and the pressure rises, hyperfocus kicks in almost automatically, and the thing I'd been putting off for days becomes the only thing I can think about. Then there's documentation, which I struggle to find my way through, and there are long meetings where I only play a marginal role, which are by far the most tiring for me. It's not all bad, though: I work well under pressure, even if it doesn't do me much good; I think I'm good at lateral thinking, and I'm obsessed with clean, well-written code, which in a job like mine is hardly a flaw.&lt;/p&gt;

&lt;p&gt;As for actual tools, apart from the thrash metal, I've never had many: I've always put events and appointments in Google Calendar, and since March I've been using a bullet journal. It's not the first one I've started, I abandoned all the others, but this one is still going after seven months, and for me that's already something. At first I mostly used it for tasks, work and otherwise, then I didn't want to keep track of work by hand any more and did what for an engineer is almost an occupational hazard: I automated it.&lt;/p&gt;

&lt;p&gt;I've instructed Claude to log every action, analysis, PR or comment I make or am asked for in my Logseq journal, with links to the PRs and comments, both on GitHub and in the issue tracker. The result is that I can now give much more structured feedback on my day-to-day work, and reconstructing what I did days or weeks later has become much easier. These days I use the bullet journal almost only for to-dos, and I've started, timidly, to push myself to write down a few thoughts in it too, a few emotions, that kind of thing.&lt;/p&gt;

&lt;p&gt;If you ask me what I felt when I got the diagnosis, the honest answer is that I don't know, and as I said at the beginning I'm not even sure what changes from here on. I know I'm planning to start therapy, partly to work on organising my life, which I really want to get better at.&lt;/p&gt;

&lt;p&gt;And I know one more thing, which is maybe the only thing I've been clear about from the very first moment: I don't want to use ADHD as an excuse, either for not doing things or for not organising my life.&lt;/p&gt;

</description>
      <category>adhd</category>
      <category>neurodivergence</category>
      <category>personalstory</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Yes, you still need to know how to code</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Tue, 15 Sep 2026 06:03:27 +0000</pubDate>
      <link>https://dev.to/basteez/yes-you-still-need-to-know-how-to-code-3lm9</link>
      <guid>https://dev.to/basteez/yes-you-still-need-to-know-how-to-code-3lm9</guid>
      <description>&lt;p&gt;AI writes good code, faster than me most of the time and usually cleaner than my first pass. I'm not going to argue otherwise and I'm not interested in the version of this piece where the craft is sacred and typing things by hand builds character.&lt;/p&gt;

&lt;p&gt;What I think is that the hard part of the job was never the typing, it was the part nobody watches: working out whether the thing is correct, whether it will hold, whether it should exist at all, and that part hasn't got cheaper.&lt;/p&gt;

&lt;p&gt;Actually, "hasn't got cheaper" is too soft. Reading is cheap when you can trust the author's intent and expensive when you can't, and a model hands you volume with no stable intent to anchor to, so the careful read, the kind that catches the subtle thing, is exactly the one that gets expensive, and exactly the one people skip. The cost didn't vanish when generation got cheap, it moved to the other side of the ledger where it's harder to see and much easier to skip.&lt;/p&gt;

&lt;p&gt;The reason it's easy to skip is that the output is optimised to look right, not to be right. A model trained to produce the most likely continuation leans, over and over, in the same direction: toward the plausible. A developer who can't read code doesn't avoid that cost, they defer it into debt and into bugs they aren't equipped to notice.&lt;/p&gt;

&lt;h2&gt;
  
  
  A prompt is not a task
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Write me a function that does X&lt;/em&gt; looks like handing off a chore but it isn't. Buried in it are decisions about structure, trade-offs, failure behaviour, and the quiet one underneath: what "correct" means in this particular domain. And if you can read the output, you can see those decisions and keep them. You notice that it reached for an ORM where a query would have done, that it picked a pattern that fights a constraint it doesn't know about, that it decided errors should be swallowed instead of raised. Some of those you'll accept, that's fine; the point is that you accepted them. If you can't read the output, you're not delegating how something gets done, you're accepting what gets done, in bulk, and you won't notice the difference until much later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where plausible actually bites
&lt;/h2&gt;

&lt;p&gt;The clearest case is debugging, because there the gap shows up as a test going green. A green test never could tell you whether the cause was gone or just hidden, that's not new; what's new is the speed and the fluency, the model reaches for the change that silences the symptom, hands it back looking finished, and does it fast enough that the pause where you'd have got suspicious never happens.&lt;/p&gt;

&lt;p&gt;Review has a version of the same problem, except worse, because the dangerous code isn't the code with obvious bugs in it, the model usually catches those. The dangerous code is locally fine and globally wrong: consistent with the file it lives in, in violation of something that lives three modules away, and the model isn't holding a picture of your system, so if you aren't either, you're not reviewing anything.&lt;/p&gt;

&lt;p&gt;Security is where I'd be most nervous, because insecure code and secure code look the same to an untrained reader: the query gets parameterised in the path you were looking at and concatenated in the branch you weren't, the permission check reads beautifully and still lets you fetch an object by guessing its ID, somebody logs a token "for debugging" and it survives into production. None of these fail a quick read, you catch them only if the threat model is already in your head.&lt;/p&gt;

&lt;p&gt;Architecture is a quieter failure: ask for a design and you get roughly the average of everything that's been written about designs, which means the well-represented answer: the service boundaries, the fashionable abstraction, the thing that made sense for a company forty times your size. It has no idea you're three people, or that the latency budget makes that choice unworkable, and it doesn't volunteer &lt;em&gt;why not something simpler&lt;/em&gt;, which is the question that would have saved you.&lt;/p&gt;

&lt;p&gt;Then there's the thing I don't have a clean name for: the model rarely tells you this shouldn't be built, it won't volunteer that the problem is the wrong problem, it defaults to yes unless you build the friction that makes it say no. That kind of judgement lives in the things that don't get built, and a system whose only output is the artefact can't represent it at all.&lt;/p&gt;

&lt;p&gt;None of this means the only defence is a human squinting at a diff. Linters, type systems, scanners, a second model told to go looking for the bug: they catch a real share of what I've described, and you should use all of them, they raise the floor. But every one of them checks against a shape someone already knew to encode, so the failures that survive are the ones that don't match a shape, and something still has to decide which of the machine's findings matter and which it missed. That something is the picture of the system in your head.&lt;/p&gt;

&lt;h2&gt;
  
  
  But the compiler
&lt;/h2&gt;

&lt;p&gt;The obvious objection is that this is the assembly argument wearing new clothes: nobody reads assembly, the abstraction won, and complaining about it is just nostalgia with a technical vocabulary.&lt;/p&gt;

&lt;p&gt;I think the difference is real, and it's the entire point. We stop looking underneath a layer, a compiler, a garbage collector, someone else's merged pull request, when its failures are rare enough and cheap enough to catch downstream, not because it's provably correct: the compiler earns that trust, and when it's wrong, that's a famous bug with a ticket number. An LLM hasn't earned it, its failure surface is unbounded and shaped by the context you're in, so the bet that mistakes will be rare and caught downstream doesn't hold, and something you have to check on those terms is not an abstraction, it's a collaborator, and to review a collaborator's work at one level you need to understand the level below it.&lt;/p&gt;

&lt;p&gt;The second objection is that the models will get better and this is all temporary. I'm not going to bet against that, it's a bad bet and I don't need it, but better generation doesn't dissolve the problem, it moves it up a level: the more capable the writer, the more you're checking work that looks superhuman, and checking a collaborator you can't out-reason still means understanding the level it works at, so verification doesn't get free just because generation does. And underneath even flawless verification there's a floor no model reaches for you: somebody has to say what to build, which trade-offs are acceptable, and what "correct" means for these users, and you can't prompt your way to that if you don't already know it. The better the tools get at the &lt;em&gt;how&lt;/em&gt;, the more everything depends on the &lt;em&gt;what&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's actually left
&lt;/h2&gt;

&lt;p&gt;Not syntax, not writing loops from memory: on that, the optimists are right, and it would be silly to defend it. When I say you still need to know how to code, I mean you need to be able to read it and reason about it, to hold what it's doing in your head well enough to tell right from plausible; writing it was only ever the way most of us learned to do that.&lt;/p&gt;

&lt;p&gt;What's left is the model in your head that lets you find your own ignorance: knowing where to look, which question collapses the thing, when green isn't enough. That was never omniscience; I don't understand every line I get back either, and I don't understand every instruction my compiler emits, but the difference is that I know when I don't understand something, and roughly where to point the torch.&lt;/p&gt;

&lt;p&gt;Though I'll admit I can't draw that line precisely, and I'm suspicious of anyone who says they can. I've stopped looking underneath the compiler entirely; I still look underneath the model, every time. Somewhere between those two there's a threshold where checking stops being worth it, and I don't know how you'd recognise it from the inside; you'd only find out afterwards, from the thing you failed to catch.&lt;/p&gt;

&lt;p&gt;None of this is about juniors, it applies to me at least as much: the tool has no idea how long you've been doing this, and leaning on it without the underlying model produces the same class of mistake regardless. But there's an uncomfortable version I don't want to skip: the model in your head got built by writing and debugging the very things the tool now does for you, and if you start out leaning on it, rationally, because it's faster and cleaner than your first pass, you may never build the model at all, and I don't have a tidy answer to that, I just don't think the answer is to pretend the skill stopped mattering.&lt;/p&gt;

&lt;p&gt;That's the part worth keeping in mind: the tool multiplies whatever you bring, and it is extremely relaxed about what that is.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>A BMAD workflow, end to end: shipping a feature the spec-driven way</title>
      <dc:creator>Tiziano Basile</dc:creator>
      <pubDate>Fri, 07 Aug 2026 11:36:08 +0000</pubDate>
      <link>https://dev.to/basteez/a-bmad-workflow-end-to-end-shipping-a-feature-the-spec-driven-way-1dm4</link>
      <guid>https://dev.to/basteez/a-bmad-workflow-end-to-end-shipping-a-feature-the-spec-driven-way-1dm4</guid>
      <description>&lt;p&gt;If the only way you've ever worked with an AI is to &lt;em&gt;vibe code&lt;/em&gt; with it, which is to say you open the editor, type a prompt, and keep whatever looks roughly right, then this is the post I wish someone had handed me back when I was doing exactly that. It isn't another argument about why spec-driven development is better, because I already made that case &lt;a href="https://bstz.it/p/dont-be-mad-bmad-instead/" rel="noopener noreferrer"&gt;here&lt;/a&gt;; it's simply one complete pass through a real workflow, with the actual commands, so that you can see for yourself what the whole thing looks like from the inside.&lt;/p&gt;

&lt;p&gt;Together we'll build one small feature with &lt;a href="https://github.com/bmad-code-org/BMAD-METHOD" rel="noopener noreferrer"&gt;BMAD&lt;/a&gt;, taking it all the way from a vague idea to reviewed code, and although the example is deliberately thin it is also complete, running the full sequence of brainstorm → spec → architecture → story → implementation → review without waving our hands over any of the parts that usually get skipped, so that by the end you can see exactly where the friction lives and what it buys you in return.&lt;/p&gt;

&lt;p&gt;If you've never met the BMAD agents before, the &lt;a href="https://bstz.it/p/bmad-meet-the-crew/" rel="noopener noreferrer"&gt;previous post&lt;/a&gt; introduces the crew, and while you don't strictly need it in order to follow along here, it does help to know that "John" is a product manager and "Amelia" is a developer rather than people I actually work with.&lt;/p&gt;

&lt;p&gt;The example is a URL shortener where links can expire. All the artifacts you'll see below are illustrative snippets from that walkthrough.&lt;/p&gt;

&lt;h2&gt;
  
  
  The feature (and the trap)
&lt;/h2&gt;

&lt;p&gt;Here's the feature: &lt;strong&gt;a URL shortener where links can expire.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now watch how a vibe-coding session usually starts, because you'd open a chat and type something like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Build me a URL shortener in [your stack]. Links should be able to expire.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That prompt &lt;em&gt;feels&lt;/em&gt; complete, but it really isn't, because it's a specification riddled with holes, and the AI is going to quietly fill every one of those holes with a guess that you never actually got to see it make, so it's worth counting them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;When does a link expire?&lt;/strong&gt; After a fixed TTL? At an absolute timestamp you pass in? After N clicks? "Expire" is three different features.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What happens when someone hits an expired link?&lt;/strong&gt; A &lt;code&gt;404&lt;/code&gt;? A &lt;code&gt;410 Gone&lt;/code&gt;? A redirect to a "this link expired" page? These are &lt;em&gt;observably different&lt;/em&gt; behaviors, and a caller integrating with you will build against whichever one you pick.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do we count clicks?&lt;/strong&gt; If expiry can be click-based, you need a counter. If it can't, you probably still want analytics. That's a storage decision hiding inside a one-line prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What's the ID scheme?&lt;/strong&gt; Random short codes? Collisions? Custom aliases?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Vibe coding doesn't make any of these decisions go away, it simply arranges for &lt;em&gt;someone else&lt;/em&gt; to make them silently and invisibly at generation time, and then it hands you back a pile of code that you now have to reverse-engineer in order to discover what was actually decided on your behalf. So when the "expired link returns 404" bug report lands on your desk three weeks later, you'll find yourself debugging a decision that nobody ever consciously made in the first place.&lt;/p&gt;

&lt;p&gt;Spec-driven development, at its core, is really just this: you &lt;strong&gt;make the decisions before you write the code, on purpose, and in a place where you can actually see them&lt;/strong&gt;, and BMAD is simply one way of running that process with the AI working inside the loop with you rather than against you.&lt;/p&gt;

&lt;p&gt;Let's run it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mental model, in 30 seconds
&lt;/h2&gt;

&lt;p&gt;Two things to hold in your head before we start:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;BMAD is a team of agents rather than a single assistant.&lt;/strong&gt; Each one is a persona with a specific job to do, so there's an analyst who interrogates the idea, a product manager who writes the requirements, an architect who makes the technical calls and a developer who implements them, and you move between these personas deliberately as the work progresses. In the commands that follow, every phase can be run either by summoning the persona directly with &lt;code&gt;/bmad-agent-*&lt;/code&gt; or by invoking its underlying workflow with &lt;code&gt;/bmad-*&lt;/code&gt;, and you should feel free to use whichever of the two you prefer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The real output of the early phases is not code at all, it's artifacts.&lt;/strong&gt; These are things like a brief, a PRD, an architecture document and a story file, all of them plain markdown that lives right there in your repository, and the code itself only arrives &lt;em&gt;last&lt;/em&gt;, sitting downstream of a set of documents that you can read, review and version like anything else.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Broadly speaking there are two stages to all of this, a &lt;strong&gt;planning&lt;/strong&gt; stage in which you work out what to build and how to build it, followed by an &lt;strong&gt;implementation&lt;/strong&gt; stage in which you actually build it, and the whole point of the arrangement is that planning leaves behind durable, reviewable artifacts which then carry all of their context forward into implementation, so that the AI writing your code is working from a genuine spec rather than from a vibe.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjhp0w630wdrnag08dh4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjhp0w630wdrnag08dh4a.png" alt="BMAD workflow diagram" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything drawn with a dotted line there is a file that ends up in your repository, and that is precisely the part of the process that vibe coding never produces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 1, Brainstorm: drag the hidden decisions into the light
&lt;/h2&gt;

&lt;p&gt;We start with Mary, the analyst, and a brainstorming session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-agent-analyst      # then pick the brainstorming capability
# or go straight to it:
/bmad-brainstorming
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The move here is genuinely counterintuitive if you're accustomed to prompting an AI for output, because &lt;strong&gt;you're not asking it for an answer at all, you're asking it to interrogate you&lt;/strong&gt;, and Mary's entire job in this session is to ask you the questions that you quietly skipped over. This is exactly the moment where those four hidden decisions from the trap section earlier stop being invisible and start being things you have to answer for.&lt;/p&gt;

&lt;p&gt;A brainstorm on "URL shortener with expiring links" should surface, at minimum: which &lt;em&gt;kinds&lt;/em&gt; of expiry we actually want (TTL vs absolute date vs click-count), the expired-link behavior as a deliberate choice, whether click tracking is a feature or just a mechanism, and the ID/alias scheme.&lt;/p&gt;

&lt;p&gt;The artifact that comes out of this phase is a &lt;strong&gt;brief&lt;/strong&gt;, and this really is the part worth staring at for a moment, because it doesn't merely list the things we intend to build; it also records the things we have deliberately decided &lt;em&gt;not&lt;/em&gt; to build, so that those decisions leave a paper trail behind them instead of quietly evaporating. Here's the heart of an example &lt;code&gt;brief.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Decisions (made on purpose, for v1)
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Expiry model: absolute timestamp.**&lt;/span&gt; A link carries an optional &lt;span class="sb"&gt;`expires_at`&lt;/span&gt;
  (UTC instant). No &lt;span class="sb"&gt;`expires_at`&lt;/span&gt; means the link never expires.
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Expiry is inclusive.**&lt;/span&gt; At exactly &lt;span class="sb"&gt;`expires_at`&lt;/span&gt;, the link is already expired.
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Behavior on an expired link: `410 Gone`,**&lt;/span&gt; with body &lt;span class="sb"&gt;`{ "reason": "expired" }`&lt;/span&gt;.
  Not a &lt;span class="sb"&gt;`404`&lt;/span&gt;, not a &lt;span class="sb"&gt;`302`&lt;/span&gt; to a landing page.
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**ID scheme: 7-character base62 random code,**&lt;/span&gt; with collision-retry.

&lt;span class="gu"&gt;## Explicitly out of scope for v1 (deferred, not forgotten)
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;Relative / TTL expiry ("expire 24h after creation").
&lt;span class="k"&gt;- &lt;/span&gt;Click-count expiry, click tracking / analytics.
&lt;span class="k"&gt;- &lt;/span&gt;Custom aliases, custom "this link expired" landing pages.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take a good look at that "out of scope" list, because every single line in it is a decision that a vibe-coding prompt would have made &lt;em&gt;for&lt;/em&gt; you, silently and without asking, whereas here every one of them is on the record, deferred deliberately rather than forgotten by accident.&lt;/p&gt;

&lt;p&gt;If you want a more formal artifact than a brainstorm dump:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-product-brief
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what has already happened here, because we haven't yet written a single line of code and we have already caught three or four decisions that vibe coding would otherwise have made for us essentially at random.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 2, PRD: turn decisions into requirements you can check
&lt;/h2&gt;

&lt;p&gt;Now we switch to John, the product manager, to produce a Product Requirements Document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-agent-pm
# or the workflow directly:
/bmad-prd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;John's job is to take something like "we decided that links expire by absolute timestamp and that expired links return &lt;code&gt;410 Gone&lt;/code&gt;" and convert it into requirements that are precise enough that you could hand them to a complete stranger and expect the right thing to come back, and this is the point at which the fuzzy brainstorm finally hardens into something resembling a contract.&lt;/p&gt;

&lt;p&gt;Here's an example FR-3 from &lt;code&gt;prd.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### FR-3: Accessing an expired link
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Given**&lt;/span&gt; a short link whose &lt;span class="sb"&gt;`expires_at`&lt;/span&gt; is at or before now
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**When**&lt;/span&gt; a client requests &lt;span class="sb"&gt;`GET /{code}`&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Then**&lt;/span&gt; the service responds &lt;span class="sb"&gt;`410 Gone`&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**And**&lt;/span&gt; the response body includes a machine-readable &lt;span class="sb"&gt;`reason: "expired"`&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**And**&lt;/span&gt; no redirect (&lt;span class="sb"&gt;`3xx`&lt;/span&gt;) is issued

Non-goals for v1: custom "expired" landing pages, per-link grace periods.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read that through and notice what has changed, because the &lt;code&gt;410&lt;/code&gt; decision is now &lt;strong&gt;written down, reviewable and testable&lt;/strong&gt;, which means that a month from now the question "why does it return 410?" has an actual answer with a paper trail attached to it, and that really is the whole difference between a decision and an accident.&lt;/p&gt;

&lt;p&gt;If you want the requirements distilled into a tighter, machine-oriented contract for the downstream agents, BMAD has a dedicated step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-spec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Phase 3, Architecture: the technical calls, made once
&lt;/h2&gt;

&lt;p&gt;Winston, the architect, takes the &lt;em&gt;what&lt;/em&gt; that we've established so far and decides the &lt;em&gt;how&lt;/em&gt;, and for a feature this small the right instinct is to keep the whole thing thin, because you really don't need a forty-page architecture document for a URL shortener, you only need the handful of decisions that would be genuinely expensive to get wrong:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-agent-architect
# or:
/bmad-architecture
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The decisions worth pinning down here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Storage:&lt;/strong&gt; how do we persist &lt;code&gt;code → target_url + expires_at&lt;/code&gt;? Key-value store, relational table, in-memory for a toy?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expiry enforcement:&lt;/strong&gt; lazy (check &lt;code&gt;expires_at&lt;/code&gt; on read) or active (a sweeper that deletes expired rows)?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ID generation:&lt;/strong&gt; how we mint short codes and handle collisions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The lazy-versus-active call is the one with real teeth in it, and here is how &lt;code&gt;architecture.md&lt;/code&gt; records that call, capturing both the decision &lt;em&gt;and&lt;/em&gt; its consequence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Expiry enforcement: lazy (checked on read)
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Chosen: lazy.**&lt;/span&gt; Simplest correct behavior; no scheduler, no clock daemon.
&lt;span class="k"&gt;- &lt;/span&gt;&lt;span class="gs"&gt;**Consequence, on purpose:**&lt;/span&gt; an expired link's record still _exists_ in the
  store until something evicts it. &lt;span class="sb"&gt;`resolve`&lt;/span&gt; must therefore never assume
  "present in store" means "live". It must evaluate expiry every time.
&lt;span class="k"&gt;- &lt;/span&gt;Rejected for v1: active sweeping. Adds a scheduler we don't need yet.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Writing down the &lt;em&gt;consequence&lt;/em&gt;, namely that "present in store" does not mean "live", is the part that pays off later on, because it's the exact invariant that the implementation is going to have to honor, and it has been stated in plain language before a single line of &lt;code&gt;resolve&lt;/code&gt; even exists. The output of all this is an &lt;code&gt;architecture.md&lt;/code&gt; sitting in your repository, reviewable and versioned, the kind of thing a teammate can simply read instead of having to reverse-engineer it back out of the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 4, The story: packaging context for the implementer
&lt;/h2&gt;

&lt;p&gt;This is the phase that vibe coders have quite simply never seen, and it also happens to be the one that makes the whole method actually work.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-create-epics-and-stories   # break the PRD into epics + stories
/bmad-create-story               # generate the next story with full context
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;story&lt;/strong&gt; is a single, self-contained unit of work, but the genuinely important part is &lt;em&gt;what's actually in it&lt;/em&gt;, because a BMAD story file is nothing like a Jira ticket that carries a title and a single sentence of description. It is instead a complete context package, gathering together the relevant requirements, the architectural decisions that happen to apply, the acceptance criteria and pointers to the exact files that are in play, and it is written in such a way that an agent, or for that matter a human, can pick it up completely cold and still have everything they need to get started.&lt;/p&gt;

&lt;p&gt;Here's an example &lt;code&gt;story-1.3&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# Story 1.3 — Return 410 for expired links
&lt;/span&gt;
&lt;span class="gu"&gt;## Context
&lt;/span&gt;
Implements FR-3 (see prd.md). Expiry is enforced lazily on read, and the
boundary instant is inclusive (now &amp;gt;= expires_at ⇒ expired) — both are
architecture decisions. &lt;span class="sb"&gt;`now`&lt;/span&gt; is injected into resolve() so expiry stays
deterministic in tests.

&lt;span class="gu"&gt;## Acceptance criteria
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;[ ] resolve of a link whose expires_at &amp;lt;= now → 410, body {"reason": "expired"}
&lt;span class="k"&gt;- &lt;/span&gt;[ ] no 3xx is produced for an expired link
&lt;span class="k"&gt;- &lt;/span&gt;[ ] a link with expires_at in the future still redirects 302 (regression guard)
&lt;span class="k"&gt;- &lt;/span&gt;[ ] a link with expires_at is None still redirects 302 (never expires)
&lt;span class="k"&gt;- &lt;/span&gt;[ ] at exactly expires_at, the link is already expired (boundary is inclusive)
&lt;span class="k"&gt;- &lt;/span&gt;[ ] unknown code still returns 404 (unchanged)

&lt;span class="gu"&gt;## Files in play
&lt;/span&gt;
&lt;span class="k"&gt;- &lt;/span&gt;shortener/service.py (add &lt;span class="sb"&gt;`now`&lt;/span&gt; param to resolve; add expiry branch)
&lt;span class="k"&gt;- &lt;/span&gt;shortener/http_app.py (supply now = datetime.now(timezone.utc))
&lt;span class="k"&gt;- &lt;/span&gt;tests/test_service.py (expiry + regression cases)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how the criteria carry all of the upstream decisions through verbatim, including the inclusive boundary, the "no 3xx" rule and the regression guards, so that nothing at all has been left open to interpretation.&lt;/p&gt;

&lt;p&gt;Why does any of this matter so much? It matters because when you hand &lt;em&gt;this&lt;/em&gt; to an implementer there is genuinely nothing left for them to guess at, since the &lt;code&gt;410&lt;/code&gt; is no longer a coin flip but an acceptance criterion with a regression guard sitting right next to it, and the story turns out to be the vehicle that carries every last decision you made back in phases 1 through 3 forward into the code itself.&lt;/p&gt;

&lt;p&gt;With the story now in hand, all of the planning artifacts are finally in place, and before writing any code at all it is worth taking a moment to check that they actually line up with one another:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-check-implementation-readiness
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This validates that your PRD, your architecture and your stories all agree with one another before anyone starts implementing anything, which is really the spec-driven equivalent of the old carpenter's rule to measure twice and cut once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 5, Implementation: now, finally, code
&lt;/h2&gt;

&lt;p&gt;Only now do we finally sit down to write code, and by this point the act of "writing the code" has become almost mechanical, precisely because every meaningful decision was already made further upstream.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-agent-dev
# or run a story end to end:
/bmad-dev-story
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Amelia, the developer, works &lt;em&gt;from the story&lt;/em&gt;, implementing against the acceptance criteria one by one, and the real tell that you are no longer vibe coding is that she can check her own work against a written definition of done rather than against her own intuition. Whenever she finds herself uncertain about something, the answer is already sitting in the story, or in the PRD, or in the architecture document, and never in a guess.&lt;/p&gt;

&lt;p&gt;The entire implementation of story 1.3 is this diff to &lt;code&gt;resolve&lt;/code&gt;, and because the story pre-decided everything the change is almost mechanical:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-def resolve(store: InMemoryStore, code: str) -&amp;gt; Resolution:&lt;/span&gt;
&lt;span class="gd"&gt;-    """Resolve a short code to a redirect or an error (FR-2, FR-4)."""&lt;/span&gt;
&lt;span class="gi"&gt;+def resolve(store: InMemoryStore, code: str, *, now: datetime) -&amp;gt; Resolution:&lt;/span&gt;
&lt;span class="gi"&gt;+    """Resolve a short code to a redirect or an error (FR-2, FR-3, FR-4).&lt;/span&gt;
&lt;span class="gi"&gt;+&lt;/span&gt;
&lt;span class="gi"&gt;+    Expiry is evaluated lazily on every read: a record present in the store is&lt;/span&gt;
&lt;span class="gi"&gt;+    not necessarily live. The boundary is inclusive — at exactly ``expires_at``&lt;/span&gt;
&lt;span class="gi"&gt;+    the link is already gone.&lt;/span&gt;
&lt;span class="gi"&gt;+    """&lt;/span&gt;
     link = store.get(code)
     if link is None:
         return Resolution(status=404, body={"reason": "not_found"})
&lt;span class="gi"&gt;+    if link.expires_at is not None and link.expires_at &amp;lt;= now:&lt;/span&gt;
&lt;span class="gi"&gt;+        return Resolution(status=410, body={"reason": "expired"})&lt;/span&gt;
     return Resolution(status=302, location=link.target_url)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It comes down to two lines of logic, but the part worth looking at is the docstring, because it cites FR-3, the lazy-expiry decision and the inclusive boundary all together, and it can do so only because all three of them came &lt;em&gt;down the pipe&lt;/em&gt; from the artifacts that preceded it. The code, in other words, is not the place where any of those decisions were made, it is simply the place where they were finally applied.&lt;/p&gt;

&lt;p&gt;Contrast this with the ordinary vibe-coding loop, where you prompt the model, eyeball whatever output comes back and then re-prompt it whenever the result is wrong, because here the loop instead becomes implement against the criteria, verify against the criteria and you're done. The AI is of course still doing all of the actual typing, but this time it is typing toward a target that you defined in advance rather than toward some vague sense of "looks about right."&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 6, Review: verify against the spec, not against vibes
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-code-review
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The review is what closes the loop, and here is the quiet superpower that comes from having done all of the upstream work first, which is that &lt;strong&gt;you can now review against the spec itself&lt;/strong&gt;. A question like "does the expired-link path return &lt;code&gt;410&lt;/code&gt; in the way that FR-3 requires?" has become a plain yes-or-no question, whereas without a spec to lean on, code review tends to degenerate into "looks fine to me", which is really just vibe coding wearing a blazer.&lt;/p&gt;

&lt;p&gt;And this is exactly where the whole approach earned its keep, because the review caught a real defect, and that defect was only catchable in the first place &lt;em&gt;precisely because there was a spec to check the code against&lt;/em&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Finding:&lt;/strong&gt; &lt;code&gt;architecture.md&lt;/code&gt; states an invariant — "timestamps are UTC-aware; naive datetimes are a caller error" — but nothing enforces it. &lt;code&gt;create_link&lt;/code&gt; happily accepts a naive &lt;code&gt;expires_at&lt;/code&gt;. At resolve time, &lt;code&gt;expires_at &amp;lt;= now&lt;/code&gt; then compares a naive datetime against the adapter's aware &lt;code&gt;now&lt;/code&gt; and raises &lt;code&gt;TypeError: can't compare offset-naive and offset-aware datetimes&lt;/code&gt;. FR-3 promised a &lt;code&gt;410&lt;/code&gt;; the caller gets an unhandled &lt;code&gt;500&lt;/code&gt; instead.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That single bug is the whole argument for spec-driven development compressed into one example, because a vibe-coded shortener would almost certainly have carried &lt;em&gt;the very same defect&lt;/em&gt;, and yet with no &lt;code&gt;architecture.md&lt;/code&gt; invariant for it to violate, the reviewer would have had nothing to notice it against in the first place. The spec did more than merely document the decision, it turned what would have been a silent 500 into a visible finding, and the fix itself came down to a three-line guard in &lt;code&gt;create_link&lt;/code&gt; that fails fast with a clear error, together with a regression test, and because the invariant had been written down all along, the question "is this actually fixed?" is once again a simple yes-or-no.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually just happened
&lt;/h2&gt;

&lt;p&gt;Step back and look at what we've produced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;brief.md&lt;/code&gt;: the ideas and the decisions we deferred&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;prd.md&lt;/code&gt;: the requirements, testable&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;architecture.md&lt;/code&gt;: the technical calls&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;story-1.3.md&lt;/code&gt;: the context package that drove the code&lt;/li&gt;
&lt;li&gt;the code itself, plus tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code is the &lt;em&gt;smallest&lt;/em&gt; artifact in that entire list, and it is also the very last one we made, and that inversion is really the whole point of the exercise. In vibe coding the code is the first and only artifact you ever produce, so every decision ends up trapped inside it and left undocumented, whereas in spec-driven development the code is instead a &lt;em&gt;consequence&lt;/em&gt; of everything else, with the decisions themselves living in readable documents and the code standing as nothing more than their current implementation.&lt;/p&gt;

&lt;p&gt;This is exactly why the friction turns out to be worth it, and in a real sense the friction &lt;em&gt;is&lt;/em&gt; the value, because every question that Mary asked, every requirement that John pinned down and every call that Winston made are all decisions that would otherwise have been made silently by an autocomplete, at twice the speed and none of the visibility.&lt;/p&gt;

&lt;p&gt;You didn't actually slow down at all, you simply moved the thinking to the front of the process where it happens to be cheap, instead of leaving it for the debugger later on where it is always expensive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it on something small
&lt;/h2&gt;

&lt;p&gt;Don't go and start with your production monolith. Pick a feature that is exactly this size, small enough that you can finish it in a single sitting and yet real enough that it still hides a few decisions inside it, and then run the full loop through once from beginning to end:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bmad-brainstorming        # surface the decisions
/bmad-prd                  # write them down
/bmad-architecture         # make the technical calls
/bmad-create-story         # package the context
/bmad-dev-story            # implement against it
/bmad-code-review          # verify against the spec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first time you go through it, the whole process will feel like pure overhead, and you should do it anyway, because somewhere around the story phase, at the moment when you hand the implementer a spec and get back exactly what you asked for, it quietly stops feeling like overhead and starts feeling like the thing you had been missing all along.&lt;/p&gt;

&lt;p&gt;That's the moment the lever stops being a slot machine.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Want the backstory on why I stopped vibe coding? Start with &lt;a href="https://bstz.it/p/dont-be-mad-bmad-instead/" rel="noopener noreferrer"&gt;Don't be mad, BMAD instead&lt;/a&gt;. Want to meet the agents properly? &lt;a href="https://bstz.it/p/bmad-meet-the-crew/" rel="noopener noreferrer"&gt;Here's the crew&lt;/a&gt;. Want to see the method on a bigger project? &lt;a href="https://bstz.it/p/bmad-in-action-building-tododoro/" rel="noopener noreferrer"&gt;Building TODOdoro&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>sdd</category>
      <category>specdrivendevelopment</category>
      <category>bmad</category>
    </item>
  </channel>
</rss>
