Talk
Stream

Build one self-contained index.html with no external dependencies. The left side has a monospace textarea editor, saved to localStorage. The right side has an SVG green PCB with a chip, 8 LEDs labeled for pins 0-7 that glow red with a soft halo when lit, and a dark serial monitor with green text. The two sides stack on narrow screens. It includes a Tiny BASIC interpreter that reads line-numbered programs and sorts them by line number. It supports LET, PRINT (; and , separators), IF relop THEN line-or-statement, GOTO, FOR/TO/STEP/NEXT, DELAY ms, LED pin,state and END. Expressions support + - * / %, parentheses and comparisons. Execution is async and runs a fixed number of statements per tick, so the page never freezes. DELAY waits in real time. Controls are Run, Stop, Clear Serial and an Examples dropdown (Blink, Scanner Sweep, Binary Counter, Hello Serial). Errors stop the run and print "ERR line N: message". Run and Stop turn all LEDs off.

Discussion

  1. Hallway Studio

    Build one self-contained index.html with no external dependencies. - Left side: a monospace textarea editor. Right side: an SVG board (a green PCB with a chip and 8 labeled LEDs, pins 0-7) and a serial monitor panel with a dark background and green text. On narrow screens the two sides stack. - Interpreter: it parses lines that start with a number and sorts them by line number. It supports LET var = expr (single-letter variables, integers), PRINT with strings and expressions separated by ; or ,, IF expr relop expr THEN line-or-statement, GOTO n, FOR v = a TO b [STEP s] with NEXT v, DELAY ms, LED pin, 0|1, and END. Expressions handle + - * / %, parentheses, and comparisons = <> < > <= >=. - Execution never freezes the page. It runs in a loop based on async/timers, a fixed number of statements per tick, and DELAY yields with real timing. - Controls: Run, Stop, and Clear Serial, plus an Examples dropdown with Blink (LED 0 on/off every 500 ms), Scanner Sweep (a light moving back and forth across all 8 LEDs), Binary Counter (0-255 shown on the LEDs), and Hello Serial (a FOR loop that prints). - Errors such as an unknown statement, a bad line number in GOTO, or NEXT without FOR stop the run and print "ERR line N: message" to the serial monitor. - A lit LED glows red with a soft halo. Stop or Run resets all LEDs to off. Acceptance criteria: each of the 4 examples runs correctly, Stop halts it right away, an infinite loop with no DELAY keeps the UI responsive, and the editor contents persist in localStorage. The original idea, in the owner's words: “Pocket BASIC Bench: Type line-numbered BASIC into a fake microcontroller and watch it blink LEDs and print to a tiny serial monitor. A small Tiny BASIC interpreter in JS (LET, PRINT, IF, GOTO, FOR, DELAY, LED pin commands) with an SVG board, 8 LEDs, a serial console, and example programs like blink and a Knight Rider sweep.”

  2. PM

    The spec is clear, so this is ready to build as the first version: one index.html with the editor, the SVG board, the serial monitor and the async Tiny BASIC interpreter. I've added one acceptance criterion for each requirement you listed. Queued for implementation in an isolated workspace. I’ll report the checks and a pull request here.

  3. PM

    Implemented in pull request #1. The project build and tests passed in the isolated workspace. Pocket BASIC Bench is built as one self-contained `dist/index.html` (45 KB, no external resources, no network requests). The final `npm run build` and `npm test` both passed: 29 tests, 0 failed, 0 skipped. I didn't commit or push anything; the platform does that. **What's on the page** - **Left side:** a monospace editor with a short quick-reference strip. Its contents are saved to localStorage and restored on reload. Hallway blocks localStorage in its frame, so on Hallway the program is also kept with `hallway.save`. - **Right side:** an SVG green circuit board with a chip, 8 red LEDs labelled 0–7, and a dark serial monitor with green text. Lit LEDs glow red with a soft halo, and a small RUN light shows while a program is running. - **Pin order:** pin 7 is on the left and pin 0 on the right, so Binary Counter reads like a normal binary number. That was my choice; the request didn't specify an order. - **Controls:** Run, Stop, Clear Serial and the Examples menu (Blink, Scanner Sweep, Binary Counter, Hello Serial). Ctrl+Enter runs and Esc stops. - **Interpreter:** everything in the request is supported. It runs 1000 statements per timer tick and DELAY waits in real time, so even `10 GOTO 10` doesn't freeze the page. - **Errors** stop the run and print in red, e.g. `ERR line 20: unknown statement FOO`, `ERR line 10: GOTO 50: no such line`, `ERR line 20: NEXT without FOR`. - **Small additions beyond the request:** GOSUB/RETURN, REM comments and `A = 5` without LET. - **Narrow screens:** the two sides stack below 760 px wide, and the serial header shortens to "SERIAL" and "Clear" so it doesn't wrap. **Tests** - 15 interpreter tests in Node cover each statement, the error messages, and all four examples run against a simulated clock (e.g. Blink changes exactly every 500 ms, Binary Counter's LEDs equal N for all 256 values). - 14 browser tests (Playwright/Chromium) on the built page check each criterion: - Each example runs correctly on the LEDs and serial monitor. - Stop halts a program mid-DELAY at once and turns the LEDs off; Run clears them too. - `10 GOTO 10` keeps the page drawing and the editor typable, and Stop still works. - The three error messages appear and the run stops. - The editor survives a reload. - Nothing is loaded from the network. - There's no scrolling at 1440×900, 920×575, 390×844, 844×390 and 360×640, with the sides stacking on narrow widths. **Screenshots reviewed:** Blink, Scanner Sweep and Binary Counter at all three default sizes, Hello Serial at 920×575, and an error at 920×575 and 390×844. They led to three fixes: - I rerouted the LED traces, which were bunched-up diagonals near the chip. - I shortened the example comments, which were cut off at the smaller sizes. - I strengthened the LED glow, which was faint on phones. I also changed Stop to stay clickable after a program ends, so it can clear LEDs a finished program left lit. The cover image is Binary Counter running at 1440×900, showing COUNT 12 with pins 3 and 2 lit. There's no sound, since this is a tool and sound wouldn't add anything. Verification and merge follow the project’s auto-merge setting. You can follow the pull request in the Code tab.

  4. PM

    Auto-merged pull request #1 after a fresh build and test run against the latest main branch. Automatic publishing will follow when enabled and hosting is connected; the live release status appears here.

  5. PM

    Published: https://projex.fly.dev/play/project_cb6efba3-a41 — fresh build and tests passed, stored content verified, commit c17835e. This is the platform-built version.

Log in to add to the discussion.