mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-29 01:33:40 +00:00
115 lines
2.2 KiB
Plaintext
115 lines
2.2 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
.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
|
||
|
||
jsr ARP.AddFromFrameInPtr
|
||
|
||
lda hFrameIn
|
||
stz hFrameIn DO NOT DISCARD this frame,it is SOURCE frame!!!
|
||
|
||
sta hFrameOut
|
||
>LDYA ZPFrameInPtr
|
||
>STYA ZPFrameOutPtr
|
||
|
||
ldx #3
|
||
ldy #S.IP.DST+3
|
||
|
||
.3 lda ARP.TmpCache+S.ARPCACHE.IP,x
|
||
sta (ZPFrameOutPtr),y
|
||
dey
|
||
dex
|
||
bpl .3
|
||
|
||
jmp FRM.SendIP
|
||
|
||
ICMP.IN.EXIT lda hFrameIn
|
||
beq .8
|
||
>SYSCALL FreeMem
|
||
stz hFrameIn
|
||
.8 rts
|
||
*--------------------------------------
|
||
ICMP.IN.ECHOREP jsr IP.FillSKT.TemplateSrcDstIP
|
||
|
||
lda #S.IP.PROTOCOL.ICMP
|
||
sta SKT.Template+S.SOCKET.RAW.PROTO
|
||
|
||
ldy #S.ICMP.IDENTIFIER
|
||
lda (ZPFrameInPtr),y
|
||
sta SKT.Template+S.SOCKET.REM.PORT+1
|
||
iny
|
||
lda (ZPFrameInPtr),y
|
||
sta SKT.Template+S.SOCKET.REM.PORT
|
||
|
||
lda hSocketTable
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPPtrSKT
|
||
|
||
ldx #0
|
||
|
||
.3 lda (ZPPtrSKT)
|
||
beq .7
|
||
cmp #S.SOCKET.T.RAW
|
||
bne .7
|
||
|
||
ldy #S.SOCKET.LOC.ADDR
|
||
|
||
.4 lda (ZPPtrSKT),y
|
||
cmp SKT.Template,y
|
||
bne .7
|
||
iny
|
||
cpy #S.SOCKET.LOC.PORT
|
||
bne .5
|
||
|
||
iny
|
||
iny
|
||
|
||
.5 cpy #S.SOCKET.REM.PORT Compare SRC.ADDR,DST.ADDR,DST.PORT
|
||
bne .4
|
||
|
||
lda hFrameIn
|
||
jsr SKT.AddToQueueA
|
||
bcs ICMP.IN.EXIT 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
|
||
|
||
bra ICMP.IN.EXIT
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.ICMP
|
||
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
||
ASM
|