A2osX/LIB/LIBETALK.S.AARP.txt

398 lines
7.2 KiB
Plaintext
Raw Normal View History

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
*/--------------------------------------
* # AARP.Clear
* Clear AARP Cache
2023-10-18 05:41:12 +00:00
* ## ASM
2019-03-11 07:01:40 +00:00
* ## RETURN VALUE
*\--------------------------------------
AARP.Clear ldx #K.AARPCACHE.SIZE*S.AARPCACHE
.1 stz AARP.CACHE-1,x
dex
bne .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
clc
rts
*/--------------------------------------
* # AARP.Query
* Query AARP Cache and returns HW address
2023-10-18 05:41:12 +00:00
* ## ASM
2019-03-11 07:01:40 +00:00
* PUSHW PTR to MAC (to fill)
* PUSHW PTR to ADDR
* ## RETURN VALUE
* CC: hit: MAC filled
* CS: missed
*\--------------------------------------
AARP.Query >PULLW ZPPtrADDR ADDR
>PULLW ZPPtrMAC MAC
ldy #3
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.1 lda (ZPPtrADDR),y
sta AARP.TmpCache+S.AARPCACHE.ADDR,y
dey
bpl .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
jsr AARP.QUERY.I
bcs .9
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #5
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda AARP.TmpCache+S.AARPCACHE.MAC,y
sta (ZPPtrMAC),y
dey
bpl .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
clc
2019-10-03 06:25:27 +00:00
.9 rts
2019-03-11 07:01:40 +00:00
*/--------------------------------------
* # AARP.Add
* Add a static AARP cache record
2023-10-18 05:41:12 +00:00
* ## ASM
2019-03-11 07:01:40 +00:00
* PUSHW PTR to MAC
* PUSHW PTR to IP
*\--------------------------------------
AARP.Add >PULLW ZPPtrADDR ADDR
>PULLW ZPPtrMAC MAC
stz AARP.TmpCache+S.AARPCACHE.TTL
stz AARP.TmpCache+S.AARPCACHE.TTL+1
ldy #3
.1 lda (ZPPtrADDR),y
sta AARP.TmpCache+S.AARPCACHE.ADDR,y
dey
bpl .1
ldy #5
.2 lda (ZPPtrMAC),y
sta AARP.TmpCache+S.AARPCACHE.MAC,y
dey
bpl .2
lda #S.AARPCACHE.S.RESOLVED+S.AARPCACHE.S.STATIC
AARP.ADD.I sta AARP.TmpCache
jsr AARP.FIND.BY.ADDR
bcc .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
jsr AARP.FIND.FREE
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.1 ldy #S.AARPCACHE-1
.2 lda AARP.TmpCache,y
sta (ZPCachePtr),y
dey
bpl .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
clc
rts
*/--------------------------------------
* # AARP.GetCache
* Return a Ptr to AARP Cache Table
2023-10-18 05:41:12 +00:00
* ## ASM
2019-03-11 07:01:40 +00:00
* ## RETURN VALUE
* Y,A = PTR to AARP.CACHE
*\--------------------------------------
AARP.GetCache >LDYA L.AARP.CACHE
clc
rts
*--------------------------------------
* PRIVATE
*--------------------------------------
AARP.AddFromFrameInPtr
ldy #S.DDP2.SRC.NET
lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.ADDR+1,x
iny
lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.ADDR+2,x
iny
iny
lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.ADDR+3,x
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.ETH.SRCMAC+5
ldx #5
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.MAC,x
dey
dex
bpl .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
lda #K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL
lda /K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL+1
lda #S.AARPCACHE.S.RESOLVED
jmp AARP.ADD.I
*--------------------------------------
2023-10-18 05:41:12 +00:00
AARP.IN ldy #S.AARP.TPA+3
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NodID
bne AARP.IN.EXIT
2019-03-11 07:01:40 +00:00
2023-10-18 05:41:12 +00:00
dey
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NetID
2019-03-11 07:01:40 +00:00
bne AARP.IN.EXIT
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
dey
2023-10-18 05:41:12 +00:00
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NetID+1
bne AARP.IN.EXIT
ldy #S.AARP.OPERATION+1 HI byte
2019-03-11 07:01:40 +00:00
lda (ZPFrameInPtr),y
cmp #S.AARP.OPERATION.REQ
beq AARP.IN.REQ
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
cmp #S.AARP.OPERATION.REP
beq AARP.IN.REP
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
AARP.IN.EXIT lda hFrameIn
beq .8
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
stz hFrameIn
2019-05-05 17:15:37 +00:00
>SYSCALL2 FreeMem
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.8 clc
rts
2023-10-18 05:41:12 +00:00
*--------------------------------------
2019-03-11 07:01:40 +00:00
AARP.IN.REQ ldy #S.AARP.SPA+3
ldx #3
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.1 lda (ZPFrameInPtr),y
sta AARP.REP.TPA,x
dey
dex
bpl .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.AARP.SHA+5
ldx #5
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda (ZPFrameInPtr),y
sta AARP.REP.DSTMAC,x
sta AARP.REP.THA,x
dey
dex
bpl .2
2023-10-18 05:41:12 +00:00
lda ETKCFG+S.ETKCFG.NetID+1
sta AARP.REP.SPA+1
lda ETKCFG+S.ETKCFG.NetID
sta AARP.REP.SPA+2
lda ETKCFG+S.ETKCFG.NodID
sta AARP.REP.SPA+3
2019-03-11 07:01:40 +00:00
>LDYA L.AARP.REP
jsr AARP.Send
bra AARP.IN.EXIT
2023-10-18 05:41:12 +00:00
*--------------------------------------
2019-03-11 07:01:40 +00:00
AARP.IN.REP lda #K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL
lda /K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL+1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.AARP.SPA+3
ldx #3
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.1 lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.ADDR,x
dey
dex
bpl .1
ldy #S.AARP.SHA+5
ldx #5
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.MAC,x
dey
dex
bpl .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
lda #S.AARPCACHE.S.RESOLVED
jsr AARP.ADD.I
jmp AARP.IN.EXIT
*--------------------------------------
AARP.QUERY.I jsr AARP.FIND.BY.ADDR
bcs .3 send an AARP request
lda (ZPCachePtr) get status...
bpl .9 Pending...
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.AARPCACHE.MAC
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda (ZPCachePtr),y
sta AARP.TmpCache,y
iny
cpy #S.AARPCACHE.MAC+6
bne .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.AARPCACHE.TTL
lda #K.AARP.TTL
sta (ZPCachePtr),y
iny
lda /K.AARP.TTL
sta (ZPCachePtr),y
clc
rts
.3 ldx #3
.4 lda AARP.TmpCache+S.AARPCACHE.ADDR,x
sta AARP.REQ.TPA,x
dex
bpl .4
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
>LDYA L.AARP.REQ
jsr AARP.Send
bcs .99
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
lda #K.AARP.PENDING.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL
stz AARP.TmpCache+S.AARPCACHE.TTL+1
lda #S.AARPCACHE.S.PENDING
jsr AARP.ADD.I
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.9 lda #ERR.AARP.PENDING
sec
.99 rts
*--------------------------------------
AARP.FIND.BY.ADDR
>LDYA L.AARP.CACHE
>STYA ZPCachePtr
lda #K.AARPCACHE.SIZE
sta TmpOffset
.1 lda (ZPCachePtr)
beq .3
ldx #3
ldy #S.AARPCACHE.ADDR+3
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda AARP.TmpCache+S.AARPCACHE.ADDR,x
cmp (ZPCachePtr),y
bne .3
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
dey
dex
bpl .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
clc
rts
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.3 lda ZPCachePtr
clc
adc #S.AARPCACHE
sta ZPCachePtr
bcc .8
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
inc ZPCachePtr+1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.8 dec TmpOffset
bne .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
sec
rts
*--------------------------------------
AARP.FIND.FREE >LDYA L.AARP.CACHE
>STYA ZPCachePtr
lda #$ff
sta TmpDWord
sta TmpDWord+1
ldx #K.AARPCACHE.SIZE
.1 lda (ZPCachePtr)
beq .8
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
bpl .6
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.AARPCACHE.TTL
lda (ZPCachePtr),y
sec
sbc TmpDWord
iny
lda (ZPCachePtr),y
sbc TmpDWord+1
bcc .6
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
lda (ZPCachePtr),y
sta TmpDWord+1
dey
lda (ZPCachePtr),y
sta TmpDWord
>LDYA ZPCachePtr
>STYA ZPTmpPtr1 save lowest TTL slot ...
.6 lda ZPCachePtr
clc
adc #S.AARPCACHE
sta ZPCachePtr
bcc .7
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
inc ZPCachePtr+1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.7 dex
bne .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
>LDYA ZPTmpPtr1
>STYA ZPCachePtr
lda #0
sta (ZPCachePtr)
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.8 clc
rts
*--------------------------------------
2023-10-18 05:41:12 +00:00
AARP.EXPIRE rts
>LDYA L.AARP.CACHE
2019-03-11 07:01:40 +00:00
>STYA ZPCachePtr
ldx #K.AARPCACHE.SIZE
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.1 lda (ZPCachePtr)
beq .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
and #S.AARPCACHE.S.STATIC
bne .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
ldy #S.AARPCACHE.TTL
sec
lda (ZPCachePtr),y
sbc #1
sta (ZPCachePtr),y
iny
lda (ZPCachePtr),y
sbc #0
sta (ZPCachePtr),y
bcs .2
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
lda #0
sta (ZPCachePtr)
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.2 lda ZPCachePtr
clc
adc #S.AARPCACHE
sta ZPCachePtr
bcc .3
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
inc ZPCachePtr+1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
.3 dex
bne .1
2023-10-18 05:41:12 +00:00
2019-03-11 07:01:40 +00:00
rts
*--------------------------------------
AARP.Send >STYA IOCTL+S.IOCTL.BUFPTR
>LDYAI S.AARP
>STYA IOCTL+S.IOCTL.BYTECNT
jmp FRM.Send.IOCTL
*--------------------------------------
MAN
2021-05-19 12:44:47 +00:00
SAVE usr/src/lib/libetalk.s.aarp
LOAD usr/src/lib/libetalk.s
2019-03-11 07:01:40 +00:00
ASM