<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/tools/gateway.py, branch master</title>
<subtitle>gbos - a tiny Unix-flavored OS for the Game Boy Color (kernel, shell, coreutils in C, RAM filesystem)</subtitle>
<id>https://git.sl0p.foo/gbos.git/atom/tools/gateway.py?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/tools/gateway.py?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-07-17T00:05:26Z</updated>
<entry>
<title>net: IP stack milestone B - UDP echo (pseudo-header checksum)</title>
<updated>2026-07-17T00:05:26Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T00:05:26Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=ed752bba5a5d06275531182245737600bf1f72e9'/>
<id>urn:sha1:ed752bba5a5d06275531182245737600bf1f72e9</id>
<content type='text'>
Refactor netd into a protocol dispatcher (IP -&gt; ICMP/UDP) and add UDP echo:
swap addresses + ports and recompute the UDP checksum over the pseudo-header
(src/dst IP + proto + length) plus the datagram. This is the same pseudo-
header TCP uses, so it de-risks the next milestone.

tools/gateway.py --mode udp sends a datagram and verifies the echo.
Verified: 'hello udp gbos' echoes back with cksum=ok.
</content>
</entry>
<entry>
<title>net: real IP stack, milestone A - ICMP echo (you can ping a Game Boy)</title>
<updated>2026-07-17T00:03:05Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T00:03:05Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=c8c22bfc511ac65036cd8f8462e0a01757eb4372'/>
<id>urn:sha1:c8c22bfc511ac65036cd8f8462e0a01757eb4372</id>
<content type='text'>
Start of an actual TCP/IP stack on gbos (TLS stays in a proxy). netd is a
userland IP responder over SLIP: our address is 10.0.0.2, the SLIP peer
10.0.0.1. It parses IPv4 headers, answers ICMP echo requests, and rebuilds
the packet with correct IP + ICMP checksums (RFC 1071 one's-complement sum,
carry-folded - works fine on the SM83).

c/netd.c + register; tools/gateway.py gains --mode ping: it crafts ICMP echo
requests over SLIP and verifies the replies.

Verified: `netd` answers 4 pings, gateway reports reply from 10.0.0.2 with
cksum=ok for each. Next: UDP, then TCP.
</content>
</entry>
<entry>
<title>net: chat client - async receive + OSK send over the link port</title>
<updated>2026-07-16T23:39:29Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T23:39:29Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=c4b9a1b1c4f8c211f765a089b34b66a2d046f3be'/>
<id>urn:sha1:c4b9a1b1c4f8c211f765a089b34b66a2d046f3be</id>
<content type='text'>
The application layer of the link-port demo, and it ties the whole system
together: the LCD terminal displays, the on-screen keyboard types, and the
link port carries a live chat.

Kernel: sys_srecv_nb (non-blocking link receive; A=byte, CF=none) and
sys_pollin (poll the OSK for a typed char without blocking) - syscalls
31/32. Both are what a poll loop needs to receive and type at once.

Userland: c/chat.c runs a poll loop - it feeds non-blocking bytes through a
SLIP receive state machine and prints whole incoming frames as messages,
while pollin() drives the on-screen keyboard; SELECT shows the keys, type a
line, START sends it as a frame. libc srecv_nb()/pollin().

Host: tools/gateway.py --mode chat is a simple bot peer (echoes each GB
message and injects a few async ones); --keys can drive the OSK for tests.

Verified: the gateway pushes 'welcome', '&lt;alice&gt; hey gameboy!', '&lt;bob&gt; nice
link cable' unprompted and the GB displays all three (async receive); typing
'hi' on the OSK echoes it and emits the SLIP frame \xC0hi\xC0 (send). A Game
Boy in the chat, keyboard on screen, over the link cable.
</content>
</entry>
<entry>
<title>net: wget - real HTTP over the link port via the gateway</title>
<updated>2026-07-16T23:31:38Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T23:31:38Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=62171c761c72f7bc515b20361d043bfd239f71c9'/>
<id>urn:sha1:62171c761c72f7bc515b20361d043bfd239f71c9</id>
<content type='text'>
Grow the link-port demo from echo to actual network access. The Game Boy
still only does SLIP framing + display; the host gateway does DNS/TCP/HTTP.

- c/netlib.h: SLIP framing factored out (header-only, per-program copy).
  necho.c now uses it too.
- c/wget.c: `wget URL` frames the URL, then prints the reply body. The
  gateway streams the body back as typed frames: 'D'&lt;chunk&gt; ... 'E'.
- tools/gateway.py: add --mode http (urlopen the frame as a URL, cap the
  body, chunk it) alongside --mode echo; --cmd runs any gbos command.

Verified: `wget example.com` streams back the full Example Domain HTML onto
the terminal; `wget sl0p.foo` fetches the real page. A Game Boy on the web,
over the link cable.
</content>
</entry>
<entry>
<title>net: SLIP framing over the link port + a host gateway (echo round-trip)</title>
<updated>2026-07-16T23:28:23Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-16T23:28:23Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=b5544e84232b80351e7c58501c1632080a354d12'/>
<id>urn:sha1:b5544e84232b80351e7c58501c1632080a354d12</id>
<content type='text'>
First step of link-port networking. The LCD terminal + OSK freed the serial
port from console duty, so it can be the network link.

Kernel (src/net.asm): raw link-port serial that bypasses the console/
terminal - sys_ssend (transmit, GB drives the clock) and sys_srecv (receive,
GB slave, blocks by yielding). Syscalls 29/30.

Userland: libc ssend()/srecv(); c/necho.c does SLIP (RFC 1055) framing over
them - send a packet, receive the reply, print it.

Host: tools/gateway.py wraps the emulator, owns its link serial, speaks SLIP,
and (for now) echoes every frame back - the "link cable adapter". Console
(ASCII) bytes on the same channel are printed for visibility.

Verified: `necho` sends a SLIP frame, the gateway decodes+echoes it, and gbos
prints the reply - a real framed round-trip over the Game Boy link port.
Next: swap the echo for actual network ops (DNS/HTTP or IRC/chat).
</content>
</entry>
</feed>
