mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
159 lines
3.4 KiB
Plaintext
159 lines
3.4 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/BIN/NETSTAT
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/LIBSTR.I
|
||
.INB INC/LIBTCPIP.I
|
||
*--------------------------------------
|
||
ZPPTR1 .EQ ZPBIN
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA 0
|
||
.DA CS.END-CS.START Code Length To Relocate
|
||
.DA 0 Data Segment to Allocate
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.LIBSTR .DA LIBSTR
|
||
L.LIBTCPIP .DA LIBTCPIP
|
||
L.MSG0 .DA MSG0
|
||
L.MSG1 .DA MSG1
|
||
.DA MSG1.UDP
|
||
.DA MSG1.TCP
|
||
.DA MSG1.RAW
|
||
.DA MSG1.RDM
|
||
.DA MSG1.SEQ
|
||
.DA MSG1.INV
|
||
L.MSG1.S .DA MSG1.S.0
|
||
.DA MSG1.S.1
|
||
.DA MSG1.S.2
|
||
.DA MSG1.S.3
|
||
.DA MSG1.S.4
|
||
.DA MSG1.S.5
|
||
.DA MSG1.S.6
|
||
.DA MSG1.S.7
|
||
.DA MSG1.S.8
|
||
.DA MSG1.S.9
|
||
.DA MSG1.S.10
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBSTR
|
||
>SYSCALL SYS.LoadLibYA
|
||
sta hLIBSTR
|
||
|
||
>LDYA L.LIBTCPIP
|
||
>SYSCALL SYS.LoadLibYA
|
||
sta hLIBTCPIP
|
||
|
||
>PUSHW L.MSG0
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.GETTABLE
|
||
>STYA ZPPTR1
|
||
|
||
lda #K.SKTTABLE.SIZE
|
||
sta SocketCount
|
||
|
||
.1 lda (ZPPTR1)
|
||
beq .7
|
||
|
||
ldy #S.SOCKET.STATUS
|
||
lda (ZPPTR1),y
|
||
asl
|
||
tax
|
||
>PUSHB L.MSG1.S+1,x
|
||
>PUSHB L.MSG1.S,x
|
||
|
||
ldy #S.SOCKET.SO
|
||
>PUSHB (ZPPTR1),y
|
||
|
||
ldy #S.SOCKET.DST.PORT+1
|
||
.2 >PUSHB (ZPPTR1),y
|
||
dey
|
||
cpy #S.SOCKET.SRC.ADDR-1
|
||
bne .2
|
||
|
||
lda (ZPPTR1)
|
||
cmp #S.SOCKET.SOCK.SEQPACKET
|
||
bcc .3
|
||
lda #S.SOCKET.SOCK.SEQPACKET+1
|
||
.3 asl
|
||
tax
|
||
>PUSHB L.MSG1+1,x
|
||
>PUSHB L.MSG1,x
|
||
>PUSHW L.MSG1
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
.7 clc
|
||
lda ZPPTR1
|
||
adc #S.SOCKET
|
||
sta ZPPTR1
|
||
lda ZPPTR1+1
|
||
adc /S.SOCKET
|
||
sta ZPPTR1+1
|
||
dec SocketCount
|
||
bne .1
|
||
|
||
CS.INIT.DONE lda #0 tell TSKMGR that all done ok, but
|
||
sec we do not want to stay in memory
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN
|
||
CS.DOEVENT clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBTCPIP
|
||
>SYSCALL SYS.FreeMemA
|
||
lda hLIBSTR
|
||
>SYSCALL SYS.FreeMemA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
LIBSTR >PSTRING "libstr.o"
|
||
LIBTCPIP >PSTRING "libtcpip.o"
|
||
MSG0 >CSTRING "Proto Local Remote Options Status\n"
|
||
MSG1 >CSTRING "%s %03d.%03d.%03d.%03d:%05D %03d.%03d.%03d.%03d:%05D %b %s\n"
|
||
MSG1.UDP >CSTRING "UDP"
|
||
MSG1.TCP >CSTRING "TCP"
|
||
MSG1.RAW >CSTRING "RAW"
|
||
MSG1.RDM >CSTRING "RDM"
|
||
MSG1.SEQ >CSTRING "SEQ"
|
||
MSG1.INV >CSTRING "???"
|
||
MSG1.S.0 >CSTRING "*"
|
||
MSG1.S.1 >CSTRING "LISTENING"
|
||
MSG1.S.2 >CSTRING "SYN-SENT"
|
||
MSG1.S.3 >CSTRING "SYN-RECEIVED"
|
||
MSG1.S.4 >CSTRING "ESTABLISHED"
|
||
MSG1.S.5 >CSTRING "CLOSE-WAIT"
|
||
MSG1.S.6 >CSTRING "LAST-ACK"
|
||
MSG1.S.7 >CSTRING "FIN-WAIT-1"
|
||
MSG1.S.8 >CSTRING "FIN-WAIT-2"
|
||
MSG1.S.9 >CSTRING "CLOSING"
|
||
MSG1.S.10 >CSTRING "TIME-WAIT"
|
||
hLIBSTR .BS 1
|
||
hLIBTCPIP .BS 1
|
||
SocketCount .BS 1
|
||
MAN
|
||
SAVE BIN/NETSTAT.S
|
||
ASM
|