mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-14 00:31:41 +00:00
Kernel version 0.9 : TCP, bugfix in SEQ & ACK (#3)
This commit is contained in:
parent
e2e972ee7e
commit
b190cfe5c9
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
417
LIB/LIBPAK.S.txt
417
LIB/LIBPAK.S.txt
@ -11,10 +11,10 @@ AUTO 6
|
|||||||
.INB /A2OSX.DEV/INC/MACROS.I
|
.INB /A2OSX.DEV/INC/MACROS.I
|
||||||
.INB /A2OSX.DEV/INC/A2OSX.I
|
.INB /A2OSX.DEV/INC/A2OSX.I
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.SrcPtr .EQ ZPLIB
|
Pak.SrcPtr .EQ ZPLIB
|
||||||
S.Pak.SrcBlPtr .EQ ZPLIB+2
|
Pak.SrcBlPtr .EQ ZPLIB+2
|
||||||
S.Pak.SrcBlPtrT .EQ ZPLIB+4
|
Pak.SrcBlPtrT .EQ ZPLIB+4
|
||||||
S.Pak.DstPtr .EQ ZPLIB+6
|
Pak.DstPtr .EQ ZPLIB+6
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header (16 Bytes)
|
* File Header (16 Bytes)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -95,152 +95,152 @@ STATS.REP .EQ 4
|
|||||||
STATS.S3 .EQ 6
|
STATS.S3 .EQ 6
|
||||||
STATS.S4 .EQ 8
|
STATS.S4 .EQ 8
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak >PULLYA
|
Pak >PULLYA
|
||||||
>STYA S.Pak.Src Init for pass #1
|
>STYA Pak.Src Init for pass #1
|
||||||
>STYA S.Pak.SrcPtr
|
>STYA Pak.SrcPtr
|
||||||
>PULLA Get Src Len LO
|
>PULLA Get Src Len LO
|
||||||
eor #$ff
|
eor #$ff
|
||||||
sta S.Pak.SrcCnt
|
sta Pak.SrcCnt
|
||||||
sta S.Pak.Cnt Init for pass #1
|
sta Pak.Cnt Init for pass #1
|
||||||
tax
|
tax
|
||||||
|
|
||||||
>PULLA Get Src Len HI
|
>PULLA Get Src Len HI
|
||||||
eor #$ff
|
eor #$ff
|
||||||
sta S.Pak.SrcCnt+1
|
sta Pak.SrcCnt+1
|
||||||
sta S.Pak.Cnt+1 Init for pass #1
|
sta Pak.Cnt+1 Init for pass #1
|
||||||
tay
|
tay
|
||||||
|
|
||||||
>PULLW S.Pak.DstPtr
|
>PULLW Pak.DstPtr
|
||||||
txa
|
txa
|
||||||
jsr S.Pak.PutByte
|
jsr Pak.PutByte
|
||||||
tya
|
tya
|
||||||
jsr S.Pak.PutByte
|
jsr Pak.PutByte
|
||||||
|
|
||||||
ldx #9
|
ldx #9
|
||||||
.1 stz S.Pak.Stat.Size,x Reset Stats
|
.1 stz Pak.Stat.Size,x Reset Stats
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
* PASS #1 : Count occurence for each value...
|
* PASS #1 : Count occurence for each value...
|
||||||
|
|
||||||
S.Pak.1 ldx #0
|
Pak.1 ldx #0
|
||||||
.1 stz S.Pak.CntL,x
|
.1 stz Pak.CntL,x
|
||||||
stz S.Pak.CntH,x
|
stz Pak.CntH,x
|
||||||
inx
|
inx
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
|
|
||||||
.2 inc S.Pak.Cnt
|
.2 inc Pak.Cnt
|
||||||
bne .3
|
bne .3
|
||||||
inc S.Pak.Cnt+1
|
inc Pak.Cnt+1
|
||||||
beq .5
|
beq .5
|
||||||
|
|
||||||
.3 lda (S.Pak.SrcPtr),y
|
.3 lda (Pak.SrcPtr),y
|
||||||
tax
|
tax
|
||||||
inc S.Pak.CntL,x
|
inc Pak.CntL,x
|
||||||
bne .4
|
bne .4
|
||||||
inc S.Pak.CntH,x
|
inc Pak.CntH,x
|
||||||
.4 iny
|
.4 iny
|
||||||
bne .2
|
bne .2
|
||||||
inc S.Pak.SrcPtr+1
|
inc Pak.SrcPtr+1
|
||||||
bra .2
|
bra .2
|
||||||
|
|
||||||
* ...Search for Top 24
|
* ...Search for Top 24
|
||||||
.5 ldy #23
|
.5 ldy #23
|
||||||
|
|
||||||
.6 stz S.Pak.Cnt Init best score to 0
|
.6 stz Pak.Cnt Init best score to 0
|
||||||
stz S.Pak.Cnt+1
|
stz Pak.Cnt+1
|
||||||
|
|
||||||
stz S.Pak.Byte
|
stz Pak.Byte
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
.7 lda S.Pak.CntL,x is it better at X
|
.7 lda Pak.CntL,x is it better at X
|
||||||
cmp S.Pak.Cnt
|
cmp Pak.Cnt
|
||||||
lda S.Pak.CntH,x
|
lda Pak.CntH,x
|
||||||
sbc S.Pak.Cnt+1
|
sbc Pak.Cnt+1
|
||||||
bcs .8 not better
|
bcs .8 not better
|
||||||
|
|
||||||
stx S.Pak.Byte
|
stx Pak.Byte
|
||||||
lda S.Pak.CntL,x
|
lda Pak.CntL,x
|
||||||
sta S.Pak.Cnt
|
sta Pak.Cnt
|
||||||
lda S.Pak.CntH,x
|
lda Pak.CntH,x
|
||||||
sta S.Pak.Cnt+1
|
sta Pak.Cnt+1
|
||||||
|
|
||||||
.8 inx
|
.8 inx
|
||||||
bne .7
|
bne .7
|
||||||
|
|
||||||
lda S.Pak.Byte
|
lda Pak.Byte
|
||||||
sta S.Pak.Short,y
|
sta Pak.Short,y
|
||||||
stz S.Pak.CntL,x Discard this entry
|
stz Pak.CntL,x Discard this entry
|
||||||
stz S.Pak.CntH,x
|
stz Pak.CntH,x
|
||||||
dey
|
dey
|
||||||
bpl .6
|
bpl .6
|
||||||
|
|
||||||
ldx #15
|
ldx #15
|
||||||
|
|
||||||
.9 lda S.Pak.Short4,x Store SHORT4 in reverse order
|
.9 lda Pak.Short4,x Store SHORT4 in reverse order
|
||||||
jsr S.Pak.PutByte
|
jsr Pak.PutByte
|
||||||
dex
|
dex
|
||||||
bpl .9
|
bpl .9
|
||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
|
|
||||||
.10 lda S.Pak.Short3,x Store SHORT3 in reverse order
|
.10 lda Pak.Short3,x Store SHORT3 in reverse order
|
||||||
jsr S.Pak.PutByte
|
jsr Pak.PutByte
|
||||||
dex
|
dex
|
||||||
bpl .10
|
bpl .10
|
||||||
|
|
||||||
>LDYAI S.PAK Total Header Size
|
>LDYAI S.PAK Total Header Size
|
||||||
>STYA S.Pak.Stat.Size
|
>STYA Pak.Stat.Size
|
||||||
* PASS #2 :
|
* PASS #2 :
|
||||||
S.Pak.2 >LDYA S.Pak.Src Init for pass #2
|
Pak.2 >LDYA Pak.Src Init for pass #2
|
||||||
>STYA S.Pak.SrcPtr
|
>STYA Pak.SrcPtr
|
||||||
>STYA S.Pak.SrcBlPtr
|
>STYA Pak.SrcBlPtr
|
||||||
|
|
||||||
>LDYA S.Pak.SrcCnt
|
>LDYA Pak.SrcCnt
|
||||||
>STYA S.Pak.Cnt
|
>STYA Pak.Cnt
|
||||||
|
|
||||||
lda #8
|
lda #8
|
||||||
sta S.Pak.PutBit+1 Initialize properly for first "PutBit" Call
|
sta Pak.PutBit+1 Initialize properly for first "PutBit" Call
|
||||||
stz S.Pak.Byte
|
stz Pak.Byte
|
||||||
|
|
||||||
stz S.Pak.PipeLen
|
stz Pak.PipeLen
|
||||||
|
|
||||||
S.Pak.2.LOOP ldx S.Pak.PipeLen Always fill Bytes in the PIPE until full
|
Pak.2.LOOP ldx Pak.PipeLen Always fill Bytes in the PIPE until full
|
||||||
|
|
||||||
.1 jsr S.Pak.GetByte Load PIPE....
|
.1 jsr Pak.GetByte Load PIPE....
|
||||||
bcs .2 end of Buffer ?
|
bcs .2 end of Buffer ?
|
||||||
sta S.Pak.Pipe,x
|
sta Pak.Pipe,x
|
||||||
inx
|
inx
|
||||||
cpx #PIPELEN PIPE Full ?
|
cpx #PIPELEN PIPE Full ?
|
||||||
bne .1
|
bne .1
|
||||||
clc
|
clc
|
||||||
|
|
||||||
.2 stx S.Pak.PipeLen
|
.2 stx Pak.PipeLen
|
||||||
|
|
||||||
txa PIPE empty ....exit
|
txa PIPE empty ....exit
|
||||||
beq .99
|
beq .99
|
||||||
|
|
||||||
* try finding REPeating same bytes.....
|
* try finding REPeating same bytes.....
|
||||||
S.Pak.2.REP dex
|
Pak.2.REP dex
|
||||||
beq S.Pak.2.SHORT Only one char in PIPE...
|
beq Pak.2.SHORT Only one char in PIPE...
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
.1 lda S.Pak.Pipe,x
|
.1 lda Pak.Pipe,x
|
||||||
cmp S.Pak.Pipe+1,x
|
cmp Pak.Pipe+1,x
|
||||||
bne .2
|
bne .2
|
||||||
inx
|
inx
|
||||||
cpx S.Pak.PipeLen
|
cpx Pak.PipeLen
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.2 dex if one char.....no REP
|
.2 dex if one char.....no REP
|
||||||
beq .S.Pak.2.BL
|
beq Pak.2.BL
|
||||||
dex if 2, -> REP ONE (not 2)
|
dex if 2, -> REP ONE (not 2)
|
||||||
phx REP 1 + 0 or more....save REP count for later....
|
phx REP 1 + 0 or more....save REP count for later....
|
||||||
|
|
||||||
jsr S.Pak.2.STORE1 a = byte to store
|
jsr Pak.2.STORE1 a = byte to store
|
||||||
|
|
||||||
lda #%11100000
|
lda #%11100000
|
||||||
plx
|
plx
|
||||||
@ -248,82 +248,82 @@ S.Pak.2.REP dex
|
|||||||
beq .3
|
beq .3
|
||||||
ora #%00010000
|
ora #%00010000
|
||||||
ldy #4
|
ldy #4
|
||||||
jsr S.Pak.PutYBits
|
jsr Pak.PutYBits
|
||||||
txa
|
txa
|
||||||
beq .4 if not REP 2 or more no extra count
|
beq .4 if not REP 2 or more no extra count
|
||||||
ldy #4
|
ldy #4
|
||||||
jsr S.Pak.PutYBits
|
jsr Pak.PutYBits
|
||||||
|
|
||||||
.4 pla
|
.4 pla
|
||||||
clc
|
clc
|
||||||
adc #2
|
adc #2
|
||||||
tay
|
tay
|
||||||
jsr S.Pak.StripPipe Remove REP bytes from PIPE
|
jsr Pak.StripPipe Remove REP bytes from PIPE
|
||||||
|
|
||||||
ldy #STATS.REP
|
ldx #STATS.REP
|
||||||
jsr S.Pak.UpdateStats
|
jsr Pak.UpdateStats
|
||||||
jmp S.Pak.2.LOOP
|
jmp Pak.2.LOOP
|
||||||
S.Pak.2.BL
|
Pak.2.BL
|
||||||
* Try finding best matching BackLink between SrcBlPtr and SrcPtr (max 512)
|
* Try finding best matching BackLink between SrcBlPtr and SrcPtr (max 512)
|
||||||
.4 lda S.Pak.SrcPtr
|
.4 lda Pak.SrcPtr
|
||||||
sec
|
sec
|
||||||
sbc S.Pak.PipeLen
|
sbc Pak.PipeLen
|
||||||
sta S.Pak.Limit setup Limit to SrcPtr-PIPE
|
sta Pak.Limit setup Limit to SrcPtr-PIPE
|
||||||
lda S.Pak.SrcPtr+1
|
lda Pak.SrcPtr+1
|
||||||
sbc #0
|
sbc #0
|
||||||
sta S.Pak.Limit+1
|
sta Pak.Limit+1
|
||||||
|
|
||||||
.40 lda S.Pak.SrcBlPtr
|
.40 lda Pak.SrcBlPtr
|
||||||
sta S.Pak.SrcBlPtrT
|
sta Pak.SrcBlPtrT
|
||||||
lda S.Pak.SrcBlPtr+1
|
lda Pak.SrcBlPtr+1
|
||||||
sta S.Pak.SrcBlPtrT+1
|
sta Pak.SrcBlPtrT+1
|
||||||
|
|
||||||
.5 txa Get PIPE Len
|
.5 txa Get PIPE Len
|
||||||
|
|
||||||
clc make sure SrcBlPtrT+PIPE < Limit
|
clc make sure SrcBlPtrT+PIPE < Limit
|
||||||
adc S.Pak.SrcBlPtrT
|
adc Pak.SrcBlPtrT
|
||||||
tay
|
tay
|
||||||
lda S.Pak.SrcBlPtrT+1
|
lda Pak.SrcBlPtrT+1
|
||||||
adc #0
|
adc #0
|
||||||
cpy S.Pak.Limit
|
cpy Pak.Limit
|
||||||
sbc S.Pak.Limit+1
|
sbc Pak.Limit+1
|
||||||
bcc .10 not enough room
|
bcc .10 not enough room
|
||||||
|
|
||||||
txa
|
txa
|
||||||
dec
|
dec
|
||||||
tay
|
tay
|
||||||
.8 lda (S.Pak.SrcBlPtrT),y
|
.8 lda (Pak.SrcBlPtrT),y
|
||||||
cmp S.Pak.Pipe,y
|
cmp Pak.Pipe,y
|
||||||
bne .9
|
bne .9
|
||||||
dey
|
dey
|
||||||
bpl .8
|
bpl .8
|
||||||
|
|
||||||
* Found a BL at S.Pak.SrcBlPtrT, Store it and remove X bytes from PIPE
|
* Found a BL at Pak.SrcBlPtrT, Store it and remove X bytes from PIPE
|
||||||
phx save BL length
|
phx save BL length
|
||||||
|
|
||||||
lda #%1100000
|
lda #%1100000
|
||||||
ldy #3
|
ldy #3
|
||||||
jsr S.Pak.PutYBits
|
jsr Pak.PutYBits
|
||||||
|
|
||||||
lda S.Pak.Limit
|
lda Pak.Limit
|
||||||
sec
|
sec
|
||||||
sbc S.Pak.SrcBlPtrT
|
sbc Pak.SrcBlPtrT
|
||||||
php save C
|
php save C
|
||||||
|
|
||||||
ldy #8
|
ldy #8
|
||||||
jsr S.Pak.PutYBits
|
jsr Pak.PutYBits
|
||||||
|
|
||||||
plp
|
plp
|
||||||
lda S.Pak.Limit+1
|
lda Pak.Limit+1
|
||||||
sec
|
sec
|
||||||
sbc S.Pak.SrcBlPtrT+1
|
sbc Pak.SrcBlPtrT+1
|
||||||
|
|
||||||
jsr S.Pak.PutBit
|
jsr Pak.PutBit
|
||||||
|
|
||||||
ply Get back BL len
|
ply Get back BL len
|
||||||
phy
|
phy
|
||||||
|
|
||||||
jsr S.Pak.StripPipe Remove LEN bytes from PIPE
|
jsr Pak.StripPipe Remove LEN bytes from PIPE
|
||||||
|
|
||||||
pla Get back BL len
|
pla Get back BL len
|
||||||
sec
|
sec
|
||||||
@ -333,283 +333,280 @@ S.Pak.2.BL
|
|||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
ldy #4 store 4 bits len
|
ldy #4 store 4 bits len
|
||||||
jsr S.Pak.PutYBits
|
jsr Pak.PutYBits
|
||||||
ldy #STATS.BL
|
ldx #STATS.BL
|
||||||
jsr S.Pak.UpdateStats
|
jsr Pak.UpdateStats
|
||||||
jmp S.Pak.2.LOOP
|
jmp Pak.2.LOOP
|
||||||
|
|
||||||
* No match...try starting at next byte
|
* No match...try starting at next byte
|
||||||
.9 inc S.Pak.SrcBlPtrT
|
.9 inc Pak.SrcBlPtrT
|
||||||
bne .5
|
bne .5
|
||||||
inc S.Pak.SrcBlPtrT+1
|
inc Pak.SrcBlPtrT+1
|
||||||
bra .5
|
bra .5
|
||||||
.10 dex reduce PIPE
|
.10 dex reduce PIPE
|
||||||
cpx #2 2 bytes remaining? no need to BL, a BL is 16bits wide.....
|
cpx #2 2 bytes remaining? no need to BL, a BL is 16bits wide.....
|
||||||
bne .40 and start over from BLPtr
|
bne .40 and start over from BLPtr
|
||||||
|
|
||||||
* NO Bl Found, STORE
|
* NO Bl Found, STORE
|
||||||
S.Pak.STORE lda S.Pak.Pipe
|
Pak.STORE lda Pak.Pipe
|
||||||
jsr S.Pak.2.STORE1
|
jsr Pak.2.STORE1
|
||||||
ldy #1
|
ldy #1
|
||||||
jsr S.Pak.StripPipe
|
jsr Pak.StripPipe
|
||||||
jmp S.Pak.2.LOOP
|
jmp Pak.2.LOOP
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.2.STORE1
|
Pak.2.STORE1
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.GetByte inc S.UnPak.Cnt
|
Pak.GetByte inc UnPak.Cnt
|
||||||
bne .1
|
bne .1
|
||||||
inc S.UnPak.Cnt+1
|
inc UnPak.Cnt+1
|
||||||
.1 beq .9
|
.1 beq .9
|
||||||
lda (S.Pak.SrcPtr)
|
lda (Pak.SrcPtr)
|
||||||
pha
|
pha
|
||||||
inc S.Pak.SrcPtr
|
inc Pak.SrcPtr
|
||||||
bne .2
|
bne .2
|
||||||
inc S.Pak.SrcPtr+1
|
inc Pak.SrcPtr+1
|
||||||
.2 clc
|
.2 clc
|
||||||
rts
|
rts
|
||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.PutYBits asl
|
Pak.PutYBits asl
|
||||||
jsr S.Pak.PutBit
|
jsr Pak.PutBit
|
||||||
dey
|
dey
|
||||||
bne S.Pak.PutYBits
|
bne Pak.PutYBits
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* S.Pak.PutBit (bit in C)
|
* Pak.PutBit (bit in C)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.PutBit ldx #$ff
|
Pak.PutBit ldx #$ff
|
||||||
pha
|
pha
|
||||||
bne .1
|
bne .1
|
||||||
lda S.Pak.Byte
|
lda Pak.Byte
|
||||||
jsr S.Pak.PutByte
|
jsr Pak.PutByte
|
||||||
stz S.Pak.Byte
|
stz Pak.Byte
|
||||||
ldx #8
|
ldx #8
|
||||||
|
|
||||||
.1 dex
|
.1 dex
|
||||||
stx S.Pak.PutBit+1
|
stx Pak.PutBit+1
|
||||||
bcc .8 Nothing to "light up"
|
bcc .8 Nothing to "light up"
|
||||||
|
|
||||||
lda S.Pak.Byte
|
lda Pak.Byte
|
||||||
lda S.Pak.BitMask,x
|
lda Pak.BitMask,x
|
||||||
sta S.Pak.Byte
|
sta Pak.Byte
|
||||||
.8 pla
|
.8 pla
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.PutByte sta (S.UnPak.DstPtr)
|
Pak.PutByte sta (Pak.DstPtr)
|
||||||
inc S.UnPak.DstPtr
|
inc Pak.DstPtr
|
||||||
bne .1
|
bne .1
|
||||||
inc S.UnPak.DstPtr+1
|
inc Pak.DstPtr+1
|
||||||
|
|
||||||
.1 inc S.Pak.Stat.Size
|
.1 inc Pak.Stat.Size
|
||||||
bne .2
|
bne .2
|
||||||
inc S.Pak.Stat.Size+1
|
inc Pak.Stat.Size+1
|
||||||
.2
|
.2
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* Y = count to remove from PIPE
|
* Y = count to remove from PIPE
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.StripPipe ldx S.Pak.PipeLen
|
Pak.StripPipe ldx Pak.PipeLen
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
.1 lda S.Pak.Pipe+1,x
|
.1 lda Pak.Pipe+1,x
|
||||||
sta S.Pak.Pipe,x
|
sta Pak.Pipe,x
|
||||||
inx
|
inx
|
||||||
cpx S.Pak.PipeLen
|
cpx Pak.PipeLen
|
||||||
bne .1
|
bne .1
|
||||||
dec S.Pak.PipeLen
|
dec Pak.PipeLen
|
||||||
dey
|
dey
|
||||||
bne S.Pak.StripPipe
|
bne Pak.StripPipe
|
||||||
|
|
||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.UpdateStats
|
Pak.UpdateStats inc Pak.Stat.Size,x
|
||||||
inc S.Pak.Stat.Size,y
|
|
||||||
bne .8
|
bne .8
|
||||||
inc S.Pak.Stat.Size+1,y
|
inc Pak.Stat.Size+1,x
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.BitMask .HS 0102040810204080
|
Pak.BitMask .HS 0102040810204080
|
||||||
S.Pak.Src .BS 2
|
Pak.Src .BS 2
|
||||||
S.Pak.SrcCnt .BS 2
|
Pak.SrcCnt .BS 2
|
||||||
S.Pak.Cnt .BS 2
|
Pak.Cnt .BS 2
|
||||||
S.Pak.CntL .BS 256
|
Pak.CntL .BS 256
|
||||||
S.Pak.CntH .BS 256
|
Pak.CntH .BS 256
|
||||||
S.Pak.Short4 .BS 16
|
Pak.Short4 .BS 16
|
||||||
S.Pak.Short3 .BS 8
|
Pak.Short3 .BS 8
|
||||||
S.Pak.Byte .BS 1
|
Pak.Byte .BS 1
|
||||||
S.Pak.Limit .BS 2
|
Pak.Limit .BS 2
|
||||||
S.Pak.PipeLen .BS 1
|
Pak.PipeLen .BS 1
|
||||||
S.Pak.Pipe .BS 18
|
Pak.Pipe .BS 18
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.Pak.Stat.Size .BS 2
|
Pak.Stat.Size .BS 2
|
||||||
S.Pak.Stat.BL .BS 2
|
Pak.Stat.BL .BS 2
|
||||||
S.Pak.Stat.REP .BS 2
|
Pak.Stat.REP .BS 2
|
||||||
S.Pak.Stat.S3 .BS 2
|
Pak.Stat.S3 .BS 2
|
||||||
S.Pak.Stat.S4 .BS 2
|
Pak.Stat.S4 .BS 2
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* S.UnPak
|
* UnPak
|
||||||
* In :
|
* In :
|
||||||
* PULLW = Src PTR Compressed Buffer
|
* PULLW = Src PTR Compressed Buffer
|
||||||
* PULLW = Dst PTR
|
* PULLW = Dst PTR
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak.SrcPtr .EQ ZPLIB
|
UnPak.SrcPtr .EQ ZPLIB
|
||||||
S.UnPak.DstPtr .EQ ZPLIB+2
|
UnPak.DstPtr .EQ ZPLIB+2
|
||||||
S.UnPak.ShrtTbl .EQ ZPLIB+4
|
UnPak.ShrtTbl .EQ ZPLIB+4
|
||||||
S.UnPak.Cnt .EQ ZPLIB+6
|
UnPak.Cnt .EQ ZPLIB+6
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak >PULLW S.UnPak.SrcPtr
|
UnPak >PULLW UnPak.SrcPtr
|
||||||
>PULLA Get Dst PTR LO
|
>PULLA Get Dst PTR LO
|
||||||
sec
|
sec
|
||||||
sbc #1
|
sbc #1
|
||||||
sta S.UnPak.DstPtr
|
sta UnPak.DstPtr
|
||||||
>PULLA Get Dst PTR HI
|
>PULLA Get Dst PTR HI
|
||||||
sbc #0
|
sbc #0
|
||||||
sta S.UnPak.DstPtr+1 setup Dst PTR-1
|
sta UnPak.DstPtr+1 setup Dst PTR-1
|
||||||
|
|
||||||
jsr S.UnPak.GetByte Get !LEN for counting up to $0000
|
jsr UnPak.GetByte Get !LEN for counting up to $0000
|
||||||
sta S.UnPak.Cnt
|
sta UnPak.Cnt
|
||||||
|
|
||||||
jsr S.UnPak.GetByte
|
jsr UnPak.GetByte
|
||||||
sta S.UnPak.Cnt+1
|
sta UnPak.Cnt+1
|
||||||
|
|
||||||
>LDYA S.UnPak.SrcPtr Get PTR to Short Table.....
|
>LDYA UnPak.SrcPtr Get PTR to Short Table.....
|
||||||
>STYA S.UnPak.ShrtTbl and save it for SHORTx
|
>STYA UnPak.ShrtTbl and save it for SHORTx
|
||||||
|
|
||||||
lda #8
|
lda #8
|
||||||
sta S.UnPak.GetBit+1 Initialize properly for first "GetBit" Call
|
sta UnPak.GetBit+1 Initialize properly for first "GetBit" Call
|
||||||
|
|
||||||
.1 inc S.UnPak.Cnt
|
.1 inc UnPak.Cnt
|
||||||
bne .2
|
bne .2
|
||||||
inc S.UnPak.Cnt+1
|
inc UnPak.Cnt+1
|
||||||
beq .99
|
beq .99
|
||||||
|
|
||||||
.2 jsr S.UnPak.GetBit
|
.2 jsr UnPak.GetBit
|
||||||
bcs .4 CMD....
|
bcs .4 CMD....
|
||||||
*---- STORE
|
*---- STORE
|
||||||
jsr S.UnPak.GetBit
|
jsr UnPak.GetBit
|
||||||
ldx #1
|
ldx #1
|
||||||
bcc .3 if CC one byte
|
bcc .3 if CC one byte
|
||||||
jsr S.UnPak.Get4Bits CC
|
jsr UnPak.Get4Bits CC
|
||||||
adc #2 range is 2->17
|
adc #2 range is 2->17
|
||||||
tax
|
tax
|
||||||
|
|
||||||
.3 jsr S.UnPak.Get8Bits
|
.3 jsr UnPak.Get8Bits
|
||||||
jsr S.UnPak.PutByte
|
jsr UnPak.PutByte
|
||||||
dex
|
dex
|
||||||
bne .3
|
bne .3
|
||||||
bra .1
|
bra .1
|
||||||
.99 rts
|
.99 rts
|
||||||
*---- CMD
|
*---- CMD
|
||||||
.4 jsr S.UnPak.GetBit
|
.4 jsr UnPak.GetBit
|
||||||
bcs .6 BACKLINK or REP...
|
bcs .6 BACKLINK or REP...
|
||||||
*---- CMD : SHORT
|
*---- CMD : SHORT
|
||||||
lda #0
|
lda #0
|
||||||
ldy #4
|
ldy #4
|
||||||
|
|
||||||
jsr S.UnPak.GetBit if CS short3
|
jsr UnPak.GetBit if CS short3
|
||||||
rol make offset 00000001
|
rol make offset 00000001
|
||||||
asl ....00000010
|
asl ....00000010
|
||||||
beq .5
|
beq .5
|
||||||
|
|
||||||
dey if short3, only 3 bits
|
dey if short3, only 3 bits
|
||||||
|
|
||||||
.5 jsr S.UnPak.GetBit
|
.5 jsr UnPak.GetBit
|
||||||
rol
|
rol
|
||||||
dey
|
dey
|
||||||
bne .5
|
bne .5
|
||||||
|
|
||||||
tay if s3, offset is 00010xxx
|
tay if s3, offset is 00010xxx
|
||||||
lda (S.UnPak.ShrtTbl),y if s4, offset is 0000xxxx
|
lda (UnPak.ShrtTbl),y if s4, offset is 0000xxxx
|
||||||
jsr S.UnPak.PutByte
|
jsr UnPak.PutByte
|
||||||
bra .1
|
bra .1
|
||||||
*---- CMD : BACKLINK or REP
|
*---- CMD : BACKLINK or REP
|
||||||
.6 jsr S.UnPak.GetBit
|
.6 jsr UnPak.GetBit
|
||||||
bcs .8 if CS -> REP
|
bcs .8 if CS -> REP
|
||||||
*---- CMD : BACKLINK
|
*---- CMD : BACKLINK
|
||||||
jsr S.UnPak.Get8Bits get Offset LO, (CC)
|
jsr UnPak.Get8Bits get Offset LO, (CC)
|
||||||
eor #$ff !offset LO
|
eor #$ff !offset LO
|
||||||
adc S.UnPak.DstPtr equiv. SUB offset
|
adc UnPak.DstPtr equiv. SUB offset
|
||||||
sta .7+1 PTR to Backlink LO
|
sta .7+1 PTR to Backlink LO
|
||||||
lda S.UnPak.DstPtr+1
|
lda UnPak.DstPtr+1
|
||||||
bcs .61 if ADC sets C, no need to dec HI
|
bcs .61 if ADC sets C, no need to dec HI
|
||||||
dec
|
dec
|
||||||
.61 jsr S.UnPak.GetBit get Offset HI in C
|
.61 jsr UnPak.GetBit get Offset HI in C
|
||||||
bcc .62
|
bcc .62
|
||||||
dec
|
dec
|
||||||
.62 sta .7+2 PTR to Backlink HI
|
.62 sta .7+2 PTR to Backlink HI
|
||||||
|
|
||||||
jsr S.UnPak.Get4Bits CC
|
jsr UnPak.Get4Bits CC
|
||||||
adc #3 Backlink are ate least 3 bytes...
|
adc #3 Backlink are ate least 3 bytes...
|
||||||
tax
|
tax
|
||||||
ldy #0
|
ldy #0
|
||||||
|
|
||||||
.7 lda $ffff,y Self Modified code : PTR to Backlink
|
.7 lda $ffff,y Self Modified code : PTR to Backlink
|
||||||
jsr S.UnPak.PutByte
|
jsr UnPak.PutByte
|
||||||
iny
|
iny
|
||||||
dex
|
dex
|
||||||
bne .7
|
bne .7
|
||||||
beq .1
|
beq .1
|
||||||
*---- CMD : REP
|
*---- CMD : REP
|
||||||
.8 jsr S.UnPak.GetBit
|
.8 jsr UnPak.GetBit
|
||||||
ldx #1
|
ldx #1
|
||||||
bcc .9 REP 1
|
bcc .9 REP 1
|
||||||
|
|
||||||
jsr S.UnPak.Get4Bits REP xxxx, CC
|
jsr UnPak.Get4Bits REP xxxx, CC
|
||||||
adc #2 range is 2->17
|
adc #2 range is 2->17
|
||||||
tax
|
tax
|
||||||
|
|
||||||
.9 lda (S.UnPak.DstPtr) Get Last Byte
|
.9 lda (UnPak.DstPtr) Get Last Byte
|
||||||
jsr S.UnPak.PutByte
|
jsr UnPak.PutByte
|
||||||
dex
|
dex
|
||||||
bne .9
|
bne .9
|
||||||
beq .1
|
jmp .1
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak.Get8Bits
|
UnPak.Get8Bits ldy #8
|
||||||
ldy #8
|
|
||||||
.HS 2C bit abs
|
.HS 2C bit abs
|
||||||
S.UnPak.Get4Bits
|
UnPak.Get4Bits ldy #4
|
||||||
ldy #4
|
|
||||||
lda #0 make sure to reset A before reading less than 8 bits only
|
lda #0 make sure to reset A before reading less than 8 bits only
|
||||||
.1 jsr S.UnPak.GetBit and to exit with CC if even if 8 bits read
|
.1 jsr UnPak.GetBit and to exit with CC if even if 8 bits read
|
||||||
rol
|
rol
|
||||||
dey
|
dey
|
||||||
bne .1
|
bne .1
|
||||||
rts always CC
|
rts always CC
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak.GetBit ldx #$ff Self Modified code
|
UnPak.GetBit ldx #$ff Self Modified code
|
||||||
bne .1
|
bne .1
|
||||||
jsr S.UnPak.NxtByte
|
jsr UnPak.NxtByte
|
||||||
|
|
||||||
ldx #8
|
ldx #8
|
||||||
|
|
||||||
.1 dex
|
.1 dex
|
||||||
stx S.UnPak.GetBit+1
|
stx UnPak.GetBit+1
|
||||||
|
|
||||||
pha Don't trash A
|
pha Don't trash A
|
||||||
lda (S.UnPak.SrcPtr)
|
lda (UnPak.SrcPtr)
|
||||||
and S.UnPak.BitMask,x
|
and UnPak.BitMask,x
|
||||||
cmp #1 if 0:CC, i>0 CS
|
cmp #1 if 0:CC, i>0 CS
|
||||||
|
|
||||||
pla
|
pla
|
||||||
rts Bit is in C
|
rts Bit is in C
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak.GetByte lda (S.UnPak.SrcPtr)
|
UnPak.GetByte lda (UnPak.SrcPtr)
|
||||||
S.UnPak.NxtByte inc S.UnPak.SrcPtr
|
UnPak.NxtByte inc UnPak.SrcPtr
|
||||||
bne .8
|
bne .8
|
||||||
inc S.UnPak.SrcPtr+1
|
inc UnPak.SrcPtr+1
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak.PutByte inc S.UnPak.DstPtr
|
UnPak.PutByte inc UnPak.DstPtr
|
||||||
bne .8
|
bne .8
|
||||||
inc S.UnPak.DstPtr+1
|
inc UnPak.DstPtr+1
|
||||||
.8 sta (S.UnPak.DstPtr)
|
.8 sta (UnPak.DstPtr)
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
S.UnPak.BitMask .HS 8040201008040201
|
UnPak.BitMask .HS 8040201008040201
|
||||||
MAN
|
MAN
|
||||||
SAVE LIB/LIBPAK.S
|
SAVE LIB/LIBPAK.S
|
||||||
ASM
|
ASM
|
||||||
|
@ -838,7 +838,7 @@ SKT.GetDataFromSktIn
|
|||||||
bmi .9 ....and TextMode selected, NO ending CR found
|
bmi .9 ....and TextMode selected, NO ending CR found
|
||||||
|
|
||||||
lda ZPTmpPtr3 Do we have transfered something?
|
lda ZPTmpPtr3 Do we have transfered something?
|
||||||
eor ZPTmpPtr3+1
|
ora ZPTmpPtr3+1
|
||||||
beq .9
|
beq .9
|
||||||
|
|
||||||
lda SKT.TCBCache+S.TCB.INFREE
|
lda SKT.TCBCache+S.TCB.INFREE
|
||||||
@ -1060,14 +1060,14 @@ SKT.AckDataToSktOut
|
|||||||
pha
|
pha
|
||||||
sbc SKT.TCBCache+S.TCB.SEQNUM,x
|
sbc SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
sta TmpDWord,x
|
sta TmpDWord,x
|
||||||
pla ....and Set ACK = new ACK
|
pla ....and Set SEQ = new SEQ
|
||||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
dey
|
dey
|
||||||
dex
|
dex
|
||||||
bpl .1
|
bpl .1
|
||||||
|
|
||||||
lda TmpDWord
|
lda TmpDWord+3
|
||||||
ldx TmpDWord+1
|
ldx TmpDWord+2
|
||||||
bne .2
|
bne .2
|
||||||
tay
|
tay
|
||||||
beq .8
|
beq .8
|
||||||
@ -1083,21 +1083,22 @@ SKT.AckDataToSktOut
|
|||||||
|
|
||||||
lda SKT.TCBCache+S.TCB.OUTFREE
|
lda SKT.TCBCache+S.TCB.OUTFREE
|
||||||
clc
|
clc
|
||||||
adc TmpDWord
|
adc TmpDWord+3
|
||||||
sta SKT.TCBCache+S.TCB.OUTFREE
|
sta SKT.TCBCache+S.TCB.OUTFREE
|
||||||
|
|
||||||
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
lda SKT.TCBCache+S.TCB.OUTFREE+1
|
||||||
adc TmpDWord+1
|
adc TmpDWord+2
|
||||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||||
|
|
||||||
lda SKT.TCBCache+S.TCB.OUTUSED
|
lda SKT.TCBCache+S.TCB.OUTUSED
|
||||||
sec
|
sec
|
||||||
sbc TmpDWord
|
sbc TmpDWord+3
|
||||||
sta SKT.TCBCache+S.TCB.OUTUSED
|
sta SKT.TCBCache+S.TCB.OUTUSED
|
||||||
|
|
||||||
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
lda SKT.TCBCache+S.TCB.OUTUSED+1
|
||||||
sbc TmpDWord+1
|
sbc TmpDWord+2
|
||||||
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
sta SKT.TCBCache+S.TCB.OUTUSED+1
|
||||||
|
|
||||||
.8 rts
|
.8 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
SKT.NewTCB >PUSHWI S.TCB
|
SKT.NewTCB >PUSHWI S.TCB
|
||||||
@ -1119,11 +1120,9 @@ SKT.NewTCB >PUSHWI S.TCB
|
|||||||
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
sta SKT.TCBCache+S.TCB.OUTFREE+1
|
||||||
|
|
||||||
ldx #3
|
ldx #3
|
||||||
sec
|
|
||||||
|
|
||||||
.2 lda A2osX.TIMER16,x
|
.2 lda A2osX.TIMER16,x
|
||||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
adc #0
|
|
||||||
sta SKT.TCBCache+S.TCB.NEXTSEQ,x
|
sta SKT.TCBCache+S.TCB.NEXTSEQ,x
|
||||||
dex
|
dex
|
||||||
bpl .2
|
bpl .2
|
||||||
|
@ -193,8 +193,12 @@ TCP.IN.JMP.SYNRCVD
|
|||||||
ldx #3
|
ldx #3
|
||||||
ldy #S.TCP.ACK.NUMBER+3
|
ldy #S.TCP.ACK.NUMBER+3
|
||||||
|
|
||||||
.1 lda SKT.TCBCache+S.TCB.NEXTSEQ,x Check if ACK=my SEQ+1
|
sec
|
||||||
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
|
||||||
|
.1 lda SKT.TCBCache+S.TCB.SEQNUM,x Check if ACK=my SEQ+1
|
||||||
|
adc #0
|
||||||
|
sta SKT.TCBCache+S.TCB.SEQNUM,x
|
||||||
|
sta SKT.TCBCache+S.TCB.NEXTSEQ,x
|
||||||
eor (ZPFrameInPtr),y
|
eor (ZPFrameInPtr),y
|
||||||
bne .8
|
bne .8
|
||||||
dey
|
dey
|
||||||
@ -390,7 +394,9 @@ TCP.OUT.I lda SKT.TCBCache+S.TCB.OUTUSED+1
|
|||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
tax
|
tax
|
||||||
beq .1 Y,A=0 : no data to send
|
bne .1
|
||||||
|
|
||||||
|
* Y,A=0 : no data to send
|
||||||
|
|
||||||
ldy #S.SOCKET.TCP.OPTIONS
|
ldy #S.SOCKET.TCP.OPTIONS
|
||||||
lda (ZPPtrSKT),y
|
lda (ZPPtrSKT),y
|
||||||
@ -428,8 +434,20 @@ TCP.OUT.SendOpt sta .1+1
|
|||||||
|
|
||||||
TCP.OUT.Send ldy #S.TCP.OPTIONS
|
TCP.OUT.Send ldy #S.TCP.OPTIONS
|
||||||
sta (ZPFrameOutPtr),y
|
sta (ZPFrameOutPtr),y
|
||||||
ldx #7
|
bit #S.TCP.OPTIONS.ACK
|
||||||
ldy #S.TCP.SEQ.NUMBER+7
|
bne .1
|
||||||
|
|
||||||
|
ldx #3
|
||||||
|
ldy #S.TCP.ACK.NUMBER+3
|
||||||
|
|
||||||
|
.10 lda SKT.TCBCache+S.TCB.ACKNUM,x
|
||||||
|
sta (ZPFrameOutPtr),y
|
||||||
|
dey
|
||||||
|
dex
|
||||||
|
bpl .10
|
||||||
|
|
||||||
|
.1 ldx #3
|
||||||
|
ldy #S.TCP.SEQ.NUMBER+3
|
||||||
|
|
||||||
.2 lda SKT.TCBCache+S.TCB.NEXTSEQ,x
|
.2 lda SKT.TCBCache+S.TCB.NEXTSEQ,x
|
||||||
sta (ZPFrameOutPtr),y
|
sta (ZPFrameOutPtr),y
|
||||||
|
Loading…
x
Reference in New Issue
Block a user