aboutsummaryrefslogtreecommitdiffstats
path: root/src/syscall.asm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/syscall.asm23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/syscall.asm b/src/syscall.asm
index 5b40ef0..04e9661 100644
--- a/src/syscall.asm
+++ b/src/syscall.asm
@@ -137,6 +137,29 @@ KGetc::
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
+ jr .poll
.done
and a ; CF = 0 (not EOF)
ret