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