2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2016-01-16 22:04:22 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ICMP.IN ldy #S.ICMP.TYPE
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-01-30 16:30:39 +00:00
|
|
|
|
cmp #S.ICMP.TYPE.ECHOREP
|
|
|
|
|
beq ICMP.IN.ECHOREP
|
|
|
|
|
|
2016-01-16 22:04:22 +00:00
|
|
|
|
cmp #S.ICMP.TYPE.ECHOREQ
|
2017-01-30 16:30:39 +00:00
|
|
|
|
bne ICMP.IN.EXIT
|
2017-01-31 16:40:37 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-30 16:30:39 +00:00
|
|
|
|
ICMP.IN.ECHOREQ ldy #S.IP.DST+3
|
|
|
|
|
ldx #3
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.1 lda (ZPFrameInPtr),y
|
2017-01-30 16:30:39 +00:00
|
|
|
|
cmp IPCFG+S.IPCFG.IP,x
|
|
|
|
|
bne ICMP.IN.EXIT
|
|
|
|
|
dey
|
|
|
|
|
dex
|
2016-03-13 22:09:00 +00:00
|
|
|
|
bne .1
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.ICMP.TYPE
|
|
|
|
|
lda #S.ICMP.TYPE.ECHOREP
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IP.SRC+3
|
|
|
|
|
ldx #3
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.2 lda (ZPFrameInPtr),y
|
2016-03-16 07:19:54 +00:00
|
|
|
|
sta ARP.TmpCache+S.ARPCACHE.IP,x
|
2016-03-13 22:09:00 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2016-03-13 22:09:00 +00:00
|
|
|
|
ldy #S.IP.DST+3
|
|
|
|
|
ldx #3
|
2016-01-16 22:04:22 +00:00
|
|
|
|
|
2016-03-16 07:19:54 +00:00
|
|
|
|
.3 lda ARP.TmpCache+S.ARPCACHE.IP,x
|
2017-01-31 16:40:37 +00:00
|
|
|
|
sta (ZPFrameInPtr),y
|
2016-03-13 22:09:00 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
ldy #S.ETH.SRCMAC+5
|
|
|
|
|
ldx #5
|
|
|
|
|
|
2017-01-31 16:40:37 +00:00
|
|
|
|
.4 lda (ZPFrameInPtr),y
|
2016-03-16 07:19:54 +00:00
|
|
|
|
sta ARP.TmpCache+S.ARPCACHE.MAC,x
|
2016-03-13 22:09:00 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .4
|
|
|
|
|
|
2016-03-16 16:37:02 +00:00
|
|
|
|
lda #K.ARP.TTL
|
|
|
|
|
sta ARP.TmpCache+S.ARPCACHE.TTL
|
|
|
|
|
lda /K.ARP.TTL
|
|
|
|
|
sta ARP.TmpCache+S.ARPCACHE.TTL+1
|
|
|
|
|
|
2016-03-16 07:19:54 +00:00
|
|
|
|
lda #S.ARPCACHE.STATUS.RESOLVED
|
|
|
|
|
jsr ARP.ADD.I
|
2016-03-13 22:09:00 +00:00
|
|
|
|
|
2017-01-30 16:30:39 +00:00
|
|
|
|
lda hFrameIn
|
|
|
|
|
sta hFrameOut DO NOT DISCARD this frame,it is SOURCE frame!!!
|
2017-01-31 16:40:37 +00:00
|
|
|
|
>LDYA ZPFrameInPtr
|
|
|
|
|
>STYA ZPFrameOutPtr
|
2017-02-15 16:14:41 +00:00
|
|
|
|
jmp FRM.SendIP
|
2017-01-30 16:30:39 +00:00
|
|
|
|
|
|
|
|
|
ICMP.IN.EXIT lda hFrameIn
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2016-01-16 22:04:22 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-16 16:26:11 +00:00
|
|
|
|
ICMP.IN.ECHOREP jsr IP.FillSKT.TemplateSrcDst
|
2017-01-30 16:30:39 +00:00
|
|
|
|
|
|
|
|
|
lda #S.IP.PROTOCOL.ICMP
|
2017-02-16 16:26:11 +00:00
|
|
|
|
sta SKT.Template+S.SOCKET.RAW.PROTO
|
2017-01-30 16:30:39 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.ICMP.IDENTIFIER
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-02-16 16:26:11 +00:00
|
|
|
|
sta SKT.Template+S.SOCKET.DST.PORT+1
|
2017-01-30 16:30:39 +00:00
|
|
|
|
iny
|
2017-01-31 16:40:37 +00:00
|
|
|
|
lda (ZPFrameInPtr),y
|
2017-02-16 16:26:11 +00:00
|
|
|
|
sta SKT.Template+S.SOCKET.DST.PORT
|
2017-01-30 16:30:39 +00:00
|
|
|
|
|
2017-02-10 07:29:58 +00:00
|
|
|
|
lda hSocketTable
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2017-01-30 16:30:39 +00:00
|
|
|
|
>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
|
2017-02-16 16:26:11 +00:00
|
|
|
|
cmp SKT.Template,y
|
2017-01-30 16:30:39 +00:00
|
|
|
|
bne .7
|
|
|
|
|
iny
|
2017-02-01 21:21:46 +00:00
|
|
|
|
cpy #S.SOCKET.SRC.PORT
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
.5 cpy #S.SOCKET.DST.PORT Compare SRC.ADDR,DST.ADDR,DST.PORT
|
2017-01-30 16:30:39 +00:00
|
|
|
|
bne .4
|
2017-02-01 21:21:46 +00:00
|
|
|
|
|
2017-01-30 16:30:39 +00:00
|
|
|
|
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
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-01-30 16:30:39 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-02-13 07:26:18 +00:00
|
|
|
|
ICMP.ComputeChecksum
|
|
|
|
|
>PUSHW ZPFrameOutLen
|
|
|
|
|
>PUSHWI S.ICMP.TYPE-2
|
|
|
|
|
|
|
|
|
|
ldy #S.ICMP.CHECKSUM
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
|
|
|
|
|
jsr IP.ComputeChecksum
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
ldy #S.ICMP.CHECKSUM
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
iny
|
|
|
|
|
pla
|
|
|
|
|
sta (ZPFrameOutPtr),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-01-16 22:04:22 +00:00
|
|
|
|
MAN
|
2017-03-30 06:31:12 +00:00
|
|
|
|
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.ICMP
|
|
|
|
|
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
|
2016-01-16 22:04:22 +00:00
|
|
|
|
ASM
|