aboutsummaryrefslogtreecommitdiffstats
path: root/src/socket.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/socket.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/socket.asm11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/socket.asm b/src/socket.asm
index 0720b0a..51179b4 100644
--- a/src/socket.asm
+++ b/src/socket.asm
@@ -64,7 +64,12 @@ wNetRxBuf:: DS 320 ; rx frame assembly / parse
wNetRxLen:: DS 2 ; 16-bit: frames can exceed 255 bytes (DHCP/BOOTP)
wNetRxEsc:: DS 1
wNetInFrame:: DS 1 ; net_pump: currently inside a SLIP frame?
-wConRing:: DS 16 ; console-input ring: non-framed bytes from the link
+wConRing:: DS 64 ; console-input ring: non-framed bytes from the link
+ ; (link-injected console input, e.g. gbhub 'type').
+ ; One net_pump drains a whole serial burst into here
+ ; at once, so it must hold a full injected command
+ ; line - 16 was too small (dropped bytes, merged
+ ; lines). Size MUST stay a power of two (mask below).
wConHead:: DS 1
wConTail:: DS 1
wNetUdpPort:: DS 2 ; scratch: UDP dst port being demuxed
@@ -112,7 +117,7 @@ con_push::
ld b, a
ld a, [wConTail]
inc a
- and 15
+ and 63
ld c, a
ld a, [wConHead]
cp c
@@ -145,7 +150,7 @@ con_pop::
ld c, [hl]
ld a, b
inc a
- and 15
+ and 63
ld [wConHead], a
ld a, c
and a ; CF = 0