A2osX/SBIN/TCPIP.S.ICMP.txt

59 lines
1.0 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
*--------------------------------------
ICMPListener ldy #S.ICMP.TYPE
lda (ZPFrameBase1),y
cmp #S.ICMP.TYPE.ECHOREQ
bne .9
jsr GetIPCFG
ldy #S.IP.DST
ldx #S.IPCFG.IP
.10 lda (ZPFrameBase1),y
cmp IPCFG,x
bne .9
iny
inx
cpx #S.IPCFG.IP+4
bne .10
>LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME
bcs .9
phx
>STYA ZPFrameBase2
ldy #S.ICMP.TYPE
lda #S.ICMP.TYPE.ECHOREP
sta (ZPFrameBase2),y
jsr MakeIPReply
ldy #S.ICMP.IDENTIFIER
.1 lda (ZPFrameBase1),y
sta (ZPFrameBase2),y
iny
cpy #ZPFrameLen1
bne .1
>PUSHW ZPFrameLen1
>PUSHW ZPFrameBase2
>LIBCALL hLIBTCPIP,LIBTCPIP.SEND.ICMP.FRAME
pla
>SYSCALL SYS.FreeMemA
clc
rts
.9 sec
rts
*--------------------------------------
*--------------------------------------
MAN
SAVE SBIN/TCPIP.S.ICMP
LOAD SBIN/TCPIP.S
ASM