aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gbos.inc31
1 files changed, 30 insertions, 1 deletions
diff --git a/include/gbos.inc b/include/gbos.inc
index a80841c..a4c9d52 100644
--- a/include/gbos.inc
+++ b/include/gbos.inc
@@ -130,7 +130,36 @@ DEF SYS_SSEND EQU 29 ; link-port: transmit one byte (E=byte)
DEF SYS_SRECV EQU 30 ; link-port: receive one byte (-> A=byte, blocks)
DEF SYS_SRECVNB EQU 31 ; link-port: receive, non-blocking (-> A=byte, CF=none)
DEF SYS_POLLIN EQU 32 ; poll OSK for a typed char (-> A=char or 0)
-DEF SYS_MAX EQU 33
+DEF SYS_NET EQU 33 ; socket layer (DE=&netreq -> A=result)
+DEF SYS_MAX EQU 34
+
+; ---- socket layer (SYS_NET) --------------------------------------------------
+; netreq struct (in caller RAM; DE points to it):
+DEF NR_OP EQU 0 ; operation (below)
+DEF NR_SOCK EQU 1 ; socket id
+DEF NR_BUF EQU 2 ; 2: pointer to payload buffer
+DEF NR_LEN EQU 4 ; 1: payload length (in) / bytes received (out)
+DEF NR_IP EQU 5 ; 4: IPv4 address
+DEF NR_PORT EQU 9 ; 2: port (hi,lo)
+DEF NR_SIZE EQU 11
+; ops
+DEF NET_SOCKET EQU 0 ; NR_SOCK(type in) -> A=sockid or $FF
+DEF NET_CONNECT EQU 1 ; NR_SOCK, NR_IP, NR_PORT -> set peer
+DEF NET_SEND EQU 2 ; NR_SOCK, NR_BUF, NR_LEN -> A=0/$FF
+DEF NET_RECV EQU 3 ; NR_SOCK, NR_BUF, NR_LEN(max) -> A=len or $FF(timeout); fills NR_IP
+DEF NET_CLOSE EQU 4 ; NR_SOCK
+DEF NET_BIND EQU 5 ; NR_SOCK, NR_PORT -> bind local port (UDP)
+DEF NET_POLL EQU 6 ; pump RX once (answer pings) -> A=0
+; socket types
+DEF SOCK_ICMP EQU 1
+DEF SOCK_UDP EQU 2
+DEF SOCK_TCP EQU 3
+DEF MAX_SOCKS EQU 4
+; SLIP framing (RFC 1055)
+DEF SLIP_END EQU $C0
+DEF SLIP_ESC EQU $DB
+DEF SLIP_ESC_END EQU $DC
+DEF SLIP_ESC_ESC EQU $DD
; SYS_KILL (9) is now implemented (B=pid -> A=0/$FF; pid 1 is immortal)
; (SYS_OPEN=4 / SYS_CLOSE=5 are now implemented by the filesystem)