2015-10-19 20:35:00 +00:00
|
|
|
|
NEW
|
2020-08-19 19:39:43 +00:00
|
|
|
|
AUTO 3,1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.TF bin/rpcdump
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/eth.i
|
|
|
|
|
.INB inc/libtcpip.i
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-02-24 20:01:26 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 40 40*100ms = 4 sec.
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPIPCfgPtr .BS 2
|
|
|
|
|
ZPFrameBase .BS 2
|
|
|
|
|
ZS.END .ED
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2018-09-25 06:25:32 +00:00
|
|
|
|
.DA #S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
2018-05-24 15:21:38 +00:00
|
|
|
|
.DA #16 SS
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
2016-02-24 20:01:26 +00:00
|
|
|
|
L.Socket .DA Socket
|
|
|
|
|
L.Socket.Dst.Addr .DA Socket.Dst.Addr
|
|
|
|
|
L.RPC.Request .DA RPC.Request
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.UNKNOWN .DA MSG.UNKNOWN
|
|
|
|
|
L.MSG.TIMEOUT .DA MSG.TIMEOUT
|
|
|
|
|
L.MSG.DUMP0 .DA MSG.DUMP0
|
|
|
|
|
L.MSG.DUMP1 .DA MSG.DUMP1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2017-12-22 21:24:30 +00:00
|
|
|
|
CS.INIT ldy #S.PS.ARGC
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2016-02-24 20:01:26 +00:00
|
|
|
|
beq .99
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>LDYA L.LIBTCPIP
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>SYSCALL LoadLib
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcs .99
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>STYA ZPIPCfgPtr
|
|
|
|
|
lda (ZPIPCfgPtr) Configured ?
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bpl .99
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.IPCFG.IP+3
|
|
|
|
|
.1 lda (ZPIPCfgPtr),y
|
|
|
|
|
sta Socket.Src.Addr,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
2016-02-24 20:01:26 +00:00
|
|
|
|
rts
|
|
|
|
|
.99 >LDYA L.MSG.USAGE
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2016-02-24 20:01:26 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
CS.RUN jsr Init.TimeOut
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.1 >PUSHW L.Socket.Dst.Addr
|
2016-10-17 06:21:04 +00:00
|
|
|
|
lda #1
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHYA
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GetByName
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2020-08-19 19:39:43 +00:00
|
|
|
|
jsr Wait.TimeOut
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .1
|
2016-10-17 06:21:04 +00:00
|
|
|
|
lda #1
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHYA
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 2
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>LDYA L.MSG.UNKNOWN
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-02-24 20:01:26 +00:00
|
|
|
|
rts
|
|
|
|
|
.2 >PUSHW L.Socket
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Socket
|
2017-03-16 07:32:24 +00:00
|
|
|
|
bcs .91
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>STA.G hSocket
|
2017-03-16 07:32:24 +00:00
|
|
|
|
ldx #3
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.21 lda A2osX.TIMER16,x
|
2017-03-16 07:32:24 +00:00
|
|
|
|
sta RPC.Request,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .21
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.3 >PUSHWI RPC.Request.End-RPC.Request
|
2017-03-16 07:32:24 +00:00
|
|
|
|
>PUSHW L.RPC.Request
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>LDA.G hSocket
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Send
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .4
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2020-08-19 19:39:43 +00:00
|
|
|
|
jsr Wait.TimeOut
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .3
|
2017-03-16 07:32:24 +00:00
|
|
|
|
.91 bra .99
|
2020-08-19 19:39:43 +00:00
|
|
|
|
.4 jsr Init.TimeOut
|
2016-02-24 20:01:26 +00:00
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
.5 >LDA.G hSocket
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Recv
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .6
|
2017-11-17 16:16:05 +00:00
|
|
|
|
>SLEEP
|
2020-08-19 19:39:43 +00:00
|
|
|
|
jsr Wait.TimeOut
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .5
|
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.6 ldy #hFrame
|
|
|
|
|
sta (pData),y
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>STYA ZPFrameBase
|
|
|
|
|
jsr DumpRPCFrame
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
ldy #hFrame
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda (pData),y
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda #0
|
2016-02-24 20:01:26 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-10-17 06:21:04 +00:00
|
|
|
|
.99 lda #1
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>PUSHYA
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 2
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>LDYA L.MSG.TIMEOUT
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-02-24 20:01:26 +00:00
|
|
|
|
sec
|
2015-10-19 20:35:00 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT lda (pEvent)
|
2017-01-29 21:47:19 +00:00
|
|
|
|
bpl .9 is it a TIMER event?
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
2016-02-24 20:01:26 +00:00
|
|
|
|
beq .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
2015-10-19 20:35:00 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-02-24 20:01:26 +00:00
|
|
|
|
CS.QUIT ldy #hSocket
|
|
|
|
|
lda (pData),y
|
2017-03-16 07:32:24 +00:00
|
|
|
|
beq .1
|
2020-08-19 19:39:43 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
|
2017-03-16 07:32:24 +00:00
|
|
|
|
.1 lda hLIBTCPIP
|
2016-02-24 20:01:26 +00:00
|
|
|
|
beq .8
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-08-19 19:39:43 +00:00
|
|
|
|
Init.TimeOut ldy #TimeOut
|
2016-02-24 20:01:26 +00:00
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta (pData),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DumpRPCFrame lda #S.UDP+24
|
|
|
|
|
clc
|
|
|
|
|
adc ZPFrameBase
|
|
|
|
|
sta ZPFrameBase
|
|
|
|
|
lda /S.UDP+24
|
|
|
|
|
adc ZPFrameBase+1
|
|
|
|
|
sta ZPFrameBase+1
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DUMP0
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.1 ldy #3
|
|
|
|
|
lda (ZPFrameBase),y Value follows?
|
|
|
|
|
beq .9
|
|
|
|
|
ldy #18 port
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
iny
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
|
|
|
|
|
ldy #15 proto
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
|
|
|
|
|
ldy #11 version
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
ldy #4 program
|
|
|
|
|
.7 >PUSHB (ZPFrameBase),y
|
|
|
|
|
iny
|
|
|
|
|
cpy #8
|
|
|
|
|
bne .7
|
|
|
|
|
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 8
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG.DUMP1
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2016-02-24 20:01:26 +00:00
|
|
|
|
lda #20
|
2015-10-19 20:35:00 +00:00
|
|
|
|
clc
|
2016-02-24 20:01:26 +00:00
|
|
|
|
adc ZPFrameBase
|
|
|
|
|
sta ZPFrameBase
|
|
|
|
|
bcc .1
|
|
|
|
|
inc ZPFrameBase+1
|
|
|
|
|
bra .1
|
|
|
|
|
.9 rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2019-12-03 15:42:17 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
MSG.USAGE .AZ "Usage : RPCDUMP <ip|host>"
|
|
|
|
|
MSG.UNKNOWN .AZ "%s: Unknown host\r\n"
|
|
|
|
|
MSG.TIMEOUT .AZ "No response from %s\r\n"
|
|
|
|
|
MSG.DUMP0 .AZ "Program Ver Proto:Port"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.DUMP1 .AZ "%10L %2d %2d:%D\r\n"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-28 15:24:44 +00:00
|
|
|
|
Socket .DA #S.SOCKET.T.DGRAM
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.BS 3
|
|
|
|
|
Socket.Src.Addr .BS 4
|
|
|
|
|
Socket.Src.Port .DA 0 Dynamic
|
|
|
|
|
Socket.Dst.Addr .BS 4
|
|
|
|
|
Socket.Dst.Port .DA UDP.PORT.PMAP
|
|
|
|
|
*--------------------------------------
|
2017-03-16 07:32:24 +00:00
|
|
|
|
RPC.Request .BS 4 XID
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.HS 00000000 0=CALL
|
|
|
|
|
.HS 00000002 RPCVERS
|
|
|
|
|
.HS 000186A0 PROG=portmapper
|
|
|
|
|
.HS 00000002 VERS
|
|
|
|
|
.HS 00000004 PMAPPROC_DUMP
|
|
|
|
|
.HS 00000000 CRED
|
|
|
|
|
.HS 00000000
|
|
|
|
|
.HS 00000000 VERF
|
|
|
|
|
.HS 00000000
|
|
|
|
|
RPC.Request.End .EQ *
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2016-02-24 20:01:26 +00:00
|
|
|
|
hSocket .BS 1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
hFrame .BS 1
|
|
|
|
|
TimeOut .BS 1
|
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-08-19 19:39:43 +00:00
|
|
|
|
SAVE usr/src/bin/rpcdump.s
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ASM
|