mirror of
https://github.com/A2osX/A2osX.git
synced 2025-03-24 09:33:48 +00:00
Kernel 0.93+
This commit is contained in:
parent
cb8adcbb8b
commit
b7925394e5
Binary file not shown.
@ -9,10 +9,10 @@ WSIZE .EQ 4096
|
||||
*--------------------------------------
|
||||
PAK.B.STRING .EQ %0
|
||||
PAK.B.BYTE8 .EQ %0
|
||||
PAK.B.TOP8 .EQ %10
|
||||
PAK.B.TOP16 .EQ %110
|
||||
PAK.B.TOP24 .EQ %1110
|
||||
PAK.B.REPn .EQ %1111
|
||||
PAK.B.TOP8 .EQ %10.000
|
||||
PAK.B.TOP16 .EQ %110.000
|
||||
PAK.B.TOP24 .EQ %1110.000
|
||||
PAK.B.REPn .EQ %1111.0000
|
||||
PAK.B.BACKLINK .EQ %1
|
||||
*--------------------------------------
|
||||
* STRINGn : 0 xxxx (1-16)
|
||||
|
@ -1,10 +0,0 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/LIB/LIBPAK.S.AC
|
||||
ASM
|
@ -1,63 +0,0 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
Pak.In.Init >LDYA Pak.SrcPtr
|
||||
>STYA ZPSrcPtr
|
||||
|
||||
lda Pak.Shnk+S.PAKSHNK.LEN
|
||||
eor #$ff
|
||||
sta Pak.SrcCnt
|
||||
lda Pak.Shnk+S.PAKSHNK.LEN+1
|
||||
eor #$ff
|
||||
sta Pak.SrcCnt+1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.In.GetRH lda #$ff
|
||||
cmp Pak.SrcCnt+1 return 255 if not $ffxx
|
||||
bne .1
|
||||
lda Pak.SrcCnt
|
||||
eor #$ff return !xx if $ffxx
|
||||
.1 rts
|
||||
*--------------------------------------
|
||||
Pak.In.MoveFWA clc
|
||||
adc ZPSrcPtr
|
||||
sta ZPSrcPtr
|
||||
bcc .8
|
||||
inc ZPSrcPtr+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
Pak.In.Get8Bits ldy #8
|
||||
.HS 2C bit abs
|
||||
Pak.In.Get4Bits ldy #4
|
||||
lda #0 make sure to reset A before reading less than 8 bits only
|
||||
.1 jsr Pak.In.GetBit and to exit with CC if even if 8 bits read
|
||||
rol
|
||||
dey
|
||||
bne .1
|
||||
rts always CC
|
||||
*--------------------------------------
|
||||
Pak.In.GetBit ldx Pak.In.Mask
|
||||
bne .1
|
||||
jsr Pak.In.NxtByte
|
||||
ldx #8
|
||||
.1 dex
|
||||
stx Pak.In.Mask
|
||||
pha Don't trash A
|
||||
lda (UnZPSrcPtr)
|
||||
and Pak.In.BitMask,x
|
||||
cmp #1 if 0:CC, i>0 CS
|
||||
pla
|
||||
rts Bit is in C
|
||||
*--------------------------------------
|
||||
Pak.In.GetByte lda (UnZPSrcPtr)
|
||||
Pak.In.NxtByte inc UnZPSrcPtr
|
||||
bne .8
|
||||
inc UnZPSrcPtr+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/LIB/LIBPAK.S.IN
|
||||
LOAD USR/SRC/LIB/LIBPAK.S
|
||||
ASM
|
@ -1,133 +0,0 @@
|
||||
NEW
|
||||
PREFIX
|
||||
AUTO 4,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* Sliding Window = 4096
|
||||
*--------------------------------------
|
||||
WSIZE .EQ 4096 power of 2
|
||||
*--------------------------------------
|
||||
* Output BITSTREAM :
|
||||
* 0 : Lit (8)
|
||||
* 1 : Copy, L (4), P.HI (4), P.LO (8)
|
||||
*--------------------------------------
|
||||
Pak.LZ jsr Pak.In.Init Init SrcPtr,SrcCnt
|
||||
jsr Pak.Out.Init
|
||||
|
||||
* future optimization, make P grows from 2 to 12 while increasing W size
|
||||
* lda #2 Ptr width starts at 2 bits
|
||||
* sta Pak.LZ.PWidth
|
||||
* lda #%00000011 Ptr Mask Starts at %000000000011
|
||||
* sta Pak.LZ.PMaskLO
|
||||
* stz Pak.LZ.PMaskHI
|
||||
lda #$ff
|
||||
sta Pak.LZ.WCnt
|
||||
sta Pak.LZ.WCnt+1 WCnt=!0
|
||||
|
||||
.1 jsr Pak.In.GetRH Z if EOF
|
||||
beq .80
|
||||
cmp #3
|
||||
bcc .8 no more than 2 bytes left....store
|
||||
cmp #19 more than 18 bytes left, limit to 18
|
||||
bcc .2
|
||||
lda #18
|
||||
.2 tax X = Read ahead max size
|
||||
lda ZPSrcPtr make ZPSrcWPtr=ZPSrcPtr
|
||||
sta ZPSrcWPtr
|
||||
lda ZPSrcPtr
|
||||
sta ZPSrcWPtr
|
||||
lda Pak.LZ.WCnt
|
||||
sta ZPCnt
|
||||
lda Pak.LZ.WCnt+1
|
||||
sta ZPCnt+1
|
||||
stz Pak.LZ.BestLen
|
||||
.3 inc ZPCnt
|
||||
bne .4
|
||||
inc ZPCnt+1
|
||||
beq .7 reached begining of window....store
|
||||
lda ZPSrcWPtr make ZPSrcWPtr-=1
|
||||
sec
|
||||
sbc #1
|
||||
sta ZPSrcWPtr
|
||||
bcs .4
|
||||
dec ZPSrcWPtr+1
|
||||
.4 ldy #0
|
||||
phx save Read ahead max size
|
||||
|
||||
.5 lda (ZPSrcPtr),y Try to find a match
|
||||
cmp (ZPSrcWPtr),y
|
||||
bne .6
|
||||
iny
|
||||
dex don't exceed 18 or Src Buffer
|
||||
bne .5
|
||||
.6 plx get back Read ahead max size
|
||||
|
||||
cpy #3 matched a least 3 chars ?
|
||||
bcc .3 no....try one char back in Wnd
|
||||
cpy Pak.LZ.BestLen better than last match ?
|
||||
bcc .3 no....try one char back in Wnd
|
||||
sty Pak.LZ.BestLen
|
||||
lda ZPSrcWPtr
|
||||
sta Pak.LZ.BestPtr
|
||||
lda ZPSrcWPtr+1
|
||||
sta Pak.LZ.BestPtr+1
|
||||
bra .3
|
||||
.7 lda Pak.LZ.BestLen do we match something ?
|
||||
beq .8
|
||||
lda Pak.LZ.BestPtr
|
||||
sec
|
||||
sbc ZPSrcPtr
|
||||
sta Pak.LZ.BestPtr
|
||||
lda Pak.LZ.BestPtr+1
|
||||
sbc ZPSrcPtr+1
|
||||
sta Pak.LZ.BestPtr+1
|
||||
tya get len
|
||||
dec Adjust range 0-15
|
||||
dec
|
||||
dec
|
||||
ora Pak.LZ.BestPtr+1 merge with P.HI
|
||||
sec
|
||||
jsr Pak.Out.PutCA Put 9 bits 1+LLLL+PPPP
|
||||
bcs .99
|
||||
lda Pak.LZ.BestPtr Put 8 bits pppppppp
|
||||
jsr Pak.Out.PutA
|
||||
bcs .99
|
||||
tya
|
||||
bra .81
|
||||
.8 lda (ZPSrcPtr)
|
||||
clc
|
||||
jsr Pak.Out.PutCA Put 9 bits 0+xxxxxxxx
|
||||
bcs .99
|
||||
lda #1
|
||||
.81 jsr Pak.In.MoveFWA
|
||||
tya
|
||||
jsr LZ.MoveWndY
|
||||
bra .3
|
||||
bra .71
|
||||
.80 clc
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
Unpak.LZ
|
||||
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
LZ.MoveWndY tya
|
||||
sec
|
||||
sbc Pak.LZ.WCnt
|
||||
tax
|
||||
lda #0
|
||||
sbc Pak.LZ.WCnt+1
|
||||
cpx #WSIZE^$FF
|
||||
sbc /WSIZE^$FF
|
||||
bcs .1
|
||||
ldx #WSIZE^$FF
|
||||
lda /WSIZE^$FF
|
||||
.1 stx Pak.LZ.WCnt
|
||||
sta Pak.LZ.WCnt+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/LIB/LIBPAK.S.LZ
|
||||
ASM
|
@ -1,85 +0,0 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
Pak.Out.Init lda #$80
|
||||
sta Pak.Out.Mask
|
||||
stz Pak.Out.Byte
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.Out.Close bit Pak.Out.Mask
|
||||
bmi .8
|
||||
lda Pak.Out.Byte
|
||||
jmp Pak.Out.PutByte
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutCA jsr Pak.Out.PutBitC
|
||||
bcs Pak.Out.Put.rts
|
||||
|
||||
Pak.Out.PutA ldy #8
|
||||
|
||||
.1 asl
|
||||
jsr Pak.Out.PutBitC
|
||||
bcs Pak.Out.Put.rts
|
||||
dey
|
||||
bne .1
|
||||
Pak.Out.Put.rts rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutYBits
|
||||
asl
|
||||
jsr Pak.Out.PutBitC
|
||||
bcs .9
|
||||
dey
|
||||
bne Pak.Out.PutYBits
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutBitC pha
|
||||
|
||||
bcc .1
|
||||
lda Pak.Out.Mask
|
||||
tsb Pak.Out.Byte
|
||||
clc
|
||||
.1 lsr Pak.Out.Mask
|
||||
bne .8
|
||||
jsr Pak.Out.PutByte
|
||||
bcs .9
|
||||
jsr Pak.Out.Init
|
||||
.8 pla
|
||||
* clc
|
||||
rts
|
||||
.9 pla
|
||||
* sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutByte inc Pak.DstCnt
|
||||
bne .1
|
||||
inc Pak.DstCnt+1
|
||||
beq .9
|
||||
.1 bit Pak.bPass2
|
||||
bmi .6
|
||||
phx
|
||||
tax
|
||||
inc Pak.CntL,x
|
||||
bne .2
|
||||
|
||||
inc Pak.CntH,x
|
||||
.2 plx
|
||||
bra .7
|
||||
.6 sta (ZPDstPtr)
|
||||
|
||||
inc ZPDstPtr
|
||||
bne .2
|
||||
inc ZPDstPtr+1
|
||||
.7 inc Pak.Stat+S.PAKSTAT.PASS2,x
|
||||
bne .8
|
||||
inc Pak.Stat+S.PAKSTAT.PASS2+1,x
|
||||
.8 clc
|
||||
rts
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE USR/SRC/LIB/LIBPAK.S.OUT
|
||||
LOAD USR/SRC/LIB/LIBPAK.S
|
||||
ASM
|
342
LIB/LIBPAK.S.txt
342
LIB/LIBPAK.S.txt
@ -55,7 +55,7 @@ LIB.UNLOAD clc
|
||||
* CS, Pak failure
|
||||
*\--------------------------------------
|
||||
Pak >PULLW Pak.SrcPtr
|
||||
>PULLW Pak.SrcLen
|
||||
>PULLW Pak.Shnk+S.PAKSHNK.ULEN
|
||||
>PULLW ZPDstPtr
|
||||
>PULLW ZPStatPtr
|
||||
|
||||
@ -73,7 +73,7 @@ Pak >PULLW Pak.SrcPtr
|
||||
ldx #8
|
||||
ldy #0
|
||||
|
||||
lda Pak.SrcLen+1
|
||||
lda Pak.Shnk+S.PAKSHNK.ULEN+1
|
||||
beq .22
|
||||
|
||||
ldy #8
|
||||
@ -83,7 +83,7 @@ Pak >PULLW Pak.SrcPtr
|
||||
dey
|
||||
bra .2
|
||||
|
||||
.22 lda Pak.SrcLen
|
||||
.22 lda Pak.Shnk+S.PAKSHNK.ULEN
|
||||
|
||||
.3 asl
|
||||
bcs .4
|
||||
@ -97,8 +97,6 @@ Pak >PULLW Pak.SrcPtr
|
||||
|
||||
stz Pak.bPass2
|
||||
|
||||
jsr Pak.InitPass
|
||||
|
||||
jsr Pak.Run
|
||||
bcs .9
|
||||
|
||||
@ -110,23 +108,15 @@ Pak >PULLW Pak.SrcPtr
|
||||
|
||||
dec Pak.bPass2
|
||||
|
||||
jsr Pak.InitPass
|
||||
|
||||
jsr Pak.Out.Init Initialize properly for first "PutBit" Call
|
||||
|
||||
stz Pak.StringLen
|
||||
|
||||
|
||||
jsr Pak.Run
|
||||
bcs .9
|
||||
|
||||
jsr Pak.PrintStats
|
||||
|
||||
ldy #S.PAKSHNK-1
|
||||
|
||||
.6 lda Pak.Shnk,y
|
||||
|
||||
dey
|
||||
bpl .6
|
||||
|
||||
ldy #S.PAKSTAT-1
|
||||
|
||||
.7 lda Pak.Stat,y
|
||||
@ -134,40 +124,61 @@ Pak >PULLW Pak.SrcPtr
|
||||
dey
|
||||
bpl .7
|
||||
|
||||
>LDYA Pak.Stat+S.PAKSTAT.PASS2
|
||||
clc
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
Pak.InitPass >LDYA Pak.SrcPtr
|
||||
>STYA ZPSrcPtr
|
||||
|
||||
lda Pak.SrcLen
|
||||
eor #$ff
|
||||
sta Pak.SrcCnt
|
||||
|
||||
lda Pak.SrcLen+1
|
||||
eor #$ff
|
||||
sta Pak.SrcCnt+1
|
||||
Pak.BuildTOPTable
|
||||
ldy #0
|
||||
|
||||
.1 stz Pak.Cnt Init best score to 0
|
||||
stz Pak.Cnt+1
|
||||
|
||||
sec
|
||||
ror Pak.RepCnt
|
||||
stz Pak.LastByte
|
||||
ror Pak.bStop
|
||||
|
||||
ldx #S.PAKSTAT.PASS1
|
||||
bit Pak.bPass2
|
||||
bpl .1
|
||||
ldx #0
|
||||
|
||||
inx
|
||||
inx
|
||||
.2 lda Pak.CntL,x
|
||||
ora Pak.CntH,x
|
||||
beq .3
|
||||
|
||||
stz Pak.bStop
|
||||
|
||||
lda Pak.Cnt
|
||||
cmp Pak.CntL,x is it better at X
|
||||
lda Pak.Cnt+1
|
||||
sbc Pak.CntH,x
|
||||
bcs .3 not better or equal...
|
||||
|
||||
.1 stz Pak.Stat,x Reset Stats
|
||||
inx
|
||||
cpx #S.PAKSTAT
|
||||
stx Pak.LastByte save new score index...
|
||||
|
||||
lda Pak.CntL,x
|
||||
sta Pak.Cnt ...and value
|
||||
lda Pak.CntH,x
|
||||
sta Pak.Cnt+1
|
||||
|
||||
.3 inx
|
||||
bne .2
|
||||
|
||||
bit Pak.bStop
|
||||
bmi .8
|
||||
|
||||
lda Pak.LastByte
|
||||
sta Pak.Shnk+S.PAKSHNK.TOPBYTES,y
|
||||
tax
|
||||
stz Pak.CntL,x Discard this entry
|
||||
stz Pak.CntH,x
|
||||
iny
|
||||
cpy #24
|
||||
bne .1
|
||||
|
||||
.8 sty Pak.Shnk+S.PAKSHNK.TOPCNT
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.Run
|
||||
Pak.Run jsr Pak.InitPass
|
||||
|
||||
Pak.Run.1 inc Pak.SrcCnt
|
||||
bne .1
|
||||
@ -179,7 +190,7 @@ Pak.Run.1 inc Pak.SrcCnt
|
||||
bcs .4
|
||||
|
||||
bit Pak.bPass2
|
||||
bpl .11
|
||||
bmi .11
|
||||
|
||||
ldx #S.PAKSTAT.PASS1
|
||||
jsr Pak.UpdateStats
|
||||
@ -234,8 +245,37 @@ Pak.Run.1 inc Pak.SrcCnt
|
||||
inc ZPSrcPtr+1
|
||||
bra Pak.Run.1
|
||||
*--------------------------------------
|
||||
Pak.InitPass >LDYA Pak.SrcPtr
|
||||
>STYA ZPSrcPtr
|
||||
|
||||
lda Pak.Shnk+S.PAKSHNK.ULEN
|
||||
eor #$ff
|
||||
sta Pak.SrcCnt
|
||||
|
||||
lda Pak.Shnk+S.PAKSHNK.ULEN+1
|
||||
eor #$ff
|
||||
sta Pak.SrcCnt+1
|
||||
|
||||
sec
|
||||
ror Pak.RepCnt
|
||||
stz Pak.LastByte
|
||||
|
||||
ldx #S.PAKSTAT.PASS1
|
||||
bit Pak.bPass2
|
||||
bpl .1
|
||||
|
||||
inx
|
||||
inx
|
||||
|
||||
.1 stz Pak.Stat,x Reset Stats
|
||||
inx
|
||||
cpx #S.PAKSTAT
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.ScanBL >LDYA Pak.SrcPtr
|
||||
>LDYA ZPSrcBLPtr
|
||||
>STYA ZPSrcBLPtr
|
||||
|
||||
sec
|
||||
ror Pak.bBLFound
|
||||
@ -276,11 +316,13 @@ Pak.ScanBL >LDYA Pak.SrcPtr
|
||||
|
||||
.4 dey Adjust BL len Range
|
||||
dey (0 = 3 matching chars...etc..)
|
||||
dey
|
||||
|
||||
bmi .5 not long enough
|
||||
|
||||
cpy Pak.BestBLLen
|
||||
bcs .5 not better ...
|
||||
bcc .5 not better ...
|
||||
beq .5 same...
|
||||
|
||||
sty Pak.BestBLLen
|
||||
>LDYA ZPBLCnt
|
||||
@ -288,6 +330,8 @@ Pak.ScanBL >LDYA Pak.SrcPtr
|
||||
|
||||
stz Pak.bBLFound
|
||||
|
||||
jsr PrintBL
|
||||
|
||||
.5 inc ZPSrcBLPtr
|
||||
bne .1
|
||||
inc ZPSrcBLPtr+1
|
||||
@ -297,53 +341,36 @@ Pak.ScanBL >LDYA Pak.SrcPtr
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.BuildTOPTable
|
||||
PrintBl lda #'{'
|
||||
>SYSCALL putchar
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 stz Pak.Cnt Init best score to 0
|
||||
stz Pak.Cnt+1
|
||||
ldx Pak.BestBLLen
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
|
||||
sec
|
||||
ror Pak.bStop
|
||||
|
||||
ldx #0
|
||||
|
||||
.2 lda Pak.CntL,x
|
||||
ora Pak.CntH,x
|
||||
beq .3
|
||||
|
||||
stz Pak.bStop
|
||||
|
||||
lda Pak.Cnt
|
||||
cmp Pak.CntL,x is it better at X
|
||||
lda Pak.Cnt+1
|
||||
sbc Pak.CntH,x
|
||||
bcs .3 not better or equal...
|
||||
|
||||
stx Pak.In.Byte save new score index...
|
||||
|
||||
lda Pak.CntL,x
|
||||
sta Pak.Cnt ...and value
|
||||
lda Pak.CntH,x
|
||||
sta Pak.Cnt+1
|
||||
|
||||
.3 inx
|
||||
bne .2
|
||||
|
||||
bit Pak.bStop
|
||||
bmi .8
|
||||
|
||||
lda Pak.In.Byte
|
||||
sta Pak.Shnk+S.PAKSHNK.TOPBYTES,y
|
||||
tax
|
||||
stz Pak.CntL,x Discard this entry
|
||||
stz Pak.CntH,x
|
||||
.40 lda (ZPSrcBLPtr),y
|
||||
phy
|
||||
phx
|
||||
cmp #C.SPACE
|
||||
bcs .41
|
||||
|
||||
lda #'_'
|
||||
.41 >SYSCALL putchar
|
||||
plx
|
||||
ply
|
||||
iny
|
||||
cpy #24
|
||||
bne .1
|
||||
|
||||
.8 sty Pak.Shnk+S.PAKSHNK.TOPCNT
|
||||
dex
|
||||
bne .40
|
||||
|
||||
lda #'}'
|
||||
>SYSCALL putchar
|
||||
lda #C.CR
|
||||
>SYSCALL putchar
|
||||
lda #C.LF
|
||||
>SYSCALL putchar
|
||||
>DEBUG
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.PutA bit Pak.bPass2
|
||||
@ -363,12 +390,14 @@ Pak.PutA bit Pak.bPass2
|
||||
clc
|
||||
rts
|
||||
|
||||
Pak.PutA.2 bit Pak.RepCnt
|
||||
Pak.PutA.2 bra Pak.PutA.2.Out
|
||||
|
||||
bit Pak.RepCnt
|
||||
bpl .1
|
||||
|
||||
stz Pak.RepCnt LastByte invalid...
|
||||
sta Pak.LastByte
|
||||
bra Pak.PutA.1 send first byte.
|
||||
bra Pak.PutA.2.Out send first byte.
|
||||
|
||||
.1 cmp Pak.LastByte
|
||||
beq .3
|
||||
@ -378,7 +407,7 @@ Pak.PutA.2 bit Pak.RepCnt
|
||||
beq .2
|
||||
|
||||
ora #PAK.B.REPn yes, send it
|
||||
jsr Pak.PutA.1
|
||||
jsr Pak.PutA.2.Out
|
||||
bcs .9
|
||||
|
||||
ldx #S.PAKSTAT.REPN
|
||||
@ -386,7 +415,7 @@ Pak.PutA.2 bit Pak.RepCnt
|
||||
stz Pak.RepCnt
|
||||
|
||||
.2 lda Pak.LastByte
|
||||
bra Pak.PutA.1
|
||||
bra Pak.PutA.2.Out
|
||||
|
||||
.3 inc Pak.RepCnt
|
||||
lda Pak.RepCnt
|
||||
@ -395,7 +424,7 @@ Pak.PutA.2 bit Pak.RepCnt
|
||||
|
||||
dec
|
||||
ora #PAK.B.REPn
|
||||
jsr Pak.PutA.1
|
||||
jsr Pak.PutA.2.Out
|
||||
bcs .9
|
||||
|
||||
lda #1
|
||||
@ -406,24 +435,8 @@ Pak.PutA.2 bit Pak.RepCnt
|
||||
|
||||
.8 clc
|
||||
.9 rts
|
||||
|
||||
Pak.PutA.1 bit Pak.bPass2
|
||||
bmi .10
|
||||
|
||||
tax
|
||||
inc Pak.CntL,x
|
||||
bne .11
|
||||
inc Pak.CntH,x
|
||||
|
||||
.11 inc Pak.Stat+S.PAKSTAT.PASS1
|
||||
bne .12
|
||||
inc Pak.Stat+S.PAKSTAT.PASS1+1
|
||||
.12 clc
|
||||
rts
|
||||
|
||||
* Pak.PutA.1 PASS #2
|
||||
|
||||
.10 ldy #S.PAKSHNK.TOPCNT
|
||||
|
||||
Pak.PutA.2.Out ldy Pak.Shnk+S.PAKSHNK.TOPCNT
|
||||
|
||||
.1 cmp Pak.Shnk+S.PAKSHNK.TOPBYTES-1,y
|
||||
beq .3
|
||||
@ -440,7 +453,7 @@ Pak.PutA.1 bit Pak.bPass2
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
tax Range 0-2
|
||||
tya
|
||||
and #7
|
||||
ora TOP.Bits,x
|
||||
@ -482,6 +495,102 @@ Pak.Flush ldx Pak.StringLen
|
||||
.8 clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
Pak.Out.Init lda Pak.Shnk+S.PAKSHNK.TOPCNT
|
||||
jsr Pak.Out.PutByte
|
||||
bcs .9
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda Pak.Shnk+S.PAKSHNK.TOPBYTES
|
||||
jsr Pak.Out.PutByte
|
||||
bcs .9
|
||||
|
||||
iny
|
||||
cpy Pak.Shnk+S.PAKSHNK.TOPCNT
|
||||
bne .1
|
||||
|
||||
lda #$80
|
||||
sta Pak.Out.Mask
|
||||
stz Pak.Out.Byte
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
Pak.Out.Close bit Pak.Out.Mask
|
||||
bmi .8
|
||||
lda Pak.Out.Byte
|
||||
jmp Pak.Out.PutByte
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutCA jsr Pak.Out.PutBitC
|
||||
bcs Pak.Out.Put.rts
|
||||
|
||||
ldy #8
|
||||
|
||||
.1 asl
|
||||
jsr Pak.Out.PutBitC
|
||||
bcs Pak.Out.Put.rts
|
||||
dey
|
||||
bne .1
|
||||
Pak.Out.Put.rts rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutYBits
|
||||
asl
|
||||
jsr Pak.Out.PutBitC
|
||||
bcs .9
|
||||
dey
|
||||
bne Pak.Out.PutYBits
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutBitC pha
|
||||
|
||||
bcc .1
|
||||
lda Pak.Out.Mask
|
||||
tsb Pak.Out.Byte
|
||||
|
||||
.1 lsr Pak.Out.Mask
|
||||
bne .8
|
||||
|
||||
ror Pak.Out.Mask
|
||||
|
||||
jsr Pak.Out.PutByte
|
||||
bcs .9
|
||||
|
||||
|
||||
|
||||
.8 pla
|
||||
* clc
|
||||
rts
|
||||
|
||||
.9 pla
|
||||
* sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.Out.PutByte inc Pak.DstCnt
|
||||
bne .1
|
||||
|
||||
inc Pak.DstCnt+1
|
||||
beq .9
|
||||
|
||||
.1 sta (ZPDstPtr)
|
||||
|
||||
inc ZPDstPtr
|
||||
bne .2
|
||||
|
||||
inc ZPDstPtr+1
|
||||
|
||||
.2 inc Pak.Stat+S.PAKSTAT.PASS2
|
||||
bne .8
|
||||
|
||||
inc Pak.Stat+S.PAKSTAT.PASS2+1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
Pak.UpdateStats inc Pak.Stat,x
|
||||
bne .8
|
||||
inc Pak.Stat+1,x
|
||||
@ -507,12 +616,9 @@ Pak.PrintStats ldx #14
|
||||
>PUSHBI 25
|
||||
>LDYA L.MSG.Top24
|
||||
>SYSCALL printf
|
||||
>DEBUG
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
* .INB USR/SRC/LIB/LIBPAK.S.IN
|
||||
.INB USR/SRC/LIB/LIBPAK.S.OUT
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
MSG.Stats .AS "\r\nPass 1 : %5D\r\n"
|
||||
@ -523,13 +629,12 @@ MSG.Stats .AS "\r\nPass 1 : %5D\r\n"
|
||||
.AS "Top 24 : %5D\r\n"
|
||||
.AS "Rep N : %5D\r\n"
|
||||
.AZ "BLNK : %5D\r\n"
|
||||
MSG.Top24 .AZ "Top24 : %d\r\n%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h\r\n"
|
||||
TOP.Bits .DA #%10000,#%110000,#%1110000
|
||||
MSG.Top24 .AZ "Top (%2d) : %h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h%h\r\n"
|
||||
TOP.Bits .DA #PAK.B.TOP8,PAK.B.TOP16,PAK.B.TOP24
|
||||
TOP.BitCnt .DA #5,#6,#7
|
||||
TOP.Stat .DA #S.PAKSTAT.TOP8,S.PAKSTAT.TOP16,S.PAKSTAT.TOP24
|
||||
TOP.Stat .DA #S.PAKSTAT.TOP8,#S.PAKSTAT.TOP16,#S.PAKSTAT.TOP24
|
||||
*--------------------------------------
|
||||
Pak.SrcPtr .BS 2
|
||||
Pak.SrcLen .BS 2
|
||||
|
||||
Pak.SrcCnt .BS 2
|
||||
Pak.DstCnt .BS 2
|
||||
@ -551,14 +656,6 @@ Pak.Cnt .BS 2
|
||||
Pak.bStop .BS 1
|
||||
|
||||
Pak.bPass2 .BS 1
|
||||
Pak.MaxReadAhead .BS 1
|
||||
|
||||
Pak.WPtr .BS 2
|
||||
Pak.WLimit .BS 2
|
||||
Pak.WStrLen .BS 1
|
||||
|
||||
Pak.In.Byte .BS 1
|
||||
Pak.In.Mask .BS 1
|
||||
|
||||
Pak.Out.Byte .BS 1
|
||||
Pak.Out.Mask .BS 1
|
||||
@ -568,7 +665,6 @@ Pak.CntH .BS 256
|
||||
Pak.Shnk .BS S.PAKSHNK
|
||||
Pak.Stat .BS S.PAKSTAT
|
||||
*--------------------------------------
|
||||
Pak.In.BitMask .HS 8040201008040201
|
||||
MAN
|
||||
SAVE USR/SRC/LIB/LIBPAK.S
|
||||
ASM
|
||||
|
Loading…
x
Reference in New Issue
Block a user