mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-26 13:49:18 +00:00
102 lines
1.8 KiB
Plaintext
102 lines
1.8 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
IP.IN >PULLW ZPFrameBase1
|
||
>PULLW ZPFrameLen1
|
||
ldy #S.IP.PROTOCOL
|
||
lda (ZPFrameBase1),y
|
||
cmp #S.IP.PROTOCOL.ICMP
|
||
bne .2
|
||
jmp ICMP.IN
|
||
|
||
.2 cmp #S.IP.PROTOCOL.UDP
|
||
bne .3
|
||
|
||
ldy #S.UDP.DSTPORT
|
||
lda /UDP.PORT.DNS
|
||
cmp (ZPFrameBase1),y
|
||
bne .21
|
||
iny
|
||
lda #UDP.PORT.DNS
|
||
cmp (ZPFrameBase1),y
|
||
bne .21
|
||
jmp DNS.IN
|
||
.21 jmp UDP.IN
|
||
|
||
.3 cmp #S.IP.PROTOCOL.TCP
|
||
bne .9
|
||
jmp TCP.IN
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
* In:
|
||
* PULLW = Start Offset
|
||
* PULLW = End Offset
|
||
* Out:
|
||
* Y,A = CheckSum
|
||
*--------------------------------------
|
||
IP.ComputeChecksum
|
||
>PULLA
|
||
clc
|
||
adc ZPFrameBase1
|
||
sta ZPTmpPtr1
|
||
>PULLA
|
||
adc ZPFrameBase1+1
|
||
sta ZPTmpPtr1+1
|
||
|
||
>PULLA
|
||
clc
|
||
adc ZPFrameBase1
|
||
sta TmpOffset
|
||
>PULLA
|
||
adc ZPFrameBase1+1
|
||
sta TmpOffset+1
|
||
|
||
stz IP.CHECKSUM RESET.IP.CHECKSUM
|
||
stz IP.CHECKSUM+1
|
||
stz IP.CHECKSUM+2
|
||
stz IP.CHECKSUM+3
|
||
|
||
ldy #1
|
||
.1 lda (ZPTmpPtr1),y
|
||
clc
|
||
adc IP.CHECKSUM
|
||
sta IP.CHECKSUM
|
||
lda (ZPTmpPtr1)
|
||
adc IP.CHECKSUM+1
|
||
sta IP.CHECKSUM+1
|
||
bcc .3
|
||
inc IP.CHECKSUM+2
|
||
bne .3
|
||
inc IP.CHECKSUM+3
|
||
.3 lda ZPTmpPtr1
|
||
clc
|
||
adc #2
|
||
sta ZPTmpPtr1
|
||
bcc .4
|
||
inc ZPTmpPtr1+1
|
||
.4 cmp TmpOffset
|
||
bne .1
|
||
lda ZPTmpPtr1+1
|
||
cmp TmpOffset+1
|
||
bne .1
|
||
lda IP.CHECKSUM
|
||
clc
|
||
adc IP.CHECKSUM+2
|
||
eor #$FF
|
||
tay
|
||
lda IP.CHECKSUM+1
|
||
adc IP.CHECKSUM+3
|
||
eor #$FF
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE LIB/LIBTCPIP.S.IP
|
||
LOAD LIB/LIBTCPIP.S
|
||
ASM
|