A2osX/LIB/LIBTCPIP.S.ICMP.txt

115 lines
2.2 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
PREFIX /A2OSX.BUILD
2017-12-22 21:24:30 +00:00
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
2018-09-21 15:28:46 +00:00
jsr ARP.AddFromFrameInPtr
2018-09-21 15:28:46 +00:00
lda hFrameIn
stz hFrameIn DO NOT DISCARD this frame,it is SOURCE frame!!!
2018-09-21 15:28:46 +00:00
sta hFrameOut
>LDYA ZPFrameInPtr
>STYA ZPFrameOutPtr
ldx #3
2018-09-21 15:28:46 +00:00
ldy #S.IP.DST+3
2016-03-16 07:19:54 +00:00
.3 lda ARP.TmpCache+S.ARPCACHE.IP,x
2018-09-21 15:28:46 +00:00
sta (ZPFrameOutPtr),y
dey
dex
bpl .3
jmp FRM.SendIP
ICMP.IN.EXIT lda hFrameIn
2018-08-08 15:13:37 +00:00
beq .8
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2018-09-18 20:43:48 +00:00
stz hFrameIn
2018-08-08 15:13:37 +00:00
.8 rts
*--------------------------------------
2018-09-17 15:42:38 +00:00
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
2018-10-01 05:48:42 +00:00
sta SKT.Template+S.SOCKET.REM.PORT+1
iny
lda (ZPFrameInPtr),y
2018-10-01 05:48:42 +00:00
sta SKT.Template+S.SOCKET.REM.PORT
2017-02-10 07:29:58 +00:00
lda hSocketTable
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
>STYA ZPPtrSKT
ldx #0
.3 lda (ZPPtrSKT)
beq .7
2018-09-28 15:24:44 +00:00
cmp #S.SOCKET.T.RAW
bne .7
2018-10-01 05:48:42 +00:00
ldy #S.SOCKET.LOC.ADDR
.4 lda (ZPPtrSKT),y
cmp SKT.Template,y
bne .7
iny
2018-10-01 05:48:42 +00:00
cpy #S.SOCKET.LOC.PORT
bne .5
iny
iny
2018-10-01 05:48:42 +00:00
.5 cpy #S.SOCKET.REM.PORT Compare SRC.ADDR,DST.ADDR,DST.PORT
bne .4
lda hFrameIn
jsr SKT.AddToQueueA
2018-09-21 15:28:46 +00:00
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
2018-09-21 15:28:46 +00:00
bra ICMP.IN.EXIT
2017-02-13 07:26:18 +00:00
*--------------------------------------
MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.ICMP
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
ASM