2015-03-14 21:47:37 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:47:37 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.TF /A2OSX.BOOT/BIN/ARP
|
2015-03-14 21:47:37 +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-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-16 07:19:54 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 40 40*100ms = 4 sec.
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPTR1 .EQ ZPBIN
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
L.SSCANF.IP .DA SSCANF.IP
|
|
|
|
|
L.DST.IP .DA DST.IP
|
|
|
|
|
L.DST.MAC .DA DST.MAC
|
|
|
|
|
L.MSG0 .DA MSG0
|
|
|
|
|
L.MSG1 .DA MSG1
|
|
|
|
|
L.MSG2 .DA MSG2
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-18 06:26:24 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL LoadLibYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgC
|
2016-10-07 20:48:49 +00:00
|
|
|
|
cmp #1
|
2016-03-16 07:19:54 +00:00
|
|
|
|
beq CS.INIT.DUMP
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW L.DST.IP
|
|
|
|
|
>PUSHW L.SSCANF.IP
|
2016-10-18 06:26:24 +00:00
|
|
|
|
lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>PUSHYA
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL SSCANF
|
2015-09-11 18:48:12 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
stz bCTRLC
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
rts CC,Give back control to CS.RUN
|
|
|
|
|
|
|
|
|
|
.9 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-03-16 07:19:54 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>STYA ZPPTR1
|
2016-10-18 06:26:24 +00:00
|
|
|
|
>LDYA L.MSG0
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PRINTFYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-10-18 06:26:24 +00:00
|
|
|
|
ldx #K.ARPCACHE.SIZE
|
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
2016-03-29 06:29:48 +00:00
|
|
|
|
beq .4
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.ARPCACHE.IP+4
|
|
|
|
|
.2 dey
|
2016-03-16 07:19:54 +00:00
|
|
|
|
>PUSHB (ZPPTR1),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
cpy #S.ARPCACHE.IP
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
ldy #S.ARPCACHE.MAC+6
|
|
|
|
|
.3 dey
|
2016-03-16 07:19:54 +00:00
|
|
|
|
>PUSHB (ZPPTR1),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
cpy #S.ARPCACHE.MAC
|
|
|
|
|
bne .3
|
|
|
|
|
|
2016-03-16 07:19:54 +00:00
|
|
|
|
ldy #S.ARPCACHE.TTL+1
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
>PUSHB (ZPPTR1)
|
|
|
|
|
|
2016-10-18 06:26:24 +00:00
|
|
|
|
>LDYA L.MSG1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
phx
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PRINTFYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
plx
|
2016-03-16 07:19:54 +00:00
|
|
|
|
|
2016-03-29 06:29:48 +00:00
|
|
|
|
.4 lda ZPPTR1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.ARPCACHE
|
|
|
|
|
sta ZPPTR1
|
2016-03-29 06:29:48 +00:00
|
|
|
|
bcc .5
|
2015-03-14 21:47:37 +00:00
|
|
|
|
inc ZPPTR1+1
|
2016-03-29 06:29:48 +00:00
|
|
|
|
.5 dex
|
2016-03-16 07:19:54 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.8 lda #0 tell TSKMGR that all done ok, but
|
|
|
|
|
sec we do not want to stay in memory
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-16 07:19:54 +00:00
|
|
|
|
CS.RUN jsr Init.Timeout
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
.1 lda bCTRLC
|
|
|
|
|
bne .9
|
|
|
|
|
>PUSHW L.DST.MAC
|
|
|
|
|
>PUSHW L.DST.IP
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.QUERY
|
2015-09-11 18:48:12 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bcc .2 success, print & exit
|
|
|
|
|
|
2016-03-16 07:19:54 +00:00
|
|
|
|
jsr Wait.TimeOut
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL Sleep
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 ldx #5
|
|
|
|
|
.3 >PUSHB DST.MAC,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
.4 >PUSHB DST.IP,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .4
|
|
|
|
|
|
2016-10-18 06:26:24 +00:00
|
|
|
|
>LDYA L.MSG2
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PRINTFYA
|
2016-10-18 06:26:24 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
2016-03-16 07:19:54 +00:00
|
|
|
|
bpl .1 is it a TIMER event?
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-16 07:19:54 +00:00
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
beq .9
|
2016-03-16 07:19:54 +00:00
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
.9 sec do not discard TIMER event
|
|
|
|
|
rts
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
.1 lda (pEvent)
|
|
|
|
|
and #S.EVT.F.KEY is it a KEY event?
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.hDEV is Event from active IN device?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
ldy #S.PS.hINDEV
|
2015-06-03 18:30:57 +00:00
|
|
|
|
cmp (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
lda #$FF
|
|
|
|
|
sta bCTRLC
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT lda hLIBTCPIP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL UnloadLibA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-16 07:19:54 +00:00
|
|
|
|
Init.Timeout ldy #TimeOut
|
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta (pData),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
|
|
|
|
ldy #bCTRLC
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bmi .9
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:47:37 +00:00
|
|
|
|
CS.END
|
2016-10-24 15:54:43 +00:00
|
|
|
|
LIBTCPIP >PSTR "libtcpip.o"
|
|
|
|
|
SSCANF.IP >PSTR "%d.%d.%d.%d"
|
|
|
|
|
MSG0 >CSTR "STS TTL MAC Address IP Address\n"
|
|
|
|
|
MSG1 >CSTR "$%h %5D %h:%h:%h:%h:%h:%h %d.%d.%d.%d\n"
|
|
|
|
|
MSG2 >CSTR "%d.%d.%d.%d is at %h:%h:%h:%h:%h:%h\n"
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DS.START
|
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
DST.IP .BS 4
|
|
|
|
|
DST.MAC .BS 6
|
|
|
|
|
TimeOut .BS 1
|
|
|
|
|
bCTRLC .BS 1
|
|
|
|
|
DS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/ARP.S
|
|
|
|
|
ASM
|