From f68fc872755189bc287a5f7ca838dbd9f45c8353 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 17 Jul 2026 15:12:11 +0200 Subject: net: pump the network from the console wait (answer pings at the prompt) A Game Boy sitting at the shell prompt now services the network instead of being deaf until you run netd: KGetc (the console input wait) pumps net_pump each poll, so inbound pings are auto-answered while idle. net_pump gained an in-frame model and routes any non-framed link bytes to a small console-input ring (con_push/con_pop), so a headless-injected command still reaches the shell while SLIP frames go to the stack. Removes the old SLIP-skip-in-KGetc hack. Verified: two Game Boys on the hub, GB0 idle at the prompt (no netd), GB1 `ping 10.0.0.2` -> 4/4 replies, routed GB1->hub->GB0->hub->GB1. (Separate, pre-existing: gbhub *spawn* mode and windowed gbjoin can drop an idle link socket - under investigation; daemon mode + headless is solid.) --- src/syscall.asm | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'src/syscall.asm') diff --git a/src/syscall.asm b/src/syscall.asm index 1051a4d..2adf5bf 100644 --- a/src/syscall.asm +++ b/src/syscall.asm @@ -132,41 +132,17 @@ KGetc:: call pad_poll ; poll joypad; drive the on-screen keyboard call osk_handle ; CF set + A = byte if a key was typed jr c, .done - ld a, $80 - ld [rSC], a - ld a, [rSC] - bit 7, a - jr nz, .yield - ld a, [rSB] ; A = serial byte - ; The link port is also the network. Skip SLIP frames (0xC0-delimited) so - ; inbound packets never surface as console input; plain bytes (an injected - ; command in headless use) still pass through. - ld b, a - ld a, [wConInSkip] - or a - jr nz, .inframe - ld a, b - cp SLIP_END - jr z, .frameopen - ld a, b ; ordinary byte -> console input - jr .done -.frameopen - ld a, 1 - ld [wConInSkip], a - jr .poll -.inframe - ld a, b - cp SLIP_END - jr nz, .poll ; still inside a frame -> discard - xor a - ld [wConInSkip], a ; frame end -> resume + ; The link port is the network. Pump it here so the Game Boy services the + ; net (answers pings, etc.) while sitting at the prompt; net_pump routes any + ; non-framed link bytes (a headless-injected command) to the console ring. + call net_pump + call con_pop ; queued console byte? CF clear -> return it + jr nc, .done + call SchedYield jr .poll .done and a ; CF = 0 (not EOF) ret -.yield - call SchedYield - jr .poll ; ----------------------------------------------------------------------------- ; KPutc(E = byte) - write to this process's stdout (console/file). -- cgit v1.3.1-sl0p