2015-10-19 20:35:00 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2016-10-07 20:48:49 +00:00
|
|
|
|
.TF /A2OSX.DEV/BIN/RPCDUMP
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-26 20:51:06 +00:00
|
|
|
|
.INB /A2OSX.DEV/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.DEV/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.DEV/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
|
|
|
|
*--------------------------------------
|
2016-02-24 20:01:26 +00:00
|
|
|
|
ZPIPCfgPtr .EQ ZPBIN
|
|
|
|
|
ZPFrameBase .EQ ZPBIN+2
|
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
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.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
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
CS.INIT >SYSCALL GetArgC
|
2016-10-17 06:21:04 +00:00
|
|
|
|
cmp #1
|
2016-02-24 20:01:26 +00:00
|
|
|
|
beq .99
|
|
|
|
|
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>LDYA L.LIBTCPIP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL LoadLibYA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcs .99
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>STYA ZPIPCfgPtr
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (ZPIPCfgPtr) Configured ?
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bpl .99
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
|
|
|
|
clc
|
2016-02-24 20:01:26 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.99 >LDYA L.MSG.USAGE
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-02-24 20:01:26 +00:00
|
|
|
|
lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2016-02-24 20:01:26 +00:00
|
|
|
|
CS.RUN jsr Init.Timeout
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.1 >PUSHW L.Socket.Dst.Addr
|
2016-10-17 06:21:04 +00:00
|
|
|
|
lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHYA
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.HST.GETBYNAME
|
|
|
|
|
bcc .2
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL Sleep
|
2016-02-24 20:01:26 +00:00
|
|
|
|
jsr Wait.Timeout
|
|
|
|
|
bcc .1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
>PUSHYA
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>LDYA L.MSG.UNKNOWN
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
sec
|
2016-02-24 20:01:26 +00:00
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.2 >PUSHW L.Socket
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.NEW
|
2016-03-27 21:01:34 +00:00
|
|
|
|
bcs .99
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-03-27 21:01:34 +00:00
|
|
|
|
txa
|
2016-02-24 20:01:26 +00:00
|
|
|
|
ldy #hSocket
|
|
|
|
|
sta (pData),y
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.3 >PUSHWI RPC.Request.End-RPC.Request
|
|
|
|
|
>PUSHW L.RPC.Request
|
|
|
|
|
ldy #hSocket
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.SEND
|
|
|
|
|
bcc .4
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL Sleep
|
2016-02-24 20:01:26 +00:00
|
|
|
|
jsr Wait.Timeout
|
|
|
|
|
bcc .3
|
|
|
|
|
bra .99
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.4 jsr Init.Timeout
|
|
|
|
|
|
|
|
|
|
.5 ldy #hSocket
|
2015-10-19 20:35:00 +00:00
|
|
|
|
lda (pData),y
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.RCVDA
|
2016-02-24 20:01:26 +00:00
|
|
|
|
bcc .6
|
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL Sleep
|
2016-02-24 20:01:26 +00:00
|
|
|
|
jsr Wait.Timeout
|
|
|
|
|
bcc .5
|
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.6 ldy #hFrame
|
|
|
|
|
sta (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>STYA ZPFrameBase
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
2016-02-24 20:01:26 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
.99 lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2016-02-24 20:01:26 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG.TIMEOUT
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
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
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CLOSEA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
lda hLIBTCPIP
|
2016-02-24 20:01:26 +00:00
|
|
|
|
beq .8
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL UnloadLibA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Init.Timeout ldy #TimeOut
|
|
|
|
|
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
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
.1 ldy #3
|
|
|
|
|
lda (ZPFrameBase),y Value follows?
|
|
|
|
|
beq .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
ldy #18 port
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
iny
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
|
|
|
|
|
ldy #15 proto
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
|
|
|
|
|
|
|
|
|
ldy #11 version
|
|
|
|
|
>PUSHB (ZPFrameBase),y
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2016-02-24 20:01:26 +00:00
|
|
|
|
ldy #4 program
|
|
|
|
|
.7 >PUSHB (ZPFrameBase),y
|
|
|
|
|
iny
|
|
|
|
|
cpy #8
|
|
|
|
|
bne .7
|
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG.DUMP1
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
LIBTCPIP >PSTR "libtcpip.o"
|
|
|
|
|
MSG.USAGE >CSTR "Usage : RPCDUMP <ip|host>\n"
|
|
|
|
|
MSG.UNKNOWN >CSTR "%S: Unknown host\n"
|
|
|
|
|
MSG.TIMEOUT >CSTR "No response from %S\n"
|
|
|
|
|
MSG.DUMP0 >CSTR "Program Ver Proto:Port\n"
|
|
|
|
|
MSG.DUMP1 >CSTR "%10L %2d %2d:%D\n"
|
2016-02-24 20:01:26 +00:00
|
|
|
|
Socket .DA #S.SOCKET.SOCK.DGRAM
|
|
|
|
|
.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
|
|
|
|
|
.BS 16
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
RPC.Request .HS 12345678 XID
|
|
|
|
|
.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
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.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
|
2016-03-13 21:51:50 +00:00
|
|
|
|
SAVE BIN/RPCDUMP.S
|
2015-10-19 20:35:00 +00:00
|
|
|
|
ASM
|