Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-05-13 17:40:37 +02:00
parent b232facc43
commit aa29d2c12f
6 changed files with 66 additions and 46 deletions

Binary file not shown.

View File

@ -251,21 +251,19 @@ ARP.QUERY.I jsr ARP.FIND.BY.IP
ARP.FIND.BY.IP >LDYA L.ARP.CACHE
>STYA ZPCachePtr
lda #K.ARPCACHE.SIZE
sta TmpOffset
ldx #K.ARPCACHE.SIZE
.1 lda (ZPCachePtr)
beq .3
ldx #3
ldy #S.ARPCACHE.IP+3
ldy #S.ARPCACHE.IP
.2 lda ARP.TmpCache+S.ARPCACHE.IP,x
.2 lda ARP.TmpCache,y
cmp (ZPCachePtr),y
bne .3
dey
dex
bpl .2
iny
cpy #S.ARPCACHE.IP+4
bne .2
clc
rts
@ -277,8 +275,9 @@ ARP.FIND.BY.IP >LDYA L.ARP.CACHE
bcc .8
inc ZPCachePtr+1
.8 dec TmpOffset
.8 dex
bne .1
sec
rts
*--------------------------------------

View File

@ -252,18 +252,20 @@ DNS.FIND.BY.NAME
>LDYA L.DNS.CACHE
>STYA ZPCachePtr
lda #K.DNSCACHE.SIZE
sta TmpOffset
ldx #K.DNSCACHE.SIZE
.1 lda (ZPCachePtr)
beq .6 empty DNS cache entry?
phx
>PUSHW ZPPtrDNS
ldy #S.DNSCACHE.hNAME
lda (ZPCachePtr),y
>SYSCALL2 GetMemPtr
>SYSCALL2 StrCaseCmp
plx
bcc .8
.6 lda ZPCachePtr
@ -273,8 +275,9 @@ DNS.FIND.BY.NAME
bcc .7
inc ZPCachePtr+1
.7 dec TmpOffset
.7 dex
bne .1
sec
.8 rts
*--------------------------------------
@ -319,38 +322,45 @@ DNS.UPDATE.BY.ID
.7 dex
bne .1
sec
rts
*--------------------------------------
DNS.FIND.FREE >LDYA L.DNS.CACHE
>STYA ZPCachePtr
lda #K.DNSCACHE.SIZE
sta TmpOffset
lda #$ff
sta TmpDWord
sta TmpDWord+1
sta TmpDWord+2
sta TmpDWord+3
ldx #K.DNSCACHE.SIZE
.1 lda (ZPCachePtr)
beq .8 empty DNS cache entry?
bit #S.DNSCACHE.STATUS.STATIC+S.DNSCACHE.STATUS.PENDING
bne .6 Static/Pending.....skip
bne .7 Static/Pending.....skip
phx
ldy #S.DNSCACHE.TTL
ldx #3
sec
.2 lda TmpDWord,x is saved TTL greater then actual TTL?
sbc (ZPCachePtr),y
iny
dex
bpl .2
bcc .6 no,
ldy #S.DNSCACHE.TTL
ldx #3
.3 lda (ZPCachePtr),y Save new lowest TTL
sta TmpDWord,x
iny
@ -360,14 +370,16 @@ DNS.FIND.FREE >LDYA L.DNS.CACHE
>LDYA ZPCachePtr
>STYA ZPTmpPtr1 save lowest TTL slot ...
.6 lda ZPCachePtr
.6 plx
.7 lda ZPCachePtr
clc
adc #S.DNSCACHE
sta ZPCachePtr
bcc .7
bcc .71
inc ZPCachePtr+1
.7 dec TmpOffset
.71 dex
bne .1 no empty slot found, discard lowest TTL
>LDYA ZPTmpPtr1
@ -380,26 +392,33 @@ DNS.FIND.FREE >LDYA L.DNS.CACHE
DNS.EXPIRE >LDYA L.DNS.CACHE
>STYA ZPCachePtr
lda #K.DNSCACHE.SIZE
sta TmpOffset
ldx #K.DNSCACHE.SIZE
.1 lda (ZPCachePtr)
beq .7 empty DNS cache entry?
bit #S.DNSCACHE.STATUS.STATIC
bne .7
phx
ldy #S.DNSCACHE.TTL
ldx #4
clc
.2 lda (ZPCachePtr),y
sbc #0
sta (ZPCachePtr),y
iny
dex
bne .2
bcs .7
bcs .6
jsr DNS.FREE
.6 plx
.7 lda ZPCachePtr
clc
adc #S.DNSCACHE
@ -407,8 +426,9 @@ DNS.EXPIRE >LDYA L.DNS.CACHE
bcc .8
inc ZPCachePtr+1
.8 dec TmpOffset
.8 dex
bne .1
clc
rts
*--------------------------------------

View File

@ -514,14 +514,9 @@ SKT.GetDataFromSktIn
.80 jsr SKT.StoreTCB
ldy #S.SOCKET.TCP.O
lda (ZPPtrSKT),y
ora #S.TCP.OPTIONS.ACK
sta (ZPPtrSKT),y
jsr TCP.SetSocketTCPO.ACK Send the new WSIZE
jsr TCP.OUT.I SKT.GetTCB already called, Try to ACK read DATA
.88 >LDYA ZPTmpPtr3
>LDYA ZPTmpPtr3
clc
rts
*/--------------------------------------

View File

@ -217,6 +217,10 @@ TCP.IN.JMP.ESTBLSH
jsr SKT.StoreTCB success, update socket
jsr TCP.SetSocketTCPO.ACK Try to ACK read DATA
* jsr TCP.OUT.I SKT.GetTCB already called
.2 ldy #S.TCP.OPTIONS
lda (ZPFrameInPtr),y
and #S.TCP.OPTIONS.FIN
@ -330,10 +334,7 @@ TCP.IN.ACKTheSYN
rts
*--------------------------------------
TCP.IN.ACKTheFIN
ldy #S.SOCKET.TCP.O
lda (ZPPtrSKT),y
ora #S.TCP.OPTIONS.ACK
sta (ZPPtrSKT),y
jsr TCP.SetSocketTCPO.ACK
ldx #3
@ -374,11 +375,11 @@ TCP.IN.SetDataInPtrAndLen
and #$F0 Get TCP Header len in DWORD
lsr
lsr
sta TmpOffset
sta ZPDataInPtr TMP Storage
lda ZPDataInLen
sec
sbc TmpOffset
sbc ZPDataInPtr TMP Storage
sta ZPDataInLen
bcs .1
@ -395,7 +396,7 @@ TCP.IN.SetDataInPtrAndLen
pla
clc
adc TmpOffset
adc ZPDataInPtr TMP Storage
bcc .2
inx
@ -436,10 +437,9 @@ TCP.OUT.I lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
jsr SKT.GetDataFromSktOut
ldy #S.SOCKET.TCP.O
lda (ZPPtrSKT),y
ora #S.TCP.OPTIONS.ACK+S.TCP.OPTIONS.PSH
sta (ZPPtrSKT),y
lda #S.TCP.OPTIONS.ACK+S.TCP.OPTIONS.PSH
jsr TCP.SetSocketTCPO
jsr TCP.OUT.Send
@ -461,9 +461,7 @@ TCP.OUT.I lda SKT.Cache+S.SOCKET.TCP.OUTTOSEND+1
.80 jmp SKT.StoreTCB exits with CC
*--------------------------------------
TCP.OUT.SendOptA
ldy #S.SOCKET.TCP.O
ora (ZPPtrSKT),y
sta (ZPPtrSKT),y
jsr TCP.SetSocketTCPO
>LDYAI 0
jsr TCP.NewFrame
@ -513,6 +511,14 @@ TCP.OUT.Send ldy #S.TCP.OPTIONS
* clc
.9 rts
*--------------------------------------
TCP.SetSocketTCPO.ACK
lda #S.TCP.OPTIONS.ACK
TCP.SetSocketTCPO
ldy #S.SOCKET.TCP.O
ora (ZPPtrSKT),y
sta (ZPPtrSKT),y
rts
*--------------------------------------
TCP.NewFrame ldx #S.IP.PROTOCOL.TCP
jsr FRM.NewIP
bcs .9

View File

@ -452,9 +452,9 @@ SKT.Index .BS 1
SKT.TABLE .BS K.SKTTABLE.SIZE
SKT.LOC.ADDR .BS S.SOCKADDR
SKT.REM.ADDR .BS S.SOCKADDR
SKT.Cache .BS S.SOCKET.TCP
SKT.Cache .EQ *-S.SOCKET.TCP.INTAIL
.BS S.SOCKET.TCP-S.SOCKET.TCP.INTAIL
TmpDWord .BS 4
TmpOffset .BS 2
hFrameIn .BS 1
hFrameOut .BS 1
HST.SScanF .AZ "%d.%d.%d.%d"