Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2019-10-29 17:11:45 +01:00
parent 0e5c0f9111
commit 39d4efd96e
2 changed files with 65 additions and 19 deletions

Binary file not shown.

View File

@ -28,6 +28,8 @@ ZPDstTableOfs .BS 2
ZPChunkIndex .BS 1
ZPChunkCnt .BS 1
ZPChunkOfs .BS 2
ZPChunkLen .BS 2
hSrcFile .BS 1
hDstFile .BS 1
@ -139,30 +141,21 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
.1 lda bPause
bne CS.RUN.LOOP Pause...
*--------------------------------------
.7 inc ZPChunkIndex
jsr CS.RUN.GetChunk
bcs .9
lda ZPChunkIndex
asl
clc
adc #PAKME.TABLE
tay
lda (pData),y
pha
iny
lda (pData),y
ply
>PUSHYA
lda ZPChunkIndex
>PUSHA
>PUSHW ZPChunkLen
>PUSHW ZPChunkOfs
>PUSHB ZPChunkIndex
>PUSHBI 3
>LDYA L.MSG.CHUNK
>SYSCALL printf
dec ZPChunkCnt
bne CS.RUN.LOOP
dec ZPChunkCnt
beq .8
jmp CS.RUN.LOOP
.8 lda #0
sec
@ -283,6 +276,58 @@ CS.RUN.GetTable >PUSHBI SEEK.SET
.9 rts
*--------------------------------------
CS.RUN.GetChunk lda ZPChunkIndex
inc ZPChunkIndex
asl
clc
adc #PAKME.TABLE+1
tay
lda (pData),y
pha
dey
lda (pData),y
sec
ldy #PAKME.HEADER+5
sbc (pData),y
sta ZPChunkOfs
iny
pla
sbc (pData),y
sta ZPChunkOfs+1
>PUSHBI SEEK.SET
>PUSHWZ
>PUSHW ZPChunkOfs
lda hSrcFile
>SYSCALL fseek
bcs .9
>PUSHWI 3
>PUSHEA.G CHUNK.HEADER
lda hSrcFile
>SYSCALL fread
bcs .9
>LDA.G CHUNK.HEADER
* bne .90
>LDA.G CHUNK.HEADER+1
sta ZPChunkLen
iny
lda (pData),y
sta ZPChunkLen+1
clc
rts
.90 lda #MLI.E.INCFF
sec
.9 rts
*--------------------------------------
CS.DOEVENT sec
rts
*--------------------------------------
@ -314,7 +359,7 @@ CS.END
*--------------------------------------
MSG.USAGE .AZ "Usage : PAKME SourceBIN PackedBIN\r\n"
MSG.SRCFILE .AZ "Source File : %s, Org=$%H Size=%D, %d Chunks.\r\n"
MSG.CHUNK .AZ " Chunk #%02d : Ofs=%D\r\n"
MSG.CHUNK .AZ " Chunk #%02d : Ofs=%H, Len=%D\r\n"
MSG.OK .AZ "[OK]"
MSG.ERR .AZ "[%h]\r\n"
MSG.E.IARC .AZ "Invalid/corrupt archive"
@ -335,6 +380,7 @@ Shunk.DstSize .BS 2
STATBUF .BS S.STAT
PAKME.HEADER .BS 10
PAKME.TABLE .BS CHUNK.MAX*2
CHUNK.HEADER .BS 3
PAKSTAT .BS S.PAKSTAT
DS.END .ED
*--------------------------------------