2015-03-14 21:47:37 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2019-12-04 13:46:58 +00:00
|
|
|
|
.TF bin/ping
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-17 13:03:39 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/eth.i
|
|
|
|
|
.INB inc/libtcpip.i
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-15 07:08:20 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 100 10 sec.
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2019-06-21 06:33:46 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
2019-11-15 07:17:31 +00:00
|
|
|
|
ZPIPCfgPtr .BS 2
|
|
|
|
|
ZPTmpPtr .BS 2
|
|
|
|
|
Identifier .BS 2
|
|
|
|
|
Sequence .BS 2
|
|
|
|
|
|
|
|
|
|
TimeOut.ms .BS 2
|
|
|
|
|
ArgIndex .BS 1
|
|
|
|
|
ArgHostName .BS 1
|
|
|
|
|
hSocket .BS 1
|
|
|
|
|
hFrame .BS 1
|
|
|
|
|
PingCount .BS 1
|
|
|
|
|
TimeOut .BS 1
|
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
IP.Remote .BS 4
|
|
|
|
|
|
2019-06-21 06:33:46 +00:00
|
|
|
|
ZS.END .ED
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2018-09-11 13:32:56 +00:00
|
|
|
|
.DA #S.PS.F.EVENT S.PS.F
|
|
|
|
|
.DA #0
|
2019-06-21 06:33:46 +00:00
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data SegmentSize
|
|
|
|
|
.DA #64 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA CS.DOEVENT
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
2017-01-30 16:30:39 +00:00
|
|
|
|
L.MSG.IPKO .DA MSG.IPKO
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.UNKNOWN .DA MSG.UNKNOWN
|
|
|
|
|
L.MSG.HOSTOK .DA MSG.HOSTOK
|
2017-01-30 22:23:16 +00:00
|
|
|
|
L.MSG.SKTKO .DA MSG.SKTKO
|
|
|
|
|
L.MSG.REPLY .DA MSG.REPLY
|
|
|
|
|
L.MSG.UNREACH .DA MSG.UNREACH
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2017-01-30 16:30:39 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>SYSCALL LoadLib
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bcs .9
|
2017-01-30 16:30:39 +00:00
|
|
|
|
sta hLIBTCPIP
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2017-01-30 16:30:39 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-01-16 21:51:57 +00:00
|
|
|
|
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
2017-01-30 16:30:39 +00:00
|
|
|
|
>STYA ZPIPCfgPtr
|
|
|
|
|
lda (ZPIPCfgPtr) Configured ?
|
2019-12-07 17:53:45 +00:00
|
|
|
|
bmi .1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2017-01-30 16:30:39 +00:00
|
|
|
|
>LDYA L.MSG.IPKO
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2019-10-03 06:25:27 +00:00
|
|
|
|
sec
|
2017-01-29 21:47:19 +00:00
|
|
|
|
rts
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
.1 ldy #DATA.Len-1
|
|
|
|
|
|
|
|
|
|
.2 lda ICMP.Request,y
|
|
|
|
|
sta (pData),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
CS.RUN.IPOK inc ArgIndex
|
|
|
|
|
lda ArgIndex
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV
|
2018-09-11 13:32:56 +00:00
|
|
|
|
bcs .8
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2018-09-11 13:32:56 +00:00
|
|
|
|
>STYA ZPTmpPtr
|
|
|
|
|
lda (ZPTmpPtr)
|
|
|
|
|
cmp #'-'
|
2019-11-15 07:17:31 +00:00
|
|
|
|
bne .1
|
2017-12-22 21:24:30 +00:00
|
|
|
|
|
2018-09-11 13:32:56 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPTmpPtr),y
|
2017-01-30 16:30:39 +00:00
|
|
|
|
beq .9
|
2018-09-11 13:32:56 +00:00
|
|
|
|
|
|
|
|
|
cmp #'0'
|
|
|
|
|
bcc .9
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2018-09-11 13:32:56 +00:00
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcs .9
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2018-09-11 13:32:56 +00:00
|
|
|
|
and #$0F
|
2019-11-15 07:17:31 +00:00
|
|
|
|
sta PingCount
|
|
|
|
|
bra CS.RUN.IPOK
|
|
|
|
|
|
|
|
|
|
.1 lda #TIMEOUT.MAX
|
2020-08-17 13:03:39 +00:00
|
|
|
|
sta TimeOut
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
.2 >PUSHEA.G SA.REMOTE+S.SOCKADDR.ADDR
|
2018-09-11 13:32:56 +00:00
|
|
|
|
>PUSHW ZPTmpPtr
|
2020-08-17 13:03:39 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName
|
2018-09-11 13:32:56 +00:00
|
|
|
|
bcc .3
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2020-08-17 13:03:39 +00:00
|
|
|
|
lda TimeOut
|
2019-11-15 07:17:31 +00:00
|
|
|
|
bne .2
|
2017-01-30 16:30:39 +00:00
|
|
|
|
|
2020-04-07 06:01:38 +00:00
|
|
|
|
>PUSHW L.MSG.UNKNOWN
|
2018-09-11 13:32:56 +00:00
|
|
|
|
>PUSHW ZPTmpPtr
|
2018-08-25 11:23:59 +00:00
|
|
|
|
>PUSHBI 2
|
2017-01-30 16:30:39 +00:00
|
|
|
|
bra .99
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
.3 lda ArgIndex
|
|
|
|
|
sta ArgHostName
|
2020-04-07 06:01:38 +00:00
|
|
|
|
jmp CS.RUN.IPOK
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
.8 >LDA.G SA.REMOTE+S.SOCKADDR.ADDR
|
2018-09-11 13:32:56 +00:00
|
|
|
|
bne CS.RUN.ARGSOK
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2020-04-07 06:01:38 +00:00
|
|
|
|
.9 >PUSHW L.MSG.USAGE
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
.99 >SYSCALL PrintF
|
2018-08-25 11:23:59 +00:00
|
|
|
|
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2019-10-03 06:25:27 +00:00
|
|
|
|
sec
|
2016-03-13 21:51:50 +00:00
|
|
|
|
rts
|
2017-01-30 21:03:12 +00:00
|
|
|
|
|
2020-04-07 06:01:38 +00:00
|
|
|
|
CS.RUN.ARGSOK >PUSHW L.MSG.HOSTOK
|
|
|
|
|
|
|
|
|
|
ldx #4
|
|
|
|
|
ldy #SA.REMOTE+S.SOCKADDR.ADDR
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
.1 lda (pData),y
|
2017-01-30 22:23:16 +00:00
|
|
|
|
>PUSHA
|
2020-04-07 06:01:38 +00:00
|
|
|
|
iny
|
2017-01-30 22:23:16 +00:00
|
|
|
|
dex
|
2020-04-07 06:01:38 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda ArgHostName
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
>PUSHYA
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 6
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2017-01-30 21:03:12 +00:00
|
|
|
|
CS.RUN.OPENSKT ldx #3
|
2017-01-30 16:30:39 +00:00
|
|
|
|
ldy #S.IPCFG.IP+3
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2017-01-30 16:30:39 +00:00
|
|
|
|
.1 lda (ZPIPCfgPtr),y
|
2019-12-07 17:53:45 +00:00
|
|
|
|
sta IP.Remote,x
|
2015-03-14 21:47:37 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
ldy #SA.LOCAL+S.SOCKADDR.ADDR+3
|
|
|
|
|
|
|
|
|
|
.2 lda IP.Remote,x
|
|
|
|
|
sta (pData),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
lda A2osX.RANDOM16
|
2019-12-07 17:53:45 +00:00
|
|
|
|
eor A2osX.TIMER16+1
|
|
|
|
|
>STA.G SA.LOCAL+S.SOCKADDR.PORT
|
|
|
|
|
>STA.G SA.REMOTE+S.SOCKADDR.PORT
|
2019-11-15 07:17:31 +00:00
|
|
|
|
sta Identifier
|
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
lda A2osX.RANDOM16+1
|
2019-12-07 17:53:45 +00:00
|
|
|
|
eor A2osX.TIMER16
|
|
|
|
|
>STA.G SA.LOCAL+S.SOCKADDR.PORT+1
|
|
|
|
|
>STA.G SA.REMOTE+S.SOCKADDR.PORT+1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
sta Identifier+1
|
|
|
|
|
|
2018-11-05 07:12:31 +00:00
|
|
|
|
>PUSHBI S.IP.PROTOCOL.ICMP
|
|
|
|
|
lda #S.SOCKET.T.RAW
|
2020-08-17 13:03:39 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
2018-11-05 16:28:40 +00:00
|
|
|
|
bcs .9
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
sta hSocket
|
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
>PUSHEA.G SA.LOCAL
|
2019-11-15 07:17:31 +00:00
|
|
|
|
lda hSocket
|
2018-11-05 07:12:31 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Bind
|
2018-11-05 16:28:40 +00:00
|
|
|
|
bcs .9
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
>PUSHEA.G SA.REMOTE
|
2019-11-15 07:17:31 +00:00
|
|
|
|
lda hSocket
|
2018-11-07 21:48:48 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Connect
|
2019-12-07 17:53:45 +00:00
|
|
|
|
bcc CS.RUN.SEND.ECHO
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2018-11-05 16:28:40 +00:00
|
|
|
|
.9 >LDYA L.MSG.SKTKO
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2018-11-05 16:28:40 +00:00
|
|
|
|
lda #E.SYN
|
2019-10-03 06:25:27 +00:00
|
|
|
|
sec
|
2018-11-05 07:12:31 +00:00
|
|
|
|
rts
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
CS.RUN.SEND.ECHO
|
2019-12-07 17:53:45 +00:00
|
|
|
|
>SLEEP
|
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
lda Identifier
|
2020-08-17 20:47:31 +00:00
|
|
|
|
>STA.G Request+S.ICMP.IDENTIFIER-S.IP+1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
lda Identifier+1
|
|
|
|
|
dey
|
2017-02-01 21:21:46 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
inc Sequence
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
inc Sequence+1
|
|
|
|
|
|
|
|
|
|
.1 lda Sequence
|
2020-08-17 20:47:31 +00:00
|
|
|
|
>STA.G Request+S.ICMP.SEQUENCE-S.IP+1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
lda Sequence+1
|
|
|
|
|
dey
|
2017-02-01 21:21:46 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
>PUSHWI ICMP.RequestLen
|
2019-11-15 07:17:31 +00:00
|
|
|
|
>PUSHW pData
|
|
|
|
|
lda hSocket
|
2019-08-06 07:14:22 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Send
|
2017-01-30 22:23:16 +00:00
|
|
|
|
bcs CS.RUN.ERR
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
lda #TIMEOUT.MAX
|
2020-08-17 13:03:39 +00:00
|
|
|
|
sta TimeOut
|
2017-01-30 21:03:12 +00:00
|
|
|
|
CS.RUN.WAIT.REPLY
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2019-02-22 21:54:47 +00:00
|
|
|
|
ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
2020-08-17 20:47:31 +00:00
|
|
|
|
>SYSCALL FEOF
|
2019-02-22 21:54:47 +00:00
|
|
|
|
bcs CS.RUN.ERR
|
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2017-12-22 21:24:30 +00:00
|
|
|
|
>SYSCALL GetChar
|
2019-02-22 21:54:47 +00:00
|
|
|
|
bcs CS.RUN.ERR
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2017-01-30 21:03:12 +00:00
|
|
|
|
cmp #3 Ctrl-C
|
2018-09-11 13:32:56 +00:00
|
|
|
|
beq CS.RUN.ERR CS
|
2019-08-06 07:14:22 +00:00
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
.1 lda hSocket
|
2018-10-29 08:41:10 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
2018-09-11 13:32:56 +00:00
|
|
|
|
bcc .2
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2020-08-17 13:03:39 +00:00
|
|
|
|
lda TimeOut
|
2019-11-15 07:17:31 +00:00
|
|
|
|
bne CS.RUN.WAIT.REPLY
|
2018-09-11 13:32:56 +00:00
|
|
|
|
|
|
|
|
|
jsr CS.Print.UNREACH
|
|
|
|
|
bcs CS.RUN.ERR
|
|
|
|
|
bra .7
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
.2 sta hFrame
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2018-09-11 13:32:56 +00:00
|
|
|
|
>STYA ZPTmpPtr
|
2017-01-30 21:03:12 +00:00
|
|
|
|
jsr CS.Print.REPLY
|
2017-01-30 22:23:16 +00:00
|
|
|
|
bcs CS.RUN.ERR
|
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
lda hFrame
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2019-11-15 07:17:31 +00:00
|
|
|
|
stz hFrame
|
2017-02-01 21:21:46 +00:00
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
.7 lda PingCount
|
2018-09-11 13:32:56 +00:00
|
|
|
|
beq .8
|
2019-11-15 07:17:31 +00:00
|
|
|
|
dec PingCount
|
2019-12-06 07:15:51 +00:00
|
|
|
|
dec A=0
|
|
|
|
|
beq .80
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2018-09-11 13:32:56 +00:00
|
|
|
|
.8 jmp CS.RUN.SEND.ECHO
|
2019-12-06 07:15:51 +00:00
|
|
|
|
|
|
|
|
|
.80 sec
|
2017-01-30 22:23:16 +00:00
|
|
|
|
CS.RUN.ERR rts
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
2017-01-30 22:23:16 +00:00
|
|
|
|
bpl .9 is it a TIMER event?
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
lda TimeOut
|
2016-03-13 21:51:50 +00:00
|
|
|
|
beq .9
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
dec TimeOut
|
|
|
|
|
|
2017-01-30 16:30:39 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-30 22:23:16 +00:00
|
|
|
|
CS.Print.UNREACH
|
2020-04-07 06:01:38 +00:00
|
|
|
|
>PUSHW L.MSG.UNREACH
|
|
|
|
|
|
|
|
|
|
ldx #4
|
|
|
|
|
ldy #SA.REMOTE+S.SOCKADDR.ADDR
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2019-12-07 17:53:45 +00:00
|
|
|
|
.1 lda (pData),y
|
|
|
|
|
>PUSHA
|
2020-04-07 06:01:38 +00:00
|
|
|
|
iny
|
2018-08-23 15:16:20 +00:00
|
|
|
|
dex
|
2020-04-07 06:01:38 +00:00
|
|
|
|
bne .1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 4
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2017-01-30 22:23:16 +00:00
|
|
|
|
rts
|
2017-01-30 21:03:12 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-30 16:30:39 +00:00
|
|
|
|
CS.Print.REPLY lda #TIMEOUT.MAX
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sec
|
2019-11-15 07:17:31 +00:00
|
|
|
|
sbc TimeOut
|
|
|
|
|
|
|
|
|
|
stz TimeOut.ms
|
|
|
|
|
stz TimeOut.ms+1
|
2018-09-11 13:32:56 +00:00
|
|
|
|
tax
|
2015-03-14 21:47:37 +00:00
|
|
|
|
beq .3
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
.1 lda TimeOut.ms
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
2016-03-13 21:51:50 +00:00
|
|
|
|
adc #100
|
2019-11-15 07:17:31 +00:00
|
|
|
|
sta TimeOut.ms
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bcc .2
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
|
|
|
|
inc TimeOut.ms+1
|
|
|
|
|
|
2018-09-11 13:32:56 +00:00
|
|
|
|
.2 dex
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bne .1
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2020-04-07 06:01:38 +00:00
|
|
|
|
.3 >PUSHW L.MSG.REPLY
|
|
|
|
|
|
|
|
|
|
ldx #4
|
|
|
|
|
ldy #S.IP.SRC
|
|
|
|
|
|
|
|
|
|
.4 >PUSHB (ZPTmpPtr),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .4
|
2018-08-23 15:16:20 +00:00
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
ldy #S.ICMP.SEQUENCE
|
2018-09-11 13:32:56 +00:00
|
|
|
|
>PUSHB (ZPTmpPtr),y
|
2019-11-15 07:17:31 +00:00
|
|
|
|
iny
|
2018-09-11 13:32:56 +00:00
|
|
|
|
>PUSHB (ZPTmpPtr),y
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2020-04-07 06:01:38 +00:00
|
|
|
|
ldy #S.IP.TTL
|
|
|
|
|
>PUSHB (ZPTmpPtr),y
|
2019-11-15 07:17:31 +00:00
|
|
|
|
|
2020-04-07 06:01:38 +00:00
|
|
|
|
>PUSHW TimeOut.ms
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 9
|
2020-04-07 06:01:38 +00:00
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-11-15 07:17:31 +00:00
|
|
|
|
CS.QUIT lda hFrame
|
2017-02-01 21:21:46 +00:00
|
|
|
|
beq .1
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2017-02-01 21:21:46 +00:00
|
|
|
|
|
2019-11-15 07:17:31 +00:00
|
|
|
|
.1 lda hSocket
|
2018-09-11 13:32:56 +00:00
|
|
|
|
beq .2
|
2018-07-24 06:24:23 +00:00
|
|
|
|
|
2018-11-06 07:09:44 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
2018-09-11 13:32:56 +00:00
|
|
|
|
.2 lda hLIBTCPIP
|
|
|
|
|
beq .8
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2018-09-11 13:32:56 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2019-12-03 15:42:17 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
MSG.IPKO .AZ "TCP/IP Not Loaded/Configured."
|
2018-09-11 13:32:56 +00:00
|
|
|
|
MSG.USAGE .AS "Usage : PING <ip|host>\r\n"
|
|
|
|
|
.AZ " -1-9 : Ping Count\r\n"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.UNKNOWN .AZ "%s: Unknown host\r\n"
|
|
|
|
|
MSG.HOSTOK .AZ "PING %d.%d.%d.%d (%s)\r\n"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
MSG.SKTKO .AZ "Failed to Open Socket."
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.UNREACH .AZ "%d.%d.%d.%d: TimeOut/Host unreachable\r\n"
|
|
|
|
|
MSG.REPLY .AZ "32 bytes from %d.%d.%d.%d, icmp_seq=%D, ttl=%d, time=%D ms\r\n"
|
2015-03-14 21:47:37 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
2018-08-23 15:16:20 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-30 16:30:39 +00:00
|
|
|
|
ICMP.Request .DA #S.ICMP.TYPE.ECHOREQ
|
|
|
|
|
.DA #0 CODE
|
|
|
|
|
.DA 0 CHECKSUM
|
2019-11-15 07:17:31 +00:00
|
|
|
|
.BS 2 ID
|
|
|
|
|
.BS 2 DQ
|
2017-01-30 16:30:39 +00:00
|
|
|
|
.AS "ABCDEFGHIJKLMNOP"
|
|
|
|
|
.AS "QRSTUVWXYZ012345"
|
2017-01-31 22:13:26 +00:00
|
|
|
|
ICMP.RequestLen .EQ *-ICMP.Request
|
2019-12-07 17:53:45 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DA #AF.INET S.SOCKADDR.AF
|
|
|
|
|
.BS 1
|
|
|
|
|
.BS 4 S.SOCKADDR.ADDR
|
|
|
|
|
.BS 2 S.SOCKADDR.PORT
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DA #AF.INET S.SOCKADDR.AF
|
|
|
|
|
.BS 1
|
|
|
|
|
.BS 4 S.SOCKADDR.ADDR
|
|
|
|
|
.BS 2
|
|
|
|
|
DATA.Len .EQ *-ICMP.Request
|
2015-06-03 18:30:57 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2019-11-15 07:17:31 +00:00
|
|
|
|
Request .BS ICMP.RequestLen
|
2019-12-07 17:53:45 +00:00
|
|
|
|
SA.LOCAL .BS S.SOCKADDR
|
|
|
|
|
SA.REMOTE .BS S.SOCKADDR
|
|
|
|
|
DS.END .ED
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-08-17 13:03:39 +00:00
|
|
|
|
SAVE usr/src/bin/ping.s
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ASM
|