<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gbos.git/c/irc.c, 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/c/irc.c?h=master</id>
<link rel='self' href='https://git.sl0p.foo/gbos.git/atom/c/irc.c?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/'/>
<updated>2026-07-17T22:38:38Z</updated>
<entry>
<title>refactor: c/ -&gt; usr/, compiled program blobs out of the source tree</title>
<updated>2026-07-17T22:38:38Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T22:38:38Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c'/>
<id>urn:sha1:ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c</id>
<content type='text'>
Userland sources live in usr/ (fits the Unix theme better than 'c').
SDCC output .bin blobs land in build/usr/ with the other build artifacts
instead of littering the source dir; programs.asm INCBINs them from there.
Byte-identical ROM.
</content>
</entry>
<entry>
<title>irc: keep the keyboard live during RX floods (poll input every pass)</title>
<updated>2026-07-17T21:20:55Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T21:20:55Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=15b4767b17f78a827fd221e941c7ac7aa987e02f'/>
<id>urn:sha1:15b4767b17f78a827fd221e941c7ac7aa987e02f</id>
<content type='text'>
'/join #sl0p right after connect' looked broken: the main loop only
polled input when net_recv_nb returned nothing, and 'continue'd on every
received segment. During a big MOTD (irc.sl0p.foo's is ~60 lines of
color art) that starved input for the whole ~20s flood - the OSK
wouldn't even open, and keystrokes were dropped. gbtype input fared a
bit better (buffered in the 64-byte console ring) but still wasn't
serviced until the flood ended.

Poll pollin()/pollcon() once every loop iteration regardless of RX, and
only idle-sleep when a pass both received nothing and read no key. The
protocol/join logic was already correct (verified: JOIN #sl0p is sent,
accepted, and the client switches to [#sl0p] with topic + names) - this
just makes typing responsive while messages are streaming.

Verified against the live server: injecting /join #sl0p *during* the
MOTD flood now joins immediately instead of waiting it out.

(Note: '#' is on the OSK - third row, second from the end:
10,8,":;,=+*_!?()[]&lt;&gt;@#~" - just not obvious.)
</content>
</entry>
<entry>
<title>irc: strip mIRC formatting, drop 004/005 noise, fix a RAM-bank-swap landmine</title>
<updated>2026-07-17T21:03:43Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T21:03:43Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=3b856b3d009b99d01cb84727b803735937a44d16'/>
<id>urn:sha1:3b856b3d009b99d01cb84727b803735937a44d16</id>
<content type='text'>
Against the real irc.sl0p.foo (via a TLS-stripping socat proxy) the
client's screen filled with garbage after connect. Two causes:

1. Color/format codes. The MOTD is a mIRC-color ASCII-art logo. We
   dropped the \x03 control byte (term ignores &lt;32) but left its numeric
   *arguments*, so the logo rendered as digit soup ('09&gt; stream the
   work', '030903 030903 ...'). strip_fmt() now removes \x03 color (+its
   fg[,bg] digits), \x04 hex color, and the \x02/\x0f/\x11/\x16/\x1d/
   \x1e/\x1f toggles, applied to the trailing text of every line (leaving
   \x01 for CTCP). Standalone digits like '3 apples' are untouched.

2. The real bug: handle() defaulted pfx/txt to a read-only "" literal,
   and both bang(pfx) and strip_fmt(txt) write a NUL terminator into it.
   That literal lives in ROM (000-FFF); on MBC5 a write there is a
   RAM-bank-select, silently swapping the  cart-RAM bank - where
   every static lives - out from under the program. One prefix-less or
   empty-trailing server line (real ircds send them: NOTICE AUTH, ERROR,
   registration PING) and all state turns to garbage. Fixed with a
   writable 1-byte 'empty' default (zeroed in main; gbos doesn't clear
   BSS).

Also suppress 004 (MYINFO) and 005 (ISUPPORT) - pure noise on 40 cols,
and InspIRCd splits ISUPPORT across several lines.

Verified end to end against the live server: full InspIRCd MOTD (logo,
LUSERS, links) renders clean and stable; host unit tests cover color/
bold/CTCP-action stripping and prefix-less NOTICE/ERROR/PING.
</content>
</entry>
<entry>
<title>irc: a bitchx/irssi-style IRC client</title>
<updated>2026-07-17T18:22:48Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-07-17T18:22:48Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/gbos.git/commit/?id=c9495d4b52b245951bf4768379b38aeb1843d60f'/>
<id>urn:sha1:c9495d4b52b245951bf4768379b38aeb1843d60f</id>
<content type='text'>
irc HOST [NICK] - connects over the kernel TCP stack (DNS-resolves the
host), registers, and runs a live client on the 40x18 LCD.

UI, within the terminal's means (no cursor addressing - just \r + \b):
messages scroll above a fixed irssi-style input line '[#chan] text_'
redrawn in place; long input scrolls horizontally. The elders' formats:
&lt;nick&gt; msg, &lt;nick:#c&gt; off-channel, *nick* private, -nick- notice,
* nick action, &gt;target&lt; outbound, -!- server/status. Keys come from both
the OSK (SELECT) and the console ring (pollcon), so a hub can drive it.

Commands: /join /part /msg /me /nick /quit /raw, plus bare text to the
current channel. Handles PING (PONG + a wink), CTCP ACTION/VERSION,
JOIN/PART/QUIT/KICK/NICK, 332/353 topic+names, and 433 nick-in-use
(auto-appends _). Registers on bank 32 as program id 30.

Note: gbos doesn't zero C statics, so main() inits its state explicitly;
the local TCP port is randomized (DIV) to dodge a stale server-side
half-open from an unclean prior exit. Tested end to end against a small
ircd through gbhub: full MOTD burst, join, channel + private messages,
actions, and bot replies all render correctly.
</content>
</entry>
</feed>
