mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-27 22:29:18 +00:00
131 lines
2.5 KiB
Plaintext
131 lines
2.5 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
LOMEM $A00
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
ICMP.IN ldy #S.ICMP.TYPE
|
||
lda (ZPFrameInPtr),y
|
||
cmp #S.ICMP.TYPE.ECHOREP
|
||
beq ICMP.IN.ECHOREP
|
||
|
||
cmp #S.ICMP.TYPE.ECHOREQ
|
||
bne ICMP.IN.EXIT
|
||
*--------------------------------------
|
||
ICMP.IN.ECHOREQ ldy #S.IP.DST+3
|
||
ldx #3
|
||
|
||
.1 lda (ZPFrameInPtr),y
|
||
cmp IPCFG+S.IPCFG.IP,x
|
||
bne ICMP.IN.EXIT
|
||
dey
|
||
dex
|
||
bne .1
|
||
|
||
ldy #S.ICMP.TYPE
|
||
lda #S.ICMP.TYPE.ECHOREP
|
||
sta (ZPFrameInPtr),y
|
||
|
||
ldy #S.IP.SRC+3
|
||
ldx #3
|
||
|
||
.2 lda (ZPFrameInPtr),y
|
||
sta ARP.TmpCache+S.ARPCACHE.IP,x
|
||
dey
|
||
dex
|
||
bpl .2
|
||
|
||
ldy #S.IP.DST+3
|
||
ldx #3
|
||
|
||
.3 lda ARP.TmpCache+S.ARPCACHE.IP,x
|
||
sta (ZPFrameInPtr),y
|
||
dey
|
||
dex
|
||
bpl .3
|
||
|
||
ldy #S.ETH.SRCMAC+5
|
||
ldx #5
|
||
|
||
.4 lda (ZPFrameInPtr),y
|
||
sta ARP.TmpCache+S.ARPCACHE.MAC,x
|
||
dey
|
||
dex
|
||
bpl .4
|
||
|
||
lda #K.ARP.TTL
|
||
sta ARP.TmpCache+S.ARPCACHE.TTL
|
||
lda /K.ARP.TTL
|
||
sta ARP.TmpCache+S.ARPCACHE.TTL+1
|
||
|
||
lda #S.ARPCACHE.STATUS.RESOLVED
|
||
jsr ARP.ADD.I
|
||
|
||
lda hFrameIn
|
||
sta hFrameOut DO NOT DISCARD this frame,it is SOURCE frame!!!
|
||
>LDYA ZPFrameInPtr
|
||
>STYA ZPFrameOutPtr
|
||
jmp FRM.SendICMP
|
||
|
||
ICMP.IN.EXIT lda hFrameIn
|
||
>SYSCALL FreeMemA
|
||
rts
|
||
*--------------------------------------
|
||
ICMP.IN.ECHOREP jsr IP.FillTmpSocketSrcDst
|
||
|
||
lda #S.IP.PROTOCOL.ICMP
|
||
sta TmpSocket+S.SOCKET.RAW.PROTO
|
||
|
||
ldy #S.ICMP.IDENTIFIER
|
||
lda (ZPFrameInPtr),y
|
||
sta TmpSocket+S.SOCKET.DST.PORT+1
|
||
iny
|
||
lda (ZPFrameInPtr),y
|
||
sta TmpSocket+S.SOCKET.DST.PORT
|
||
|
||
>LDYA L.SKT.TABLE
|
||
>STYA ZPPtrSKT
|
||
|
||
ldx #0
|
||
|
||
.3 lda (ZPPtrSKT)
|
||
beq .7
|
||
cmp #S.SOCKET.SOCK.RAW
|
||
bne .7
|
||
|
||
ldy #S.SOCKET.SRC.ADDR
|
||
|
||
.4 lda (ZPPtrSKT),y
|
||
cmp TmpSocket,y
|
||
bne .7
|
||
iny
|
||
cpy #S.SOCKET.DST.PORT Compare SRC.ADDR,SRC.PORT,DST.ADDR
|
||
bne .4
|
||
|
||
lda hFrameIn
|
||
jsr SKT.AddToQueueA
|
||
bcs .9 Q full, discard...
|
||
|
||
rts DO NOT Discard this queued frame
|
||
|
||
.7 lda ZPPtrSKT
|
||
clc
|
||
adc #S.SOCKET
|
||
sta ZPPtrSKT
|
||
bcc .8
|
||
inc ZPPtrSKT+1
|
||
|
||
.8 inx
|
||
cpx #K.SKTTABLE.SIZE
|
||
bne .3
|
||
|
||
.9 lda hFrameIn
|
||
>SYSCALL FreeMemA
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE LIB/LIBTCPIP.S.ICMP
|
||
LOAD LIB/LIBTCPIP.S
|
||
ASM
|