A2osX/LIB/LIBTCPIP.S.ICMP.txt
2017-01-29 22:47:19 +01:00

71 lines
1.2 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
*--------------------------------------
ICMP.IN ldy #S.ICMP.TYPE
lda (ZPFrameBase),y
cmp #S.ICMP.TYPE.ECHOREQ
bne .9
ldy #S.IP.DST
ldx #S.IPCFG.IP
.1 lda (ZPFrameBase),y
cmp IPCFG,x
bne .9
iny
inx
cpx #S.IPCFG.IP+4
bne .1
ldy #S.ICMP.TYPE
lda #S.ICMP.TYPE.ECHOREP
sta (ZPFrameBase),y
ldy #S.IP.SRC+3
ldx #3
.2 lda (ZPFrameBase),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 (ZPFrameBase),y
dey
dex
bpl .3
ldy #S.ETH.SRCMAC+5
ldx #5
.4 lda (ZPFrameBase),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
stz hFrameOut DO NOT QUEUE/DISCARD this frame,it is SOURCE frame!!!
jmp SEND.ICMP.FRAME.I
.9 sec
rts
*--------------------------------------
MAN
SAVE LIB/LIBTCPIP.S.ICMP
LOAD LIB/LIBTCPIP.S
ASM