2016-02-24 20:00:42 +00:00
|
|
|
|
NEW
|
2017-12-22 21:24:30 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
AUTO 4,1
|
2016-02-24 20:00:42 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF BIN/NETSTAT
|
2016-02-24 20:00:42 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/ETH.I
|
|
|
|
|
.INB INC/LIBTCPIP.I
|
2016-02-24 20:00:42 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
2018-06-15 15:15:48 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #64 SS
|
2017-12-22 21:24:30 +00:00
|
|
|
|
.DA #2 ZP
|
2016-02-24 20:00:42 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
|
|
|
|
L.MSG0 .DA MSG0
|
|
|
|
|
L.MSG1 .DA MSG1
|
|
|
|
|
.DA MSG1.UDP
|
|
|
|
|
.DA MSG1.TCP
|
|
|
|
|
.DA MSG1.RAW
|
|
|
|
|
.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
|
|
|
|
|
*--------------------------------------
|
2016-10-17 06:21:04 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>SYSCALL LoadLib
|
2017-01-28 22:05:20 +00:00
|
|
|
|
bcs .9
|
2016-02-24 20:00:42 +00:00
|
|
|
|
|
2017-01-28 22:05:20 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN >LDYA L.MSG0
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>SYSCALL puts
|
2016-02-24 20:00:42 +00:00
|
|
|
|
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.GETTABLE
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
|
|
|
|
lda #K.SKTTABLE.SIZE
|
2018-06-15 15:15:48 +00:00
|
|
|
|
>STA.G SocketCount
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2016-02-24 20:00:42 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
|
|
|
|
beq .7
|
|
|
|
|
|
2017-02-15 16:14:41 +00:00
|
|
|
|
ldy #S.SOCKET.TCP.STATUS
|
2016-02-24 20:00:42 +00:00
|
|
|
|
lda (ZPPTR1),y
|
2017-03-13 07:07:07 +00:00
|
|
|
|
cmp #S.SOCKET.TCP.STATUS.TIMEWT+1
|
|
|
|
|
bcs *
|
2016-02-24 20:00:42 +00:00
|
|
|
|
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)
|
2017-01-30 22:23:16 +00:00
|
|
|
|
cmp #S.SOCKET.SOCK.RAW+1
|
2016-02-24 20:00:42 +00:00
|
|
|
|
bcc .3
|
2017-01-30 22:23:16 +00:00
|
|
|
|
|
|
|
|
|
lda #S.SOCKET.SOCK.RAW+1
|
2016-02-24 20:00:42 +00:00
|
|
|
|
.3 asl
|
|
|
|
|
tax
|
|
|
|
|
>PUSHB L.MSG1+1,x
|
|
|
|
|
>PUSHB L.MSG1,x
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 17
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-02-24 20:00:42 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
.7 lda ZPPTR1
|
|
|
|
|
clc
|
2016-02-24 20:00:42 +00:00
|
|
|
|
adc #S.SOCKET
|
|
|
|
|
sta ZPPTR1
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2016-02-24 20:00:42 +00:00
|
|
|
|
lda ZPPTR1+1
|
|
|
|
|
adc /S.SOCKET
|
|
|
|
|
sta ZPPTR1+1
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2018-06-15 15:15:48 +00:00
|
|
|
|
>DEC.G SocketCount
|
|
|
|
|
bne .1 A=0
|
2016-02-24 20:00:42 +00:00
|
|
|
|
|
2018-06-15 15:15:48 +00:00
|
|
|
|
* lda #0 tell TSKMGR that all done ok, but
|
2016-02-24 20:00:42 +00:00
|
|
|
|
sec we do not want to stay in memory
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-28 22:05:20 +00:00
|
|
|
|
CS.DOEVENT sec
|
2016-02-24 20:00:42 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT lda hLIBTCPIP
|
2017-01-28 22:05:20 +00:00
|
|
|
|
beq .8
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2017-01-28 22:05:20 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2016-02-24 20:00:42 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2018-04-11 15:35:51 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip.o"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
MSG0 .AZ "Proto Local Remote Options Status"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG1 .AZ "%s %03d.%03d.%03d.%03d:%05D %03d.%03d.%03d.%03d:%05D %b %s\r\n"
|
|
|
|
|
MSG1.UDP .AZ "UDP"
|
|
|
|
|
MSG1.TCP .AZ "TCP"
|
|
|
|
|
MSG1.RAW .AZ "RAW"
|
|
|
|
|
MSG1.INV .AZ "???"
|
|
|
|
|
MSG1.S.0 .AZ "*"
|
|
|
|
|
MSG1.S.1 .AZ "LISTENING"
|
|
|
|
|
MSG1.S.2 .AZ "SYN-SENT"
|
|
|
|
|
MSG1.S.3 .AZ "SYN-RECEIVED"
|
|
|
|
|
MSG1.S.4 .AZ "ESTABLISHED"
|
|
|
|
|
MSG1.S.5 .AZ "CLOSE-WAIT"
|
|
|
|
|
MSG1.S.6 .AZ "LAST-ACK"
|
|
|
|
|
MSG1.S.7 .AZ "FIN-WAIT-1"
|
|
|
|
|
MSG1.S.8 .AZ "FIN-WAIT-2"
|
|
|
|
|
MSG1.S.9 .AZ "CLOSING"
|
|
|
|
|
MSG1.S.10 .AZ "TIME-WAIT"
|
2016-02-24 20:00:42 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
2018-06-15 15:15:48 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2016-02-24 20:00:42 +00:00
|
|
|
|
SocketCount .BS 1
|
2018-06-15 15:15:48 +00:00
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
2016-02-24 20:00:42 +00:00
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/BIN/NETSTAT.S
|
2016-02-24 20:00:42 +00:00
|
|
|
|
ASM
|