A2osX/SBIN/TCPIP.S.ARP.txt

100 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
ARPListener jsr GetIPCFG
ldy #S.ARP.TPA
ldx #S.IPCFG.IP
.1 lda (ZPFrameBase1),y
cmp IPCFG,x
bne .9
iny
inx
cpx #S.IPCFG.IP+4
bne .1
ldy #S.ARP.OPERATION+1 HI byte
lda (ZPFrameBase1),y
cmp #S.ARP.OPERATION.REQ
beq ARPListener.REQ
cmp #S.ARP.OPERATION.REP
beq ARPListener.REP
.9 clc Discard any other ARP frames
rts
ARPListener.REP >LDAXI S.ARP.SHA
jsr SetFramePtr1AX
>PUSHW ZPFramePtr1
>LDAXI S.ARP.SPA
jsr SetFramePtr1AX
>PUSHW ZPFramePtr1
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.ADD
clc
ARPListener.RTS rts
ARPListener.REQ >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ARP.FRAME
bcs ARPListener.RTS
phx
>STYA ZPFrameBase2
ldy #S.ARP.OPERATION+1
lda #S.ARP.OPERATION.REP
sta (ZPFrameBase2),y
>LDAXI S.ARP.SHA
jsr SetFramePtr1AX
>LDAXI S.ETH.DSTMAC
jsr SetFramePtr2AX
ldy #6
jsr CopyFramePtr12
>LDAXI S.ARP.THA
jsr SetFramePtr2AX
ldy #10 IP(4) + MAC(6)
jsr CopyFramePtr12
>PUSHW ZPFramePtr1 still point to SHA
>LDAXI S.ARP.SPA
jsr SetFramePtr1AX
>PUSHW ZPFramePtr1
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.ADD
ldx #5
ldy #S.ARP.SHA+5
.4 lda IPCFG+S.IPCFG.MAC,x
sta (ZPFrameBase2),y
dey
dex
bpl .4
ldx #3
ldy #S.ARP.SPA+3
.5 lda IPCFG+S.IPCFG.IP,x
sta (ZPFrameBase2),y
dey
dex
bpl .5
>PUSHW ZPFrameBase2
>LIBCALL hLIBTCPIP,LIBTCPIP.SEND.ARP.FRAME
pla
>SYSCALL SYS.FreeMemA
clc
rts
*--------------------------------------
MAN
SAVE SBIN/TCPIP.S.ARP
LOAD SBIN/TCPIP.S
ASM