Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-11-05 14:36:10 +01:00
parent dc56c35471
commit 7091fc157b
5 changed files with 120 additions and 63 deletions

Binary file not shown.

Binary file not shown.

View File

@ -64,6 +64,7 @@ L.MSG.USAGE .DA MSG.USAGE
L.MSG.SRCFILE .DA MSG.SRCFILE
L.MSG.CHUNK .DA MSG.CHUNK
L.MSG.PAKED .DA MSG.PAKED
L.MSG.STORE .DA MSG.STORE
L.MSG.E.IARC .DA MSG.E.IARC
L.TAG .DA TAG
.DA 0
@ -187,19 +188,16 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
bcs .9
jsr CS.RUN.Pak
bcs .9
bcs .2
jsr CS.RUN.WritePak
bcc .7
rts
.2 jsr CS.RUN.WriteStore
bcs .9
>PUSHW ZPChunkNewOfs
>PUSHW ZPChunkPakedLen
>PUSHBI 4
>LDYA L.MSG.PAKED
>SYSCALL printf
bcs .9
jsr CS.QUIT.BUF
.7 jsr CS.QUIT.BUF
jsr CS.RUN.UpdateTable
inc ZPChunkIndex
@ -208,7 +206,7 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
jmp CS.RUN.LOOP
.8 jsr CS.RUN.RewriteTable Write modifid Table
.8 jsr CS.RUN.RewriteTable Write modified Table
bcs .9
lda #0
@ -444,6 +442,45 @@ CS.RUN.WritePak lda hDstFile
>PUSHW ZPDstBufPtr
lda hDstFile
>SYSCALL fwrite
bcs .9
>PUSHW ZPChunkNewOfs
>PUSHW ZPChunkPakedLen
>PUSHBI 4
>LDYA L.MSG.PAKED
>SYSCALL printf
.9
CS.RUN.WritePak.RTS
rts
*--------------------------------------
CS.RUN.WriteStore
lda hDstFile
>SYSCALL ftell
bcs CS.RUN.WritePak.RTS
>PULLW ZPChunkNewOfs
inc pStack
inc pStack
>PUSHWI 3
>PUSHEA.G CHUNK.HEADER
lda hDstFile
>SYSCALL fwrite
bcs .9
>PUSHW ZPChunkLen
>PUSHW ZPSrcBufPtr
lda hDstFile
>SYSCALL fwrite
bcs .9
>PUSHW ZPChunkNewOfs
>PUSHW ZPChunkLen
>PUSHBI 4
>LDYA L.MSG.STORE
>SYSCALL printf
.9 rts
*--------------------------------------
CS.RUN.UpdateTable
@ -513,6 +550,7 @@ MSG.USAGE .AZ "Usage : PAKME SourceBIN PackedBIN\r\n"
MSG.SRCFILE .AZ "Source File : %s, Size=%5D, Org=$%H, %d Chunks at $%H.\r\n"
MSG.CHUNK .AZ " Chunk #%02d : Ofs=$%H, Len=%5D ... "
MSG.PAKED .AZ "PAKed : %5D Bytes, New Ofs=$%H\r\n"
MSG.STORE .AZ "Store : %5D Bytes, New Ofs=$%H\r\n"
MSG.E.IARC .AZ "Invalid/corrupt archive"
TAG .AZ "PAKME"
*--------------------------------------

View File

@ -81,8 +81,10 @@ Pak >PULLW Pak.SrcPtr
stz Pak.bPass2
jsr Pak.Out.Init Initialize properly for first "PutBit" Call
bcs .9
jsr Pak.Run
* bcs .9
jsr Pak.ComputeLenBits
jsr Pak.BuildTOPTable
@ -104,10 +106,6 @@ Pak >PULLW Pak.SrcPtr
jsr Pak.Out.Close
bcs .9
.DO STATS=1
jsr Pak.PrintStats
.FIN
ldy #S.PAKSTAT-1
.7 lda Pak.Stat,y
@ -115,19 +113,25 @@ Pak >PULLW Pak.SrcPtr
dey
bpl .7
.DO STATS=1
jsr Pak.PrintStats
.FIN
>LDYA Pak.Stat+S.PAKSTAT.PASS2
clc
.9 rts
*--------------------------------------
Pak.Run >LDYA Pak.SrcPtr
>STYA ZPSrcPtr
.DO STATS=1
rts
.FIN
stz Pak.BL.Longest
stz Pak.BL.Farest
stz Pak.BL.Farest+1
lda Pak.Shnk+S.PAKSHNK.ULEN
.9
.DO STATS=1
jsr Pak.PrintStats
sec
.FIN
rts
*--------------------------------------
Pak.Out.Init lda Pak.Shnk+S.PAKSHNK.ULEN
eor #$ff
sta Pak.SrcCnt
sta Pak.DstCnt
@ -137,6 +141,51 @@ Pak.Run >LDYA Pak.SrcPtr
sta Pak.SrcCnt+1
sta Pak.DstCnt+1
bit Pak.bPass2
bpl .8
lda Pak.Shnk+S.PAKSHNK.BLBITS
jsr Pak.Out.PutByte
bcs .9
lda Pak.Shnk+S.PAKSHNK.ULEN
jsr Pak.Out.PutByte
bcs .9
lda Pak.Shnk+S.PAKSHNK.ULEN+1
jsr Pak.Out.PutByte
bcs .9
lda Pak.Shnk+S.PAKSHNK.TOPCNT
jsr Pak.Out.PutByte
bcs .9
tax
ldy #0
.1 lda Pak.Shnk+S.PAKSHNK.TOPBYTES,y
jsr Pak.Out.PutByte
bcs .9
iny
dex
bne .1
lda #$80
sta Pak.Out.Mask
stz Pak.Out.Byte
.8 clc
.9 rts
*--------------------------------------
Pak.Run >LDYA Pak.SrcPtr
>STYA ZPSrcPtr
stz Pak.BL.Longest
stz Pak.BL.Farest
stz Pak.BL.Farest+1
ldx #S.PAKSTAT.TOP8
.1 stz Pak.Stat,x Reset Stats
@ -440,13 +489,14 @@ Pak.PutByte8 bit Pak.bPass2
rts
Pak.PutByte8.2 ldy Pak.Shnk+S.PAKSHNK.TOPCNT
beq .2 No TOP Table
.1 cmp Pak.Shnk+S.PAKSHNK.TOPBYTES-1,y
beq .3
dey
bne .1
ldx #S.PAKSTAT.BYTE8
.2 ldx #S.PAKSTAT.BYTE8
jsr Pak.UpdateStats
pha
@ -483,41 +533,6 @@ Pak.PutByte8.2 ldy Pak.Shnk+S.PAKSHNK.TOPCNT
.9 rts
*--------------------------------------
Pak.Out.Init lda Pak.Shnk+S.PAKSHNK.BLBITS
jsr Pak.Out.PutByte
bcs .9
lda Pak.Shnk+S.PAKSHNK.ULEN
jsr Pak.Out.PutByte
bcs .9
lda Pak.Shnk+S.PAKSHNK.ULEN+1
jsr Pak.Out.PutByte
bcs .9
lda Pak.Shnk+S.PAKSHNK.TOPCNT
jsr Pak.Out.PutByte
bcs .9
tax
ldy #0
.1 lda Pak.Shnk+S.PAKSHNK.TOPBYTES,y
jsr Pak.Out.PutByte
bcs .9
iny
dex
bne .1
lda #$80
sta Pak.Out.Mask
stz Pak.Out.Byte
* clc
.9 rts
*--------------------------------------
Pak.Out.Close bit Pak.Out.Mask
bmi .8
@ -633,7 +648,12 @@ Pak.PrintStats lda Pak.BL.OfsBitsL
>PUSHBI TOP.MAX+1
>LDYA L.MSG.TopBytes
>SYSCALL printf
rts
bit Pak.bPass2
bpl .9
>DEBUG
.9 rts
.FIN
*--------------------------------------
CS.END

View File

@ -3,8 +3,7 @@ NEW
.LIST OFF
.OP 65816
.OR $2000
* .TF PRODOS,TSYS
.TF PRODOS.FX
.TF PRODOS.FX,TSYS
*--------------------------------------
.INB INC/ZP.I
.INB INC/IO.I