Kernel version 0.9 : TCPIP stack reorg

This commit is contained in:
Rémy GIBERT 2017-01-29 22:47:19 +01:00
parent d736762046
commit 1867933ae8
21 changed files with 365 additions and 438 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -47,40 +47,75 @@ CS.INIT >LDYA L.LIBTCPIP
>SYSCALL LoadLibYA
sta hLIBTCPIP
>SYSCALL GetArgC
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
rts
*--------------------------------------
CS.RUN >SYSCALL GetArgC
cmp #1
beq CS.INIT.DUMP
bne .1
jmp CS.RUN.DUMP
>PUSHW L.DST.IP
.1 >PUSHW L.DST.IP
>PUSHW L.SSCANF.IP
lda #1
>SYSCALL GetArgA
>PUSHYA
>SYSCALL SSCANF
bcs .9
stz bCTRLC
lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
rts CC,Give back control to CS.RUN
bcc CS.RUN.QUERY
.9 lda #SYSMGR.ERRSYN
lda #SYSMGR.ERRSYN
sec
rts
*--------------------------------------
CS.INIT.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
CS.RUN.QUERY jsr Init.Timeout
.1 >PUSHW L.DST.MAC
>PUSHW L.DST.IP
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.QUERY
bcc .2 success, print & exit
jsr Wait.TimeOut
bcs .9
>SYSCALL Sleep
>SYSCALL GetC
bcs .1
cmp #3
beq .8
bra .1
.2 ldx #5
.3 >PUSHB DST.MAC,x
dex
bpl .3
ldx #3
.4 >PUSHB DST.IP,x
dex
bpl .4
>LDYA L.MSG2
>SYSCALL CPrintFYA
.8 lda #0
.9 sec
rts
*--------------------------------------
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
>STYA ZPPTR1
>LDYA L.MSG0
>SYSCALL CPrintFYA
ldx #K.ARPCACHE.SIZE
.1 lda (ZPPTR1)
beq .4
* beq .4
ldy #S.ARPCACHE.IP+4
.2 dey
@ -119,42 +154,8 @@ CS.INIT.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.ARP.GETCACHE
sec we do not want to stay in memory
rts
*--------------------------------------
CS.RUN jsr Init.Timeout
.1 lda bCTRLC
bne .9
>PUSHW L.DST.MAC
>PUSHW L.DST.IP
>LIBCALL hLIBTCPIP,LIBTCPIP.ARP.QUERY
bcc .2 success, print & exit
jsr Wait.TimeOut
bcs .9
>SYSCALL Sleep
bra .1
.2 ldx #5
.3 >PUSHB DST.MAC,x
dex
bpl .3
ldx #3
.4 >PUSHB DST.IP,x
dex
bpl .4
>LDYA L.MSG2
>SYSCALL CPrintFYA
lda #0
.9 sec
rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .1 is it a TIMER event?
bpl .9 is it a TIMER event?
ldy #TimeOut
lda (pData),y
@ -163,30 +164,6 @@ CS.DOEVENT lda (pEvent)
sta (pData),y
.9 sec do not discard TIMER event
rts
.1 lda (pEvent)
and #S.EVT.F.KEY is it a KEY event?
beq .9
ldy #S.EVT.hDEV is Event from active IN device?
lda (pEvent),y
ldy #S.PS.hStdIn
cmp (pPs),y
bne .9
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
lda (pEvent),y
bne .9
ldy #S.EVT.DATALO
lda (pEvent),y
cmp #$03 Ctrl-C
bne .9
lda #$FF
sta bCTRLC
clc
rts
*--------------------------------------
CS.QUIT lda hLIBTCPIP
>SYSCALL UnloadLibA
@ -202,9 +179,6 @@ Wait.TimeOut sec
ldy #TimeOut
lda (pData),y
beq .9
ldy #bCTRLC
lda (pData),y
bmi .9
clc
.9 rts
*--------------------------------------
@ -220,7 +194,6 @@ hLIBTCPIP .BS 1
DST.IP .BS 4
DST.MAC .BS 6
TimeOut .BS 1
bCTRLC .BS 1
DS.END
*--------------------------------------
MAN

View File

@ -44,11 +44,17 @@ CS.INIT >LDYA L.LIBTCPIP
>SYSCALL LoadLibYA
sta hLIBTCPIP
>SYSCALL GetArgC
cmp #1
beq CS.INIT.DUMP
.8 lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
rts
*--------------------------------------
CS.INIT.ADD cmp #3
CS.RUN >SYSCALL GetArgC
cmp #1
beq CS.RUN.DUMP
CS.RUN.ADD cmp #3
bne .9
>PUSHW L.IP
@ -73,8 +79,8 @@ CS.INIT.ADD cmp #3
.9 lda #SYSMGR.ERRSYN
sec
.99 rts
*--------------------------------------
CS.INIT.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GETCACHE
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GETCACHE
>STYA ZPPTR1
>LDYA L.MSG0
>SYSCALL CPrintFYA
@ -128,8 +134,7 @@ CS.INIT.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GETCACHE
sec we do not want to stay in memory
rts
*--------------------------------------
CS.RUN
CS.EVENT clc
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT lda hLIBTCPIP

View File

@ -14,8 +14,8 @@ AUTO 6
*--------------------------------------
TIMEOUT.MAX .EQ 20 2 sec.
*--------------------------------------
ZPFrameBase1 .EQ ZPBIN
ZPFrameLen1 .EQ ZPBIN+2
ZPFrameBase .EQ ZPBIN
ZPFrameLen .EQ ZPBIN+2
ZPFramePtr1 .EQ ZPBIN+4
ZPIPCfgPtr .EQ ZPBIN+6
*--------------------------------------
@ -83,7 +83,8 @@ CS.INIT >SYSCALL GetArgC
sta (pPs)
clc
.9 rts
.9 sec
rts
*--------------------------------------
CS.RUN jsr Init.Timeout
@ -121,16 +122,16 @@ CS.RUN jsr Init.Timeout
>SYSCALL CPrintFYA
CS.RUN.ECHO >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME
>STYA ZPFrameBase1
>STYA ZPFrameBase
txa
ldy #hFrame
sta (pData),y
lda #S.ICMP+32-2
sta (ZPFrameBase1)
sta (ZPFrameBase)
lda /S.ICMP+32-2
ldy #1
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldx #3
ldy #0
@ -143,14 +144,14 @@ CS.RUN.ECHO >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME
ldx #3
ldy #S.IP.DST+3
.1 pla
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
dex
bpl .1
ldy #S.ICMP.TYPE
lda #S.ICMP.TYPE.ECHOREQ
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #Identifier
lda (pData),y
@ -159,10 +160,10 @@ CS.RUN.ECHO >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME
lda (pData),y
ldy #S.ICMP.IDENTIFIER+1
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
txa
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #Sequence+1
lda (pData),y
@ -179,17 +180,17 @@ CS.RUN.ECHO >LIBCALL hLIBTCPIP,LIBTCPIP.NEW.ICMP.FRAME
pla
.2 ldy #S.ICMP.SEQUENCE
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
txa
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldx #31
ldy #S.ICMP+31
.21 txa
and #$0f
ora #$60
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
dex
bpl .21
@ -263,63 +264,31 @@ CS.DOEVENT lda (pEvent)
dec
sta (pData),y
sec do not discard TIMER event
.9 sec do not discard TIMER event
rts
.1 lda (pEvent)
and #S.EVT.F.KEY is it a KEY event?
beq .2
ldy #S.EVT.hDEV is Event from active IN device?
lda (pEvent),y
ldy #S.PS.hStdIn
cmp (pPs),y
bne .9
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
lda (pEvent),y
bne .9
ldy #S.EVT.DATALO
lda (pEvent),y
cmp #$03 Ctrl-C
bne .8
lda #$FF
ldy #bCTRLC
sta (pData),y
bra .8
.2 lda (pEvent)
and #S.EVT.F.NET
beq .9
ldy #S.EVT.hDEV
lda (pEvent),y
cmp hDev
bne .9
*--------------------------------------
ldy #S.EVT.DATALO Get Frame hMem
lda (pEvent),y
>SYSCALL GetMemPtrA
>STYA ZPFrameBase1
>STYA ZPFrameBase
ldy #S.IP.PROTOCOL
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.IP.PROTOCOL.ICMP
bne .9
ldy #S.ICMP.TYPE
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.ICMP.TYPE.ECHOREP
bne .9
ldy #S.ICMP.IDENTIFIER
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
tax
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
ldy #Identifier+1
cmp (pData),y
bne .9
@ -357,21 +326,21 @@ CS.EVENT.REPLY lda #TIMEOUT.MAX
.3 >PUSHW TimeOut.ms
ldy #S.IP.TTL
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
ldy #S.ICMP.SEQUENCE+1
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
dey
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
ldy #S.IP.SRC+3
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
dey
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
dey
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
dey
>PUSHB (ZPFrameBase1),y
>PUSHB (ZPFrameBase),y
>LDYA L.MSG3
>SYSCALL CPrintFYA
@ -396,9 +365,7 @@ Wait.TimeOut sec
ldy #TimeOut
lda (pData),y
beq .9
ldy #bCTRLC
lda (pData),y
bmi .9
clc
.9 rts
*--------------------------------------
@ -420,7 +387,6 @@ hFrame .BS 1
TimeOut .BS 1
Identifier .BS 2
Sequence .BS 2
bCTRLC .BS 1
bReply .BS 1
DS.END
.ED

View File

@ -156,7 +156,7 @@ CS.RUN jsr Init.Timeout
rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .1 is it a TIMER event?
bpl .9 is it a TIMER event?
ldy #TimeOut
lda (pData),y
@ -165,32 +165,6 @@ CS.DOEVENT lda (pEvent)
sta (pData),y
.9 sec do not discard TIMER event
rts
.1 bit #S.EVT.F.KEY is it a KEY event?
beq .8
ldy #S.EVT.hDEV is Event from active IN device?
lda (pEvent),y
ldy #S.PS.hStdIn
cmp (pPs),y
bne .9
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
lda (pEvent),y
bne .9
ldy #S.EVT.DATALO
lda (pEvent),y
cmp #$03 Ctrl-C
bne .8
lda #$FF
ldy #bCTRLC
sta (pData),y
bra .8
.8 clc
rts
*--------------------------------------
CS.QUIT ldy #hSocket
lda (pData),y
@ -212,9 +186,6 @@ Wait.TimeOut sec
ldy #TimeOut
lda (pData),y
beq .9
ldy #bCTRLC
lda (pData),y
bmi .9
clc
.9 rts
*--------------------------------------
@ -297,7 +268,6 @@ DS.START
hSocket .BS 1
hFrame .BS 1
TimeOut .BS 1
bCTRLC .BS 1
DS.END
.ED
*--------------------------------------

View File

@ -11,7 +11,6 @@ AUTO 6
.INB /A2OSX.DEV/INC/MACROS.I
.INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/LIBTCPIP.I
.INB /A2OSX.DEV/INC/PRODOS.I
*--------------------------------------
ZPTmpPTR .EQ ZPDRV
*--------------------------------------
@ -71,7 +70,7 @@ Dev.Detect >STYA ARGS
>LDYA L.MSG.DETECT.KO
>SYSCALL CPrintFYA
lda #MLI.ERR.NODEV
lda #$28 MLI.ERR.NODEV
sec
rts
@ -154,7 +153,7 @@ DRV.CS.START cld
L.DEVSTAT .DA DEVSTAT
.DA 0 end or relocation
*--------------------------------------
BADCALL lda #MLI.ERR.BADCALL
BADCALL lda #1 MLI.ERR.BADCALL
sec
rts
*--------------------------------------
@ -212,16 +211,17 @@ READBLOCK.RxOK and /PP.RxEvent.Brdcast
adc #2
tay
pla
bcc .11
inc
adc #2
.11 >PUSHYA Size+2
>PUSHYA Size+2
>PUSHBI 0
>SYSCALL GetMem
bcs READBLOCK.Err
>STYA ZPTmpPTR
stx .8+1
sty .8+3
sta .8+5
lda Size
sta (ZPTmpPTR)
eor #$ff
@ -259,8 +259,9 @@ READBLOCK.RxOK and /PP.RxEvent.Brdcast
inc ZPTmpPTR+1
bne .1
.8 lda #$ff hMem
ldy #$00 Flags
.8 ldx #$ff hMem
ldy #$ff PtrLO
lda #$ff PtrHI
clc
rts
*--------------------------------------

View File

@ -49,7 +49,7 @@ LIBTCPIP.DNS.QUERY .EQ 42
LIBTCPIP.DNS.ADD .EQ 44
LIBTCPIP.DNS.GETCACHE .EQ 46
LIBTCPIP.RCVD.FRAMEA .EQ 48
LIBTCPIP.POLL .EQ 48
LIBTCPIP.PULSEA .EQ 50
LIBTCPIP.SKT.NEW .EQ 52
@ -133,6 +133,7 @@ S.DNSCACHE .EQ 12
S.SOCKET.SOCK .EQ 0
S.SOCKET.SOCK.DGRAM .EQ 1
S.SOCKET.SOCK.STREAM .EQ 2
S.SOCKET.SOCK.RAW .EQ 3
S.SOCKET.SO .EQ 1
S.SOCKET.SO.DEBUG .EQ $01
@ -180,6 +181,11 @@ S.SOCKET.SQ.HEAD .EQ 20
S.SOCKET.SQ.TAIL .EQ 22
S.SOCKET.SQ.SEQNUM .EQ 24
S.SOCKET.SQ.ACKNUM .EQ 28
* Raw Type Queue
S.SOCKET.RQ.HEAD .EQ 16
S.SOCKET.RQ.TAIL .EQ 17
S.SOCKET.RQ .EQ 18
S.SOCKET.RQ.MAX .EQ 14 14 hMem (frames)
*
S.SOCKET .EQ 32
*--------------------------------------

View File

@ -1,14 +1,13 @@
PR#3
PREFIX /A2OSX.SRC
NEW
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
ARP.CLEAR ldx #K.ARPCACHE.SIZE*S.ARPCACHE
.1 dex
stz ARP.CACHE,x
txa
.1 stz ARP.CACHE-1,x
dex
bne .1
clc
rts
@ -93,28 +92,30 @@ ARP.GETCACHE >LDYA L.ARP.CACHE
ARP.IN ldy #S.ARP.TPA+3
ldx #3
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
cmp IPCFG+S.IPCFG.IP,x
bne .9
bne ARP.IN.EXIT
dey
dex
bpl .1
ldy #S.ARP.OPERATION+1 HI byte
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.ARP.OPERATION.REQ
beq ARP.IN.REQ
cmp #S.ARP.OPERATION.REP
beq ARP.IN.REP
.9 clc Discard any other ARP frames
ARP.IN.EXIT lda hFrameIn
>SYSCALL FreeMemA
clc
rts
ARP.IN.REQ ldy #S.ARP.SPA+3
ldx #3
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
sta ARP.REP.TPA,x
dey
dex
@ -123,7 +124,7 @@ ARP.IN.REQ ldy #S.ARP.SPA+3
ldy #S.ARP.SHA+5
ldx #5
.2 lda (ZPFrameBase1),y
.2 lda (ZPFrameBase),y
sta ARP.REP.DSTMAC,x
sta ARP.REP.THA,x
dey
@ -133,6 +134,7 @@ ARP.IN.REQ ldy #S.ARP.SPA+3
>LDYA L.ARP.REP
ldx #DEVMGR.WRITEBLOCK
jsr NetDevJmp
bra ARP.IN.EXIT
ARP.IN.REP lda #K.ARP.TTL
sta ARP.TmpCache+S.ARPCACHE.TTL
@ -142,7 +144,7 @@ ARP.IN.REP lda #K.ARP.TTL
ldy #S.ARP.SPA+3
ldx #3
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
sta ARP.TmpCache+S.ARPCACHE.IP,x
dey
dex
@ -151,7 +153,7 @@ ARP.IN.REP lda #K.ARP.TTL
ldy #S.ARP.SHA+5
ldx #5
.2 lda (ZPFrameBase1),y
.2 lda (ZPFrameBase),y
sta ARP.TmpCache+S.ARPCACHE.MAC,x
dey
dex
@ -160,8 +162,7 @@ ARP.IN.REP lda #K.ARP.TTL
lda #S.ARPCACHE.STATUS.RESOLVED
jsr ARP.ADD.I
clc
rts
jmp ARP.IN.EXIT
*--------------------------------------
ARP.QUERY.I jsr ARP.FIND.BY.IP
bcs .3 send an ARP request

View File

@ -368,36 +368,36 @@ DNS.POLL lda hDNSSocket1
.8 clc
rts
*--------------------------------------
DNS.DecodeMsg sta hFrame1
DNS.DecodeMsg sta hFrameIn
>SYSCALL GetMemPtrA
>STYA ZPFrameBase1
>STYA ZPFrameBase
ldy #S.DNS.F+1
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
and /S.DNS.F.QR
beq .9
ldy #S.DNS.ID
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta DNS.TmpCache+S.DNSCACHE.ID
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta DNS.TmpCache+S.DNSCACHE.ID+1
ldy #S.DNS.ANCOUNT+1
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
beq .9
pha save Answer count...
ldy #S.DNS.QDCOUNT+1
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
ldy #S.DNS Point to DATA
tax
beq .3 no QUERY to skip
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
beq .2
bpl .11 Pointer ?
iny yes, skip 2 bytes
@ -406,7 +406,7 @@ DNS.DecodeMsg sta hFrame1
.11 tya
sec
adc (ZPFrameBase1),y Skip LEN+1 bytes
adc (ZPFrameBase),y Skip LEN+1 bytes
tay
bra .1
@ -422,7 +422,7 @@ DNS.DecodeMsg sta hFrame1
plx get back answer count
.3 lda (ZPFrameBase1),y
.3 lda (ZPFrameBase),y
beq .32
bpl .31 Pointer ?
iny yes, skip 2 bytes
@ -431,12 +431,12 @@ DNS.DecodeMsg sta hFrame1
.31 tya
sec
adc (ZPFrameBase1),y Skip LEN+1 bytes
adc (ZPFrameBase),y Skip LEN+1 bytes
tay
bra .3
.32 iny skip S.DNS.QTYPE HIGH
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.DNS.QTYPE.A
beq .40
@ -445,7 +445,7 @@ DNS.DecodeMsg sta hFrame1
adc #7 skip CLASS,TTL+DATALENHIGH
tay
sec skip DATALENLO
adc (ZPFrameBase1),y add DATALEN
adc (ZPFrameBase),y add DATALEN
tay
dex
bne .3
@ -457,7 +457,7 @@ DNS.DecodeMsg sta hFrame1
iny next pos
ldx #3
.4 lda (ZPFrameBase1),y
.4 lda (ZPFrameBase),y
sta DNS.TmpCache+S.DNSCACHE.TTL,x
iny
dex
@ -467,7 +467,7 @@ DNS.DecodeMsg sta hFrame1
iny
ldx #0
.5 lda (ZPFrameBase1),y
.5 lda (ZPFrameBase),y
sta DNS.TmpCache+S.DNSCACHE.IP,x
iny
inx
@ -476,7 +476,7 @@ DNS.DecodeMsg sta hFrame1
jsr DNS.UPDATE.BY.ID
.9 lda hFrame1
.9 lda hFrameIn
>SYSCALL FreeMemA
rts
*--------------------------------------

View File

@ -5,34 +5,6 @@ INC 1
AUTO 6
.LIST OFF
*--------------------------------------
RCVD.FRAMEA sta hFrame1
>SYSCALL GetMemPtrA
>STYA ZPFrameBase1
jsr FRM.GetLen1
ldy #S.ETH.ETHERTYPE
lda (ZPFrameBase1),y
tax
iny
lda (ZPFrameBase1),y
cmp #S.ETH.ETHERTYPE.ARP
bne .1
cpx /S.ETH.ETHERTYPE.ARP
bne .1
jmp ARP.IN
.1 cmp #S.ETH.ETHERTYPE.IP
bne .9
cpx /S.ETH.ETHERTYPE.IP
bne .9
jmp IP.IN
.9 sec
rts
*--------------------------------------
* Out:
* Y,A = Frame PTR
* X = hMem
@ -41,8 +13,8 @@ NEW.ICMP.FRAME jsr NEW.IP.FRAME
bcs .9
ldy #S.IP.PROTOCOL
lda #S.IP.PROTOCOL.ICMP
sta (ZPFrameBase1),y
>LDYA ZPFrameBase1
sta (ZPFrameBase),y
>LDYA ZPFrameBase
clc
.9 rts
*--------------------------------------
@ -54,8 +26,8 @@ NEW.TCP.FRAME jsr NEW.IP.FRAME
bcs .9
ldy #S.IP.PROTOCOL
lda #S.IP.PROTOCOL.TCP
sta (ZPFrameBase1),y
>LDYA ZPFrameBase1
sta (ZPFrameBase),y
>LDYA ZPFrameBase
clc
.9 rts
*--------------------------------------
@ -67,8 +39,8 @@ NEW.UDP.FRAME jsr NEW.IP.FRAME
bcs .9
ldy #S.IP.PROTOCOL
lda #S.IP.PROTOCOL.UDP
sta (ZPFrameBase1),y
>LDYA ZPFrameBase1
sta (ZPFrameBase),y
>LDYA ZPFrameBase
clc
.9 rts
*--------------------------------------
@ -80,7 +52,7 @@ NEW.IP.FRAME >PUSHWI K.ETH.FRAME.LEN
>PUSHBI S.MEM.F.INIT0
>SYSCALL GetMem
bcs .9
>STYA ZPFrameBase1
>STYA ZPFrameBase
lda DevFlags
and #S.DEVSTAT.NET.FLAGS.IPOFFLOAD
@ -88,90 +60,90 @@ NEW.IP.FRAME >PUSHWI K.ETH.FRAME.LEN
ldy #S.ETH.ETHERTYPE
lda /S.ETH.ETHERTYPE.IP
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
lda #S.ETH.ETHERTYPE.IP
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #S.IP.V.IHL.DSCP.ECN
lda #$45
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
lda #$0
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #S.IP.IDENTIFICATION
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
inc
iny
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dec
ldy #S.IP.FRAGMENT.FLAGS
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #S.IP.TTL
lda #K.IP.TTL
sta (ZPFrameBase1),y
>LDYA ZPFrameBase1
sta (ZPFrameBase),y
>LDYA ZPFrameBase
.9 rts
*--------------------------------------
SEND.ICMP.FRAME >PULLW ZPFrameBase1
jsr FRM.GetLen1
stz hFrame1
SEND.ICMP.FRAME >PULLW ZPFrameBase
jsr FRM.GetLen
stz hFrameOut
SEND.ICMP.FRAME.I
>PUSHW ZPFrameLen1
>PUSHW ZPFrameLen
>PUSHWI S.ICMP.TYPE-2
ldy #S.ICMP.CHECKSUM
lda #0
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
jsr IP.ComputeChecksum
phy
ldy #S.ICMP.CHECKSUM
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
pla
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
bra SEND.IP.FRAME.I
*--------------------------------------
SEND.TCP.FRAME >PULLW ZPFrameBase1
jsr FRM.GetLen1
stz hFrame1
SEND.TCP.FRAME >PULLW ZPFrameBase
jsr FRM.GetLen
stz hFrameOut
SEND.TCP.FRAME.I
bra SEND.IP.FRAME.I
*--------------------------------------
SEND.UDP.FRAME >PULLW ZPFrameBase1
jsr FRM.GetLen1
stz hFrame1
SEND.UDP.FRAME >PULLW ZPFrameBase
jsr FRM.GetLen
stz hFrameOut
SEND.UDP.FRAME.I
ldy #S.UDP.LENGTH+1
lda ZPFrameLen1
lda ZPFrameLen
sec
sbc #S.IP-2
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
lda ZPFrameLen1+1
lda ZPFrameLen+1
sbc /S.IP-2
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
bra SEND.IP.FRAME.I
*--------------------------------------
SEND.IP.FRAME >PULLW ZPFrameBase1
jsr FRM.GetLen1
stz hFrame1
SEND.IP.FRAME >PULLW ZPFrameBase
jsr FRM.GetLen
stz hFrameOut
SEND.IP.FRAME.I ldx #3 Copy SRC.IP even if IP offload
ldy #S.IP.SRC+3 for proper UDP/TCP CRC calculation
.1 lda IPCFG+S.IPCFG.IP,x
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
dex
bpl .1
@ -181,20 +153,20 @@ SEND.IP.FRAME.I ldx #3 Copy SRC.IP even if IP offload
bne .21
ldy #S.IP.TOTAL.LENGTH+1
lda ZPFrameLen1
lda ZPFrameLen
sec
sbc #S.ETH-2
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
lda ZPFrameLen1+1
lda ZPFrameLen+1
sbc /S.ETH-2
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
lda #0
ldy #S.IP.HDR.CHECKSUM
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
stz IP.CHECKSUM RESET.IP.CHECKSUM
stz IP.CHECKSUM+1
@ -204,12 +176,12 @@ SEND.IP.FRAME.I ldx #3 Copy SRC.IP even if IP offload
ldy #S.IP.V.IHL.DSCP.ECN
ldx #10 10 words for IP Header
.2 lda (ZPFrameBase1),y
.2 lda (ZPFrameBase),y
adc IP.CHECKSUM
sta IP.CHECKSUM
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
adc IP.CHECKSUM+1
sta IP.CHECKSUM+1
iny
@ -220,15 +192,15 @@ SEND.IP.FRAME.I ldx #3 Copy SRC.IP even if IP offload
lda IP.CHECKSUM
adc #0
eor #$FF
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
lda IP.CHECKSUM+1
adc #0
eor #$FF
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
.21 ldy #S.IP.PROTOCOL
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.IP.PROTOCOL.TCP
bne .3
jsr TCP.ComputeChecksum
@ -245,18 +217,18 @@ SEND.IP.FRAME.I ldx #3 Copy SRC.IP even if IP offload
jsr IP.SetDestMAC
bcs FRM.Queue
.5 >LDYA ZPFrameBase1
.5 >LDYA ZPFrameBase
ldx #DEVMGR.WRITEBLOCK
jsr NetDevJmp
bcs FRM.Queue
lda hFrame1
lda hFrameOut
beq .9
>SYSCALL FreeMemA
clc
.9 rts
*--------------------------------------
FRM.Queue ldy hFrame1 no hFrame, cannot queue for retry
FRM.Queue ldy hFrameOut no hFrame, cannot queue for retry
beq .9
ldx FRM.QUEUE.Head
@ -272,7 +244,7 @@ FRM.Queue ldy hFrame1 no hFrame, cannot queue for retry
sta FRM.QUEUE.State,y
lda #K.FRMSEND.RETRY
sta FRM.QUEUE.Retry,y
lda hFrame1
lda hFrameOut
sta FRM.QUEUE.hMem,y
clc
rts
@ -286,7 +258,7 @@ FRM.Retry ldx FRM.QUEUE.Tail
beq .8 Queue is empty, exit....
lda FRM.QUEUE.hMem,x
>SYSCALL GetMemPtrA
>STYA ZPFrameBase1
>STYA ZPFrameBase
ldx FRM.QUEUE.Tail
lda FRM.QUEUE.State,x
@ -295,7 +267,7 @@ FRM.Retry ldx FRM.QUEUE.Tail
jsr IP.SetDestMAC Err is ARP or higher, retry getting MAC
bcs .2 still error getting dest MAC
.1 >LDYA ZPFrameBase1 try sending again to DRV
.1 >LDYA ZPFrameBase try sending again to DRV
ldx #DEVMGR.WRITEBLOCK
jsr NetDevJmp
bcc .3
@ -319,11 +291,11 @@ FRM.Retry ldx FRM.QUEUE.Tail
.8 rts
*--------------------------------------
FRM.GetLen1 lda (ZPFrameBase1) Get Frame Len
sta ZPFrameLen1
FRM.GetLen lda (ZPFrameBase) Get Frame Len
sta ZPFrameLen
ldy #1
lda (ZPFrameBase1),y
sta ZPFrameLen1+1
lda (ZPFrameBase),y
sta ZPFrameLen+1
rts
*--------------------------------------
MAN

View File

@ -6,13 +6,13 @@ AUTO 6
.LIST OFF
*--------------------------------------
ICMP.IN ldy #S.ICMP.TYPE
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.ICMP.TYPE.ECHOREQ
bne .9
ldy #S.IP.DST
ldx #S.IPCFG.IP
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
cmp IPCFG,x
bne .9
iny
@ -22,12 +22,12 @@ ICMP.IN ldy #S.ICMP.TYPE
ldy #S.ICMP.TYPE
lda #S.ICMP.TYPE.ECHOREP
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #S.IP.SRC+3
ldx #3
.2 lda (ZPFrameBase1),y
.2 lda (ZPFrameBase),y
sta ARP.TmpCache+S.ARPCACHE.IP,x
dey
dex
@ -37,7 +37,7 @@ ICMP.IN ldy #S.ICMP.TYPE
ldx #3
.3 lda ARP.TmpCache+S.ARPCACHE.IP,x
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
dex
bpl .3
@ -45,7 +45,7 @@ ICMP.IN ldy #S.ICMP.TYPE
ldy #S.ETH.SRCMAC+5
ldx #5
.4 lda (ZPFrameBase1),y
.4 lda (ZPFrameBase),y
sta ARP.TmpCache+S.ARPCACHE.MAC,x
dey
dex
@ -59,7 +59,7 @@ ICMP.IN ldy #S.ICMP.TYPE
lda #S.ARPCACHE.STATUS.RESOLVED
jsr ARP.ADD.I
stz hFrame1 DO NOT QUEUE/DISCARD this frame,it is SOURCE frame!!!
stz hFrameOut DO NOT QUEUE/DISCARD this frame,it is SOURCE frame!!!
jmp SEND.ICMP.FRAME.I
.9 sec
rts

View File

@ -6,7 +6,7 @@ AUTO 6
.LIST OFF
*--------------------------------------
IP.IN ldy #S.IP.PROTOCOL
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.IP.PROTOCOL.ICMP
bne .2
jmp ICMP.IN
@ -14,15 +14,14 @@ IP.IN ldy #S.IP.PROTOCOL
.2 cmp #S.IP.PROTOCOL.UDP
bne .3
jsr UDP.IN
bcs .9
jmp DNS.POLL
jmp UDP.IN
.3 cmp #S.IP.PROTOCOL.TCP
bne .9
jmp TCP.IN
.9 sec
.9 lda hFrameIn
>SYSCALL FreeMemA
rts
*--------------------------------------
* In:
@ -34,18 +33,18 @@ IP.IN ldy #S.IP.PROTOCOL
IP.ComputeChecksum
>PULLA
clc
adc ZPFrameBase1
adc ZPFrameBase
sta ZPTmpPtr1
>PULLA
adc ZPFrameBase1+1
adc ZPFrameBase+1
sta ZPTmpPtr1+1
>PULLA
clc
adc ZPFrameBase1
adc ZPFrameBase
sta TmpOffset
>PULLA
adc ZPFrameBase1+1
adc ZPFrameBase+1
sta TmpOffset+1
stz IP.CHECKSUM
@ -95,10 +94,10 @@ IP.ComputeChecksum
rts
*--------------------------------------
IP.SetDestMAC ldy #S.IP.DST
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
iny
.1 and (ZPFrameBase1),y
.1 and (ZPFrameBase),y
iny
cpy #S.IP.DST+4
bne .1
@ -108,7 +107,7 @@ IP.SetDestMAC ldy #S.IP.DST
ldy #S.ETH.DSTMAC
.2 sta (ZPFrameBase1),y
.2 sta (ZPFrameBase),y
iny
cpy #S.ETH.DSTMAC+6
bne .2
@ -119,7 +118,7 @@ IP.SetDestMAC ldy #S.IP.DST
.3 ldy #S.IP.DST+3
ldx #3
.4 lda (ZPFrameBase1),y
.4 lda (ZPFrameBase),y
eor IPCFG+S.IPCFG.IP,x
and IPCFG+S.IPCFG.MASK,x
bne .6
@ -130,7 +129,7 @@ IP.SetDestMAC ldy #S.IP.DST
ldy #S.IP.DST+3 Same network, query ARP for dest IP
ldx #3
.5 lda (ZPFrameBase1),y
.5 lda (ZPFrameBase),y
sta ARP.TmpCache+S.ARPCACHE.IP,x
dey
dex
@ -150,7 +149,7 @@ IP.SetDestMAC ldy #S.IP.DST
ldx #5
ldy #S.ETH.DSTMAC+5
.11 lda ARP.TmpCache+S.ARPCACHE.MAC,x
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
dex
bpl .11

View File

@ -140,19 +140,19 @@ SKT.SEND >PULLB hSocket
*--------------------------------------
SKT.SEND.UDP jsr NEW.UDP.FRAME
bcs .9
stx hFrame1
stx hFrameOut
lda #S.UDP-2
clc
adc ZPDataLen
sta (ZPFrameBase1)
sta ZPFrameLen1
sta (ZPFrameBase)
sta ZPFrameLen
lda /S.UDP-2
adc ZPDataLen+1
ldy #1
sta (ZPFrameBase1),y
sta ZPFrameLen1+1
sta (ZPFrameBase),y
sta ZPFrameLen+1
ldy #S.SOCKET.SRC.PORT
lda (ZPPtrSKT),y
@ -160,10 +160,10 @@ SKT.SEND.UDP jsr NEW.UDP.FRAME
iny
lda (ZPPtrSKT),y
ldy #S.UDP.SRCPORT
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
txa
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
ldy #S.SOCKET.DST.ADDR
ldx #4
@ -178,7 +178,7 @@ SKT.SEND.UDP jsr NEW.UDP.FRAME
ldx #4
.2 pla
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
dey
dex
bne .2
@ -189,17 +189,17 @@ SKT.SEND.UDP jsr NEW.UDP.FRAME
iny
lda (ZPPtrSKT),y
ldy #S.UDP.DSTPORT
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
txa
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
lda #S.UDP
clc
adc ZPFrameBase1
adc ZPFrameBase
sta ZPTmpPtr1
lda /S.UDP
adc ZPFrameBase1+1
adc ZPFrameBase+1
sta ZPTmpPtr1+1
ldy #0
@ -349,7 +349,7 @@ SKT.AddToQueueD ldy #S.SOCKET.DQ.HEAD
clc
adc #S.SOCKET.DQ
tay
lda hFrame1
lda hFrameOut
sta (ZPPtrSKT),y
clc
rts

View File

@ -8,32 +8,32 @@ AUTO 6
TCP.IN ldy #S.IP.SRC+3
ldx #3
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.DST.ADDR,x
dey
dex
bpl .1
ldy #S.TCP.SRCPORT
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.DST.PORT+1
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.DST.PORT
ldy #S.IP.DST+3
ldx #3
.2 lda (ZPFrameBase1),y
.2 lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.SRC.ADDR,x
dey
dex
bpl .2
ldy #S.TCP.DSTPORT
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.SRC.PORT+1
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.SRC.PORT
>LDYA L.SKT.TABLE
@ -61,7 +61,7 @@ TCP.IN ldy #S.IP.SRC+3
beq .5
ldy #S.TCP.OPTIONS yes, only accept SYN packet
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.TCP.OPTIONS.SYN
bne .7 not for this listening socket
jmp TCP.IN.LISTEN.NEW
@ -102,7 +102,7 @@ TCP.IN.LISTEN.NEW
sec
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
adc #0
sta TmpSocket+S.SOCKET.SQ.ACKNUM,x
dey
@ -159,7 +159,7 @@ TCP.IN.JMP.SYNSENT
*--------------------------------------
TCP.IN.JMP.SYNRCVD
ldy #S.TCP.OPTIONS only accept ACK packet
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.TCP.OPTIONS.ACK
bne .8
@ -175,7 +175,7 @@ TCP.IN.JMP.SYNRCVD
ldx #3
ldy #S.TCP.ACK.NUMBER+3
.11 lda (ZPFrameBase1),y
.11 lda (ZPFrameBase),y
cmp TmpDWord,x
bne .8
dey
@ -217,22 +217,22 @@ TCP.IN.JMP.SYNRCVD
*--------------------------------------
TCP.IN.JMP.ESTBLSH
ldy #S.TCP.OPTIONS
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
cmp #S.TCP.OPTIONS.ACK
bne .3
jsr TCP.UpdateAck
.3 lda ZPFrameBase1
.3 lda ZPFrameBase
clc
adc #S.TCP
sta ZPDataPtr
lda ZPFrameBase1+1
lda ZPFrameBase+1
adc /S.TCP
sta ZPDataPtr+1
ldy #S.TCP.DATAOFFSET
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
lsr
lsr
clc
@ -244,10 +244,10 @@ TCP.IN.JMP.ESTBLSH
lda ZPDataPtr
sec
sbc ZPFrameBase1
sbc ZPFrameBase
sta ZPDataLen
lda ZPDataPtr+1
sbc ZPFrameBase1+1
sbc ZPFrameBase+1
sta ZPDataLen+1
ldy #S.SOCKET.SQ.ACKNUM+3
@ -285,7 +285,7 @@ TCP.IN.JMP.TIMEWT
TCP.UpdateAck ldy #S.TCP.ACK.NUMBER
ldx #4
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
pha
iny
dex
@ -354,19 +354,19 @@ TCP.SendMSG sta TCP.MSG+S.TCP.OPTIONS
TCP.ComputeChecksum
lda #0 RESET.TCP.CHECKSUM
ldy #S.TCP.CHECKSUM
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
>LDYA ZPFrameBase1
>LDYA ZPFrameBase
>STYA ZPTmpPtr1
lda ZPFrameLen1
lda ZPFrameLen
sec
sbc #S.IP-2
sta ZPDataLen
lda ZPFrameLen1+1
lda ZPFrameLen+1
sbc /S.IP-2
sta ZPDataLen+1
@ -384,11 +384,11 @@ TCP.ComputeChecksum
ldx #4 4 words for SRC & DST IP
.10 lda (ZPFrameBase1),y
.10 lda (ZPFrameBase),y
adc IP.CHECKSUM
sta IP.CHECKSUM
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
adc IP.CHECKSUM+1
sta IP.CHECKSUM+1
iny
@ -427,12 +427,12 @@ TCP.ComputeChecksum
lda IP.CHECKSUM
adc #0 Don't forget to add last carry!!!
eor #$FF
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
lda IP.CHECKSUM+1
adc #0 Don't forget to add last carry!!!
eor #$FF
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
rts
*--------------------------------------
MAN

View File

@ -1,38 +1,38 @@
PR#3
PREFIX /A2OSX.SRC
NEW
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
UDP.IN ldy #S.IP.SRC+3
ldx #3
.1 lda (ZPFrameBase1),y
.1 lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.DST.ADDR,x
dey
dex
bpl .1
ldy #S.UDP.SRCPORT
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.DST.PORT+1
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.DST.PORT
ldy #S.IP.DST+3
ldx #3
.2 lda (ZPFrameBase1),y
.2 lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.SRC.ADDR,x
dey
dex
bpl .2
ldy #S.UDP.DSTPORT
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.SRC.PORT+1
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
sta TmpSocket+S.SOCKET.SRC.PORT
>LDYA L.SKT.TABLE
@ -70,12 +70,9 @@ UDP.IN ldy #S.IP.SRC+3
bne .5
jsr SKT.AddToQueueD
bcs .99
lda (pEvent) Make sure kernel not discard frame...
and #$FF^S.EVT.F.hMEM1
sta (pEvent)
clc ...when clearing event!!!!
rts
bcs .9 Q full, discard...
rts DO NOT Discard this queued frame
.7 lda ZPPtrSKT
clc
@ -88,37 +85,38 @@ UDP.IN ldy #S.IP.SRC+3
cpx #K.SKTTABLE.SIZE
bne .3
.9 sec
.99 rts
.9 lda hFrameIn
>SYSCALL FreeMemA
rts
*--------------------------------------
UDP.ComputeChecksum
lda #0 RESET.TCP.CHECKSUM
ldy #S.UDP.CHECKSUM
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
>LDYA ZPFrameBase1
>LDYA ZPFrameBase
>STYA ZPTmpPtr1
lda ZPFrameLen1
lda ZPFrameLen
sec
sbc #S.IP-2
sta ZPDataLen
lda ZPFrameLen1+1
lda ZPFrameLen+1
sbc /S.IP-2
sta ZPDataLen+1
clc
ldy #S.UDP.LENGTH
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
* adc #0 RESERVED (all zero)
sta IP.CHECKSUM
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
adc #S.IP.PROTOCOL.UDP
sta IP.CHECKSUM+1
@ -126,11 +124,11 @@ UDP.ComputeChecksum
ldx #4 4 words for SRC & DST IP
.10 lda (ZPFrameBase1),y
.10 lda (ZPFrameBase),y
adc IP.CHECKSUM
sta IP.CHECKSUM
iny
lda (ZPFrameBase1),y
lda (ZPFrameBase),y
adc IP.CHECKSUM+1
sta IP.CHECKSUM+1
iny
@ -169,12 +167,12 @@ UDP.ComputeChecksum
lda IP.CHECKSUM
adc #0 Don't forget to add last carry!!!
eor #$FF
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
iny
lda IP.CHECKSUM+1
adc #0 Don't forget to add last carry!!!
eor #$FF
sta (ZPFrameBase1),y
sta (ZPFrameBase),y
rts
*--------------------------------------
MAN

View File

@ -12,19 +12,18 @@ AUTO 6
.INB /A2OSX.DEV/INC/A2OSX.I
.INB /A2OSX.DEV/INC/LIBTCPIP.I
*--------------------------------------
ZPFrameBase1 .EQ ZPLIB
ZPFrameLen1 .EQ ZPLIB+2
*ZPFramePtr1 .EQ ZPLIB+4
ZPPtrIP .EQ ZPLIB+12
ZPPtrMAC .EQ ZPLIB+14
ZPPtrDNS .EQ ZPLIB+16
ZPPtrSKT .EQ ZPLIB+18
ZPTmpPtr1 .EQ ZPLIB+20
ZPTmpPtr2 .EQ ZPLIB+22
ZPTmpPtr3 .EQ ZPLIB+24
ZPDataPtr .EQ ZPLIB+26
ZPDataLen .EQ ZPLIB+28
ZPCachePtr .EQ ZPLIB+30
ZPFrameBase .EQ ZPLIB
ZPFrameLen .EQ ZPLIB+2
ZPDataPtr .EQ ZPLIB+4
ZPDataLen .EQ ZPLIB+6
ZPPtrIP .EQ ZPLIB+8
ZPPtrMAC .EQ ZPLIB+10
ZPPtrDNS .EQ ZPLIB+12
ZPPtrSKT .EQ ZPLIB+14
ZPCachePtr .EQ ZPLIB+16
ZPTmpPtr1 .EQ ZPLIB+18
ZPTmpPtr2 .EQ ZPLIB+20
ZPTmpPtr3 .EQ ZPLIB+22
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
@ -47,16 +46,16 @@ CS.START cld
.DA GET.IPCFG
.DA NEW.ICMP.FRAME
.DA NEW.TCP.FRAME
.DA NEW.UDP.FRAME
.DA NEW.IP.FRAME
.DA $ffff NEW.TCP.FRAME
.DA $ffff NEW.UDP.FRAME
.DA $ffff NEW.IP.FRAME
.DA $ffff NEW.ARP.FRAME
.DA $ffff NEW.ETH.FRAME
.DA SEND.ICMP.FRAME
.DA SEND.TCP.FRAME
.DA SEND.UDP.FRAME
.DA SEND.IP.FRAME
.DA $ffff SEND.TCP.FRAME
.DA $ffff SEND.UDP.FRAME
.DA $ffff SEND.IP.FRAME
.DA $ffff SEND.ARP.FRAME
.DA $ffff SEND.ETH.FRAME
@ -70,7 +69,7 @@ CS.START cld
.DA DNS.ADD
.DA DNS.GETCACHE
.DA RCVD.FRAMEA
.DA POLL
.DA PULSEA
.DA SKT.NEW
@ -126,6 +125,38 @@ LIB.LOAD lda bFirstLoad
LIB.UNLOAD clc
rts
*--------------------------------------
POLL ldx #DEVMGR.READBLOCK
jsr NetDevJmp
bcs .99 No Frame
stx hFrameIn
>STYA ZPFrameBase
jsr FRM.GetLen
ldy #S.ETH.ETHERTYPE
lda (ZPFrameBase),y
tax
iny
lda (ZPFrameBase),y
cmp #S.ETH.ETHERTYPE.ARP
bne .1
cpx /S.ETH.ETHERTYPE.ARP
bne .1
jmp ARP.IN
.1 cmp #S.ETH.ETHERTYPE.IP
bne .9
cpx /S.ETH.ETHERTYPE.IP
bne .9
jmp IP.IN
.9 lda hFrameIn
>SYSCALL FreeMemA
.99 rts
*--------------------------------------
* Expire = every sec
* Retry = every 100 msec
*--------------------------------------
@ -133,7 +164,9 @@ PULSEA asl
bpl .1
jsr ARP.EXPIRE
jsr DNS.EXPIRE
.1 jmp FRM.RETRY
.1 jsr DNS.POLL
jmp FRM.RETRY
*--------------------------------------
ToLowerCaseA cmp #'A'
bcc .1
@ -270,7 +303,8 @@ DNS.TmpCache .BS S.DNSCACHE
ARP.TmpCache .BS S.ARP
TmpDWord .BS 4
TmpSocket .BS S.SOCKET
hFrame1 .BS 1
hFrameIn .BS 1
hFrameOut .BS 1
hSocket .BS 1
TmpOffset .BS 2
HST.DecStr .BS 4

View File

@ -148,9 +148,9 @@ note : '$VAR' does NOT expand Variable
| | | -S : Suppress repeated empty output lines | |
| EDIT | Working | still missing : find/replace | 0.9 |
| NSCUTIL | Working | Tool for setting time in NSC/DL1216E | 0.8 |
| ARP | Working | dump ARP cache, setup a static ARP entry | 0.8 |
| ARP | Working | dump ARP cache, setup a static ARP entry | 0.9 |
| PING | Working | | 0.8 |
| DNSINFO | Working | dump DNS cache, setup a static DNS entry | | 0.8 |
| DNSINFO | Working | dump DNS cache, setup a static DNS entry | | 0.9 |
| IPCONFIG | Working | renamed from NETINFO | 0.9 |
| NETSTAT | Working | | 0.9 |
@ -160,7 +160,7 @@ note : '$VAR' does NOT expand Variable
| ASM | In Progress | S-C MASM based multi CPU assembler | |
| DEVDUMP | | | 0.8 |
| MEMDUMP | Working | | 0.9 |
| RPCDUMP | Working | tool based on UDP socket API, renamed from RPCINFO | 0.8 |
| RPCDUMP | Working | tool based on UDP socket API, renamed from RPCINFO | 0.9 |
## Misc
### S-C MASM color scheme for Notepad++

View File

@ -1,6 +1,6 @@
PR#3
PREFIX /A2OSX.SRC
LOMEM $C00
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
@ -220,6 +220,11 @@ CS.RUN.SKT.RCVD ldy #hSocket
>STYA ZPFrameBase
.9 rts
*--------------------------------------
CS.RUN.DISCARD ldy #hFrame
lda (pData),y
>SYSCALL FreeMemA
rts
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9 is it a TIMER event?
@ -301,10 +306,13 @@ CheckDHCPOffer jsr CheckDHCPXID
beq .8
jsr GetDHCPOption
bra .5
.8 clc
.8 jsr CS.RUN.DISCARD
clc
rts
.9 sec
.9 jsr CS.RUN.DISCARD
sec
rts
*--------------------------------------
GetDHCPOption cmp #S.DHCP.OPTIONS.MASK
@ -378,10 +386,12 @@ CheckDHCPAck jsr CheckDHCPXID
cmp #S.DHCP.OPTIONS.DHCPAck
bne .9
jsr CS.RUN.DISCARD
clc
rts
.9 sec
.9 jsr CS.RUN.DISCARD
sec
rts
*--------------------------------------
CheckDHCPXID ldy #S.DHCP.XID+3
@ -392,8 +402,10 @@ CheckDHCPXID ldy #S.DHCP.XID+3
dey
dex
bpl .1
clc
rts
.9 sec
rts
*--------------------------------------

View File

@ -148,18 +148,8 @@ CS.INIT.DEV >LDYA L.DEVNAME
.9 sec
rts
*--------------------------------------
CS.RUN ldx #DEVMGR.READBLOCK
jsr NetDevJmp
bcs .8
sta .1+1
>LIBCALL hLIBTCPIP,LIBTCPIP.RCVD.FRAMEA
bcc .8
.1 lda #$ff
>SYSCALL FreeMemA
.8 clc
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.POLL
clc
rts
*--------------------------------------
CS.DOEVENT lda (pEvent)