diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/net.asm | 10 | ||||
| -rw-r--r-- | src/socket.asm | 11 | ||||
| -rw-r--r-- | src/syscall.asm | 1 |
3 files changed, 19 insertions, 3 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 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 diff --git a/src/syscall.asm b/src/syscall.asm index 2adf5bf..bd58cc2 100644 --- a/src/syscall.asm +++ b/src/syscall.asm @@ -69,6 +69,7 @@ SyscallTable: dw sys_pollin ; 32 POLLIN dw sys_net ; 33 NET dw sys_sleep ; 34 SLEEP + dw sys_pollcon ; 35 POLLCON ; ----------------------------------------------------------------------------- sys_nosys: |
