2019-03-11 07:01:40 +00:00
|
|
|
|
NEW
|
2019-05-27 06:01:59 +00:00
|
|
|
|
AUTO 3,1
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-08-17 20:47:31 +00:00
|
|
|
|
.TF bin/aarp
|
2019-03-11 07:01:40 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-17 20:47:31 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/eth.i
|
|
|
|
|
.INB inc/libetalk.i
|
2019-03-11 07:01:40 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TIMEOUT.MAX .EQ 40 40*100ms = 4 sec.
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
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 #S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
2019-05-27 06:01:59 +00:00
|
|
|
|
.DA #64 SS
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.DA #2 ZP
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBETALK .DA LIBETALK
|
|
|
|
|
L.SSCANF.ADDR .DA SSCANF.ADDR
|
|
|
|
|
L.SSCANF.MAC .DA SSCANF.MAC
|
|
|
|
|
L.MSG.Usage .DA MSG.Usage
|
|
|
|
|
L.MSG0 .DA MSG0
|
|
|
|
|
L.MSG1 .DA MSG1
|
|
|
|
|
L.MSG2 .DA MSG2
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT >LDYA L.LIBETALK
|
|
|
|
|
>SYSCALL LoadLib
|
|
|
|
|
bcs .9
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
sta hLIBETALK
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN >LIBCALL hLIBETALK,LIBETALK.GETCFG
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jmp CS.RUN.ERR
|
2019-03-11 07:01:40 +00:00
|
|
|
|
|
|
|
|
|
.1 ldy #S.PS.ARGC
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2019-03-11 07:01:40 +00:00
|
|
|
|
cmp #1
|
|
|
|
|
bcs .2
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
jmp CS.RUN.DUMP
|
|
|
|
|
|
|
|
|
|
.2 >PUSHEA.G DST.ADDR+3
|
|
|
|
|
>PUSHEA.G DST.ADDR+1
|
|
|
|
|
>PUSHBI 4 2 Ptrs
|
|
|
|
|
>PUSHW L.SSCANF.ADDR
|
|
|
|
|
lda #1
|
|
|
|
|
>SYSCALL ArgV
|
2020-08-17 20:47:31 +00:00
|
|
|
|
>SYSCALL SScanF
|
2019-03-11 07:01:40 +00:00
|
|
|
|
bcs CS.RUN.ERR
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
ldy #S.PS.ARGC
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2023-10-18 05:41:12 +00:00
|
|
|
|
cmp #2
|
|
|
|
|
bcc CS.RUN.QUERY
|
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
bne CS.RUN.ERR
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
jmp CS.RUN.ADD
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2023-10-18 05:41:12 +00:00
|
|
|
|
CS.RUN.ERR >LDYA L.MSG.Usage
|
|
|
|
|
>SYSCALL PutS
|
2019-03-11 07:01:40 +00:00
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.QUERY jsr Init.Timeout
|
|
|
|
|
|
|
|
|
|
.1 >PUSHEA.G DST.MAC
|
|
|
|
|
>PUSHEA.G DST.ADDR
|
2020-08-17 20:47:31 +00:00
|
|
|
|
>LIBCALL hLIBETALK,LIBETALK.AARP.Query
|
2019-03-11 07:01:40 +00:00
|
|
|
|
bcc .2 success, print & exit
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
jsr Wait.TimeOut
|
|
|
|
|
bcs .8
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
>SLEEP
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .1
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
cmp #3
|
|
|
|
|
beq .9
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
bra .1
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.2 ldx #5
|
|
|
|
|
ldy #DST.MAC+5
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.3 >PUSHB (pData),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
ldy #DST.ADDR+3
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.4 >PUSHB (pData),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .4
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
>PUSHBI 8
|
|
|
|
|
>LDYA L.MSG2
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.8 lda #0
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.ADD >PUSHEA.G DST.MAC+5
|
|
|
|
|
>PUSHEA.G DST.MAC+4
|
|
|
|
|
>PUSHEA.G DST.MAC+3
|
|
|
|
|
>PUSHEA.G DST.MAC+2
|
|
|
|
|
>PUSHEA.G DST.MAC+1
|
|
|
|
|
>PUSHEA.G DST.MAC
|
|
|
|
|
>PUSHBI 12 6 Ptrs
|
|
|
|
|
>PUSHW L.SSCANF.MAC
|
|
|
|
|
lda #2
|
|
|
|
|
>SYSCALL ArgV
|
2020-08-17 20:47:31 +00:00
|
|
|
|
>SYSCALL SScanF
|
2019-03-11 07:01:40 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>PUSHEA.G DST.MAC
|
|
|
|
|
>PUSHEA.G DST.ADDR
|
2023-10-18 05:41:12 +00:00
|
|
|
|
* >LIBCALL hLIBETALK,LIBETALK.AARP.Add
|
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
clc
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.8 rts
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.9 jmp CS.RUN.ERR
|
|
|
|
|
*--------------------------------------
|
2020-08-17 20:47:31 +00:00
|
|
|
|
CS.RUN.DUMP >LIBCALL hLIBETALK,LIBETALK.AARP.GetCache
|
2019-03-11 07:01:40 +00:00
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
>LDYA L.MSG0
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-03-11 07:01:40 +00:00
|
|
|
|
|
|
|
|
|
ldx #K.AARPCACHE.SIZE
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.1 lda (ZPPTR1)
|
|
|
|
|
beq .4
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
ldy #S.AARPCACHE.ADDR+3
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
|
|
|
|
dey
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
2019-05-27 06:01:59 +00:00
|
|
|
|
iny
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
2019-03-11 07:01:40 +00:00
|
|
|
|
ldy #S.AARPCACHE.MAC+6
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.3 dey
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
|
|
|
|
cpy #S.AARPCACHE.MAC
|
|
|
|
|
bne .3
|
|
|
|
|
ldy #S.AARPCACHE.TTL+1
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (ZPPTR1),y
|
|
|
|
|
>PUSHB (ZPPTR1)
|
|
|
|
|
>PUSHBI 12
|
|
|
|
|
>LDYA L.MSG1
|
|
|
|
|
phx
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-03-18 06:53:20 +00:00
|
|
|
|
plx
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.4 lda ZPPTR1
|
|
|
|
|
clc
|
|
|
|
|
adc #S.AARPCACHE
|
|
|
|
|
sta ZPPTR1
|
|
|
|
|
bcc .5
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
inc ZPPTR1+1
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.5 dex
|
|
|
|
|
bne .1
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.8 lda #0 tell TSKMGR that all done ok, but
|
|
|
|
|
sec we do not want to stay in memory
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .9 is it a TIMER event?
|
|
|
|
|
|
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT lda hLIBETALK
|
|
|
|
|
beq .8
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Init.Timeout ldy #TimeOut
|
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta (pData),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Wait.TimeOut sec
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .9
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
clc
|
2023-10-18 05:41:12 +00:00
|
|
|
|
|
2019-03-11 07:01:40 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2023-07-10 04:57:04 +00:00
|
|
|
|
LIBETALK .AZ "libetalk"
|
2023-06-18 07:47:28 +00:00
|
|
|
|
hLIBETALK .BS 1
|
2019-03-11 07:01:40 +00:00
|
|
|
|
SSCANF.ADDR .AZ "%D.%d"
|
|
|
|
|
SSCANF.MAC .AZ "%h:%h:%h:%h:%h:%h"
|
2023-06-18 07:47:28 +00:00
|
|
|
|
MSG.Usage .CS "Usage : AARP, display AARP cache\r\n"
|
|
|
|
|
.CS " AARP network.nod, query cache or network\r\n"
|
|
|
|
|
.CZ " AARP network.nod HH:HH:HH:HH:HH:HH, add a static AARP record in Cache\r\n"
|
|
|
|
|
MSG0 .CZ "STS TTL MAC Address net.nod"
|
|
|
|
|
MSG1 .CZ "$%h %5D %h:%h:%h:%h:%h:%h %D.%d\r\n"
|
|
|
|
|
MSG2 .CZ "%D%d is at %h:%h:%h:%h:%h:%h\r\n"
|
2019-03-11 07:01:40 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-17 20:47:31 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2019-03-11 07:01:40 +00:00
|
|
|
|
DS.START
|
|
|
|
|
DST.ADDR .BS 4
|
|
|
|
|
DST.MAC .BS 6
|
|
|
|
|
TimeOut .BS 1
|
2020-08-17 20:47:31 +00:00
|
|
|
|
DS.END .ED
|
2019-03-11 07:01:40 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-08-17 20:47:31 +00:00
|
|
|
|
SAVE usr/src/bin/aarp.s
|
2019-03-11 07:01:40 +00:00
|
|
|
|
ASM
|