aboutsummaryrefslogtreecommitdiffstats
path: root/web/gbhub.js (follow)
Commit message (Collapse)AuthorAge
* web: refresh the demo ROM story - gbos now serves IRC and HTTPgbc dev2026-09-23
| | | | | | | | | | | | | | | | | | | | | | gbos picked up an IRC server (and httpd before it), which is a much better advert for the lab than `ls`: one Game Boy runs the daemon, another connects over the virtual switch. Verified on the live site end to end - GB0 `ircd &`, GB1 `irc 10.0.0.2 gb1`, `/join #gb`, and the message lands: `<gb1> hello from sl0p.foo`. The header now suggests exactly that, plus the httpd/wget pair. Two display fixes fell out of running it: - irc(1) is a colour client, so the console mirror was printing raw CSI sequences as "[44m[37m..." - the decoder dropped the ESC byte but kept the rest. It now tracks ESC / CSI state and discards the whole sequence. The LCD still renders the colours; only the plain-text mirror strips them. - the LCD is 40 columns, so full-width output (irc's status bar) arrives space-padded. The mirror isn't column-aligned, so it squeezes runs of whitespace and drops lines that were nothing but padding. The ROM itself isn't vendored here (it's a build artifact of ~/dev/gbos that deploy.sh ships), so this commit is the page copy and the decoder.
* web: network lab - several Game Boys on a virtual switch, in the pagegbc dev2026-09-22
/net.html plugs Game Boys into a switch that leases them addresses and routes between them: add one, add another, and they ping each other. Unplug either and its address goes back to the pool for the next one. web/gbhub.js is tools/gbhub (gbos) ported to the browser - SLIP framing, DHCP OFFER/ACK, unicast routing, broadcast flooding and ICMP echo for the gateway. It deliberately has no uplink: NAT needs a TUN device and a tab has no raw sockets, so packets addressed off-net are dropped and logged as "no route" rather than pretending. web/gbcore.js wraps one wasm instantiation as a GameBoy object. Several Game Boys are several instantiations of the same compiled Module - the core keeps its machine in a static, so each gets its own linear memory and is isolated for free. Measured 12.3x realtime per instance, so the page caps at 6. Each card gets a text input, because unframed link bytes are console I/O: it lands on the shell's stdin like tools/gbtype, so you can run `ping 10.0.0.3` without the on-screen keyboard. Verified headless (node, two Game Boys through the hub: 2/2 leases, ping 4/4 received) and in headless Chrome against the live site: 4 Game Boys at 60fps each, leases .2-.5, typing into a card's console pings another, unplug frees the address and a replug reclaims it, no exceptions.