mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-16 08:04:35 +00:00
334 lines
6.7 KiB
Plaintext
334 lines
6.7 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*/--------------------------------------
|
||
* # AARP.Clear
|
||
* Clear AARP Cache
|
||
* **In:**
|
||
* ## RETURN VALUE
|
||
*\--------------------------------------
|
||
AARP.Clear ldx #K.AARPCACHE.SIZE*S.AARPCACHE
|
||
|
||
.1 stz AARP.CACHE-1,x
|
||
dex
|
||
bne .1
|
||
clc
|
||
rts
|
||
*/--------------------------------------
|
||
* # AARP.Query
|
||
* Query AARP Cache and returns HW address
|
||
* **In:**
|
||
* 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
|
||
.1 lda (ZPPtrADDR),y
|
||
sta AARP.TmpCache+S.AARPCACHE.ADDR,y
|
||
dey
|
||
bpl .1
|
||
jsr AARP.QUERY.I
|
||
bcs .9
|
||
ldy #5
|
||
.2 lda AARP.TmpCache+S.AARPCACHE.MAC,y
|
||
sta (ZPPtrMAC),y
|
||
dey
|
||
bpl .2
|
||
clc
|
||
.9 rts
|
||
*/--------------------------------------
|
||
* # AARP.Add
|
||
* Add a static AARP cache record
|
||
* **In:**
|
||
* 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
|
||
jsr AARP.FIND.FREE
|
||
.1 ldy #S.AARPCACHE-1
|
||
|
||
.2 lda AARP.TmpCache,y
|
||
sta (ZPCachePtr),y
|
||
dey
|
||
bpl .2
|
||
clc
|
||
rts
|
||
*/--------------------------------------
|
||
* # AARP.GetCache
|
||
* Return a Ptr to AARP Cache Table
|
||
* **In:**
|
||
* ## 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
|
||
ldy #S.ETH.SRCMAC+5
|
||
ldx #5
|
||
.2 lda (ZPFrameInPtr),y
|
||
sta AARP.TmpCache+S.AARPCACHE.MAC,x
|
||
dey
|
||
dex
|
||
bpl .2
|
||
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
|
||
*--------------------------------------
|
||
AARP.IN bra .10
|
||
|
||
ldy #S.AARP.TPA+3
|
||
ldx #3
|
||
|
||
.1 lda (ZPFrameInPtr),y
|
||
cmp ETKCFG+S.ETKCFG.ADDR,x
|
||
bne AARP.IN.EXIT
|
||
dey
|
||
dex
|
||
bpl .1
|
||
.10 ldy #S.AARP.OPERATION+1 HI byte
|
||
|
||
lda (ZPFrameInPtr),y
|
||
cmp #S.AARP.OPERATION.REQ
|
||
beq AARP.IN.REQ
|
||
cmp #S.AARP.OPERATION.REP
|
||
beq AARP.IN.REP
|
||
AARP.IN.EXIT lda hFrameIn
|
||
beq .8
|
||
stz hFrameIn
|
||
>SYSCALL2 FreeMem
|
||
.8 clc
|
||
rts
|
||
AARP.IN.REQ ldy #S.AARP.SPA+3
|
||
ldx #3
|
||
.1 lda (ZPFrameInPtr),y
|
||
sta AARP.REP.TPA,x
|
||
dey
|
||
dex
|
||
bpl .1
|
||
ldy #S.AARP.SHA+5
|
||
ldx #5
|
||
.2 lda (ZPFrameInPtr),y
|
||
sta AARP.REP.DSTMAC,x
|
||
sta AARP.REP.THA,x
|
||
dey
|
||
dex
|
||
bpl .2
|
||
>LDYA L.AARP.REP
|
||
jsr AARP.Send
|
||
bra AARP.IN.EXIT
|
||
|
||
AARP.IN.REP lda #K.AARP.TTL
|
||
sta AARP.TmpCache+S.AARPCACHE.TTL
|
||
lda /K.AARP.TTL
|
||
sta AARP.TmpCache+S.AARPCACHE.TTL+1
|
||
ldy #S.AARP.SPA+3
|
||
ldx #3
|
||
.1 lda (ZPFrameInPtr),y
|
||
sta AARP.TmpCache+S.AARPCACHE.ADDR,x
|
||
dey
|
||
dex
|
||
bpl .1
|
||
|
||
ldy #S.AARP.SHA+5
|
||
ldx #5
|
||
.2 lda (ZPFrameInPtr),y
|
||
sta AARP.TmpCache+S.AARPCACHE.MAC,x
|
||
dey
|
||
dex
|
||
bpl .2
|
||
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...
|
||
ldy #S.AARPCACHE.MAC
|
||
.2 lda (ZPCachePtr),y
|
||
sta AARP.TmpCache,y
|
||
iny
|
||
cpy #S.AARPCACHE.MAC+6
|
||
bne .2
|
||
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
|
||
>LDYA L.AARP.REQ
|
||
jsr AARP.Send
|
||
bcs .99
|
||
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
|
||
.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
|
||
.2 lda AARP.TmpCache+S.AARPCACHE.ADDR,x
|
||
cmp (ZPCachePtr),y
|
||
bne .3
|
||
dey
|
||
dex
|
||
bpl .2
|
||
clc
|
||
rts
|
||
.3 lda ZPCachePtr
|
||
clc
|
||
adc #S.AARPCACHE
|
||
sta ZPCachePtr
|
||
bcc .8
|
||
inc ZPCachePtr+1
|
||
.8 dec TmpOffset
|
||
bne .1
|
||
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
|
||
bpl .6
|
||
ldy #S.AARPCACHE.TTL
|
||
lda (ZPCachePtr),y
|
||
sec
|
||
sbc TmpDWord
|
||
iny
|
||
lda (ZPCachePtr),y
|
||
sbc TmpDWord+1
|
||
bcc .6
|
||
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
|
||
inc ZPCachePtr+1
|
||
.7 dex
|
||
bne .1
|
||
>LDYA ZPTmpPtr1
|
||
>STYA ZPCachePtr
|
||
lda #0
|
||
sta (ZPCachePtr)
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
AARP.EXPIRE >LDYA L.AARP.CACHE
|
||
>STYA ZPCachePtr
|
||
ldx #K.AARPCACHE.SIZE
|
||
.1 lda (ZPCachePtr)
|
||
beq .2
|
||
and #S.AARPCACHE.S.STATIC
|
||
bne .2
|
||
ldy #S.AARPCACHE.TTL
|
||
sec
|
||
lda (ZPCachePtr),y
|
||
sbc #1
|
||
sta (ZPCachePtr),y
|
||
iny
|
||
lda (ZPCachePtr),y
|
||
sbc #0
|
||
sta (ZPCachePtr),y
|
||
bcs .2
|
||
lda #0
|
||
sta (ZPCachePtr)
|
||
.2 lda ZPCachePtr
|
||
clc
|
||
adc #S.AARPCACHE
|
||
sta ZPCachePtr
|
||
bcc .3
|
||
inc ZPCachePtr+1
|
||
.3 dex
|
||
bne .1
|
||
rts
|
||
*--------------------------------------
|
||
AARP.Send >STYA IOCTL+S.IOCTL.BUFPTR
|
||
>LDYAI S.AARP
|
||
>STYA IOCTL+S.IOCTL.BYTECNT
|
||
jmp FRM.Send.IOCTL
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/LIB/LIBETALK.S.AARP
|
||
LOAD USR/SRC/LIB/LIBETALK.S
|
||
ASM
|