aboutsummaryrefslogtreecommitdiffstats
path: root/src/net.asm
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-17 20:22:34 +0200
committeruser <user@clank>2026-07-17 20:22:34 +0200
commitbf647581fbad727ad22021d345d3955abf44c2f3 (patch)
tree59e77e48c1e07dd181e2c0d693016847c441c662 /src/net.asm
parentnet: fix truncated TCP field offsets corrupting multi-segment recv (diff)
downloadgbos-bf647581fbad727ad22021d345d3955abf44c2f3.tar.gz
gbos-bf647581fbad727ad22021d345d3955abf44c2f3.tar.xz
gbos-bf647581fbad727ad22021d345d3955abf44c2f3.zip
net: SYS_POLLCON + larger console ring for link-injected input
Programs that own their main loop (the IRC client) need to poll for typed input without blocking. pollin() only sees the on-screen keyboard; bytes injected over the link (gbhub 'type', for scripted/hub-driven sessions) land in the kernel console ring, previously only drained by the blocking KGetc path. Add SYS_POLLCON: a non-blocking con_pop for userland. Also enlarge that console ring 16 -> 64. One net_pump drains an entire serial burst into the ring at once, so a whole injected command line has to fit or bytes are dropped and lines merge (a 20-char command came out truncated and glued to the next). 64 covers a full line; mask stays a power of two.
Diffstat (limited to '')
-rw-r--r--src/net.asm10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/net.asm b/src/net.asm
index f2c4279..8309242 100644
--- a/src/net.asm
+++ b/src/net.asm
@@ -54,6 +54,16 @@ sys_srecv_nb::
and a ; CF = 0 (got a byte)
ret
+; sys_pollcon() -> A = a queued console-ring byte (link-injected input,
+; e.g. gbhub 'type'), or 0 if none. Non-blocking twin of KGetc's con_pop
+; path: programs that own their main loop (irc) poll this alongside the OSK.
+; The ring fills during net pumps, which such programs do constantly.
+sys_pollcon::
+ call con_pop
+ ret nc ; got a byte
+ xor a
+ ret
+
; sys_pollin() -> A = char typed on the OSK this poll, or 0 if none.
sys_pollin::
call pad_poll