A2osX/BIN/PAKME.S.txt

572 lines
9.9 KiB
Plaintext
Raw Normal View History

2019-10-16 15:23:29 +00:00
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
2020-02-29 14:06:28 +00:00
.TF bin/pakme
2019-10-16 15:23:29 +00:00
*--------------------------------------
2020-08-25 10:56:00 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/pak.i
.INB inc/libpak.i
.INB inc/mli.e.i
2019-10-29 14:47:25 +00:00
*--------------------------------------
CHUNK.MAX .EQ 32
2019-10-16 15:23:29 +00:00
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPPtr2 .BS 2
2019-10-29 14:47:25 +00:00
ZPSrcFileSize .BS 2
ZPDstTableOfs .BS 2
2019-10-30 16:29:46 +00:00
hSrcFile .BS 1
hDstFile .BS 1
2019-10-29 14:47:25 +00:00
ZPChunkIndex .BS 1
ZPChunkCnt .BS 1
2019-10-29 16:11:45 +00:00
ZPChunkOfs .BS 2
ZPChunkLen .BS 2
2019-10-29 14:47:25 +00:00
2019-10-30 16:29:46 +00:00
ZPChunkPakedLen .BS 2
ZPChunkNewOfs .BS 2
hSrcBuf .BS 1
hDstBuf .BS 1
ZPSrcBufPtr .BS 2
ZPDstBufPtr .BS 2
2019-10-16 15:23:29 +00:00
2019-10-30 16:29:46 +00:00
bPause .BS 1
2019-10-29 14:47:25 +00:00
2019-10-16 15:23:29 +00:00
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
.DA #64 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
2022-11-02 06:54:30 +00:00
.DA CS.DOEVENT
2019-10-16 15:23:29 +00:00
.DA CS.QUIT
L.LIBPAK .DA LIBPAK
L.MSG.USAGE .DA MSG.USAGE
2019-10-29 14:47:25 +00:00
L.MSG.SRCFILE .DA MSG.SRCFILE
L.MSG.CHUNK .DA MSG.CHUNK
2019-10-30 16:29:46 +00:00
L.MSG.PAKED .DA MSG.PAKED
2019-11-05 13:36:10 +00:00
L.MSG.STORE .DA MSG.STORE
2019-10-16 15:23:29 +00:00
L.MSG.E.IARC .DA MSG.E.IARC
2019-10-29 14:47:25 +00:00
L.TAG .DA TAG
2019-10-16 15:23:29 +00:00
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBPAK
>SYSCALL LoadLib
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
sta hLIB
.9 rts
*--------------------------------------
2019-10-29 14:47:25 +00:00
CS.RUN ldy #S.PS.ARGC
2020-02-28 07:21:46 +00:00
lda (pPS),y
2019-10-29 14:47:25 +00:00
cmp #2
bne .9
jsr CS.RUN.CheckSrcFile
bcs .99
lda #2
2019-10-16 15:23:29 +00:00
>SYSCALL ArgV
2020-02-29 14:06:28 +00:00
>PUSHYA
>PUSHBI O.CREATE+O.WRONLY
>PUSHB.G STATBUF+S.STAT.P.TYPE
>PUSHW.G STATBUF+S.STAT.P.AUXTYPE
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
>SYSCALL FOpen
bcs .99
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
sta hDstFile
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
bra CS.RUN.START
2022-11-02 06:54:30 +00:00
.9 >LDYA L.MSG.USAGE
>SYSCALL PutS
2019-10-16 15:23:29 +00:00
lda #E.SYN
sec
.99 rts
*--------------------------------------
2020-02-29 14:06:28 +00:00
CS.RUN.START >PUSHW L.MSG.SRCFILE
2019-10-29 14:47:25 +00:00
lda #1
>SYSCALL ArgV
>PUSHYA
2020-02-29 14:06:28 +00:00
>PUSHW ZPSrcFileSize
>PUSHW.G PAKME.HEADER+5
>PUSHB.G PAKME.HEADER+7
>PUSHW ZPDstTableOfs
2019-10-30 16:29:46 +00:00
>PUSHBI 9
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2019-10-16 15:23:29 +00:00
2019-10-30 16:29:46 +00:00
>LDYA ZPDstTableOfs
jsr CS.RUN.GetSrcBufYA
bcs CS.RUN.RTS
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
>PUSHLZ
2019-10-30 16:29:46 +00:00
>PUSHBI SEEK.SET
2020-08-25 10:56:00 +00:00
>SYSCALL FSeek
2019-10-30 16:29:46 +00:00
bcs CS.RUN.RTS
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
2019-10-30 16:29:46 +00:00
>PUSHW ZPSrcBufPtr
2021-05-14 20:58:20 +00:00
>PUSHW ZPDstTableOfs
2020-08-25 10:56:00 +00:00
>SYSCALL FRead
2019-10-30 16:29:46 +00:00
bcs CS.RUN.RTS
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hDstFile
2019-10-30 16:29:46 +00:00
>PUSHW ZPSrcBufPtr
2021-05-14 20:58:20 +00:00
>PUSHW ZPDstTableOfs
2020-08-25 10:56:00 +00:00
>SYSCALL FWrite
2019-10-30 16:29:46 +00:00
bcs CS.RUN.RTS
jsr CS.QUIT.BUF
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
jsr CS.RUN.WriteTable Write Fake table
bcc CS.RUN.LOOP
2022-11-02 06:54:30 +00:00
CS.RUN.RTS rts
2019-10-16 15:23:29 +00:00
*--------------------------------------
CS.RUN.LOOP ldy #S.PS.hStdIn
lda (pPS),y
2020-08-25 10:56:00 +00:00
>SYSCALL FEOF
2019-10-30 16:29:46 +00:00
bcs CS.RUN.RTS
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
tay
bne .1
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
>SYSCALL GetChar
2019-10-30 16:29:46 +00:00
bcs CS.RUN.RTS
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
cmp #$03 Ctrl-C
2019-10-30 16:29:46 +00:00
beq CS.RUN.RTS Abort....
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
.1 lda bPause
bne CS.RUN.LOOP Pause...
*--------------------------------------
2019-10-29 16:11:45 +00:00
jsr CS.RUN.GetChunk
2019-10-30 16:29:46 +00:00
bcs CS.RUN.RTS
2022-11-02 06:54:30 +00:00
2020-02-29 14:06:28 +00:00
>PUSHW L.MSG.CHUNK
2019-10-30 16:29:46 +00:00
lda ZPChunkIndex
inc
>PUSHA
2020-02-29 14:06:28 +00:00
>PUSHW ZPChunkOfs
>PUSHW ZPChunkLen
2019-10-30 16:29:46 +00:00
>PUSHBI 5
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2019-10-30 16:29:46 +00:00
bcs .9
2019-10-16 15:23:29 +00:00
2019-10-30 16:29:46 +00:00
jsr CS.RUN.Pak
2019-11-05 13:36:10 +00:00
bcs .2
2019-10-30 16:29:46 +00:00
jsr CS.RUN.WritePak
2019-11-05 13:36:10 +00:00
bcc .7
rts
2022-11-02 06:54:30 +00:00
2019-11-05 13:36:10 +00:00
.2 jsr CS.RUN.WriteStore
2019-10-30 16:29:46 +00:00
bcs .9
2019-11-05 13:36:10 +00:00
.7 jsr CS.QUIT.BUF
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
jsr CS.RUN.UpdateTable
inc ZPChunkIndex
2019-10-29 16:11:45 +00:00
dec ZPChunkCnt
beq .8
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
jmp CS.RUN.LOOP
2022-11-02 06:54:30 +00:00
2019-11-05 13:36:10 +00:00
.8 jsr CS.RUN.RewriteTable Write modified Table
2019-10-30 16:29:46 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
lda #0
2019-10-16 15:23:29 +00:00
sec
2019-10-29 14:47:25 +00:00
.9 rts
2019-10-16 15:23:29 +00:00
*--------------------------------------
2019-10-29 14:47:25 +00:00
CS.RUN.CheckSrcFile
lda #1
>SYSCALL ArgV
2020-02-29 14:06:28 +00:00
>PUSHYA
>PUSHBI O.RDONLY
>PUSHBI 0 Type
>PUSHWZ Aux type
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
>SYSCALL FOpen
bcs .99
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
sta hSrcFile
2022-11-02 06:54:30 +00:00
2020-02-29 14:06:28 +00:00
>PUSHB hSrcFile
2019-10-29 14:47:25 +00:00
>PUSHEA.G STATBUF
2020-08-25 10:56:00 +00:00
>SYSCALL FStat
2019-10-29 14:47:25 +00:00
.99 bcs .9
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
>LDA.G STATBUF+S.STAT.SIZE+3
dey
ora (pData),y
bne .90
2019-10-16 15:23:29 +00:00
2019-10-29 14:47:25 +00:00
dey
lda (pData),y
sta ZPSrcFileSize+1
dey
lda (pData),y
sta ZPSrcFileSize
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
jsr CS.RUN.CheckTAG
2019-10-16 15:23:29 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
jsr CS.RUN.GetTable
2019-10-16 15:23:29 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
clc
rts
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
.90 lda #MLI.E.INCFF
2019-10-16 15:23:29 +00:00
sec
2022-11-02 06:54:30 +00:00
.9
2019-10-29 14:47:25 +00:00
CS.RUN.CheckSrcFile.RTS
2022-11-02 06:54:30 +00:00
rts
2019-10-16 15:23:29 +00:00
*--------------------------------------
2021-05-14 20:58:20 +00:00
CS.RUN.CheckTAG >PUSHB hSrcFile
2019-10-29 14:47:25 +00:00
>PUSHWZ
2019-10-16 15:23:29 +00:00
2019-10-29 14:47:25 +00:00
lda ZPSrcFileSize
2019-10-16 15:23:29 +00:00
sec
2019-10-29 14:47:25 +00:00
sbc #10
tay
lda ZPSrcFileSize+1
sbc #0
2019-10-16 15:23:29 +00:00
>PUSHYA
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHBI SEEK.SET
2020-08-25 10:56:00 +00:00
>SYSCALL FSeek
2019-10-29 14:47:25 +00:00
bcs CS.RUN.CheckSrcFile.RTS
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
2019-10-29 14:47:25 +00:00
>PUSHEA.G PAKME.HEADER
2021-05-14 20:58:20 +00:00
>PUSHWI 10
2020-08-25 10:56:00 +00:00
>SYSCALL FRead
2019-10-29 14:47:25 +00:00
bcs CS.RUN.CheckSrcFile.RTS
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
ldx #4
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
ldy #PAKME.HEADER+4
2019-10-16 15:23:29 +00:00
2019-10-29 14:47:25 +00:00
.1 lda TAG,x
cmp (pData),y
bne .90
2019-10-16 15:23:29 +00:00
dey
2019-10-29 14:47:25 +00:00
dex
bpl .1
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
clc
rts
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
.90 lda #MLI.E.INCFF
sec
2019-10-16 15:23:29 +00:00
.9 rts
*--------------------------------------
2019-10-30 16:29:46 +00:00
CS.RUN.GetTable >LDA.G PAKME.HEADER+8
2019-10-29 14:47:25 +00:00
sec
>SBC.G PAKME.HEADER+5
2019-10-30 16:29:46 +00:00
sta ZPDstTableOfs
2019-10-29 14:47:25 +00:00
>LDA.G PAKME.HEADER+9
>SBC.G PAKME.HEADER+6
2019-10-30 16:29:46 +00:00
sta ZPDstTableOfs+1
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
2019-10-30 18:25:04 +00:00
>PUSHWZ
>PUSHW ZPDstTableOfs
2021-05-14 20:58:20 +00:00
>PUSHBI SEEK.SET
2020-08-25 10:56:00 +00:00
>SYSCALL FSeek
2019-10-16 15:23:29 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
>PUSHEA.G PAKME.TABLE
2019-10-29 14:47:25 +00:00
>LDA.G PAKME.HEADER+7
sta ZPChunkCnt
2019-10-16 15:23:29 +00:00
2019-10-29 14:47:25 +00:00
asl
tay
lda #0
>PUSHYA
2022-11-02 06:54:30 +00:00
2020-08-25 10:56:00 +00:00
>SYSCALL FRead
2019-10-16 15:23:29 +00:00
.9 rts
*--------------------------------------
2019-10-29 16:11:45 +00:00
CS.RUN.GetChunk lda ZPChunkIndex
2022-11-02 06:54:30 +00:00
2019-10-29 16:11:45 +00:00
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
2022-11-02 06:54:30 +00:00
2019-10-29 16:11:45 +00:00
iny
pla
sbc (pData),y
sta ZPChunkOfs+1
2019-10-30 16:29:46 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
2019-10-29 16:11:45 +00:00
>PUSHWZ
>PUSHW ZPChunkOfs
2021-05-14 20:58:20 +00:00
>PUSHBI SEEK.SET
2020-08-25 10:56:00 +00:00
>SYSCALL FSeek
2019-10-29 16:11:45 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
2019-10-29 16:11:45 +00:00
>PUSHEA.G CHUNK.HEADER
2021-05-14 20:58:20 +00:00
>PUSHWI 3
2020-08-25 10:56:00 +00:00
>SYSCALL FRead
2019-10-29 16:11:45 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-29 16:11:45 +00:00
>LDA.G CHUNK.HEADER
2019-10-30 16:29:46 +00:00
bne .90
2019-10-29 16:11:45 +00:00
>LDA.G CHUNK.HEADER+1
sta ZPChunkLen
2019-10-30 16:29:46 +00:00
pha
2019-10-29 16:11:45 +00:00
iny
lda (pData),y
sta ZPChunkLen+1
2019-10-30 16:29:46 +00:00
ply
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
jsr CS.RUN.GetSrcBufYA
bcs .9
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hSrcFile
2019-10-30 16:29:46 +00:00
>PUSHW ZPSrcBufPtr
2021-05-14 20:58:20 +00:00
>PUSHW ZPChunkLen
2020-08-25 10:56:00 +00:00
>SYSCALL FRead
2019-10-30 16:29:46 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
* clc
2019-10-29 16:11:45 +00:00
rts
.90 lda #MLI.E.INCFF
sec
2022-11-02 06:54:30 +00:00
.9 rts
2019-10-29 16:11:45 +00:00
*--------------------------------------
2019-10-30 16:29:46 +00:00
CS.RUN.GetSrcBufYA
2020-02-28 07:21:46 +00:00
>SYSCALL GetMem
2019-10-30 16:29:46 +00:00
bcs .9
stx hSrcBuf
>STYA ZPSrcBufPtr
2022-11-02 06:54:30 +00:00
.9 rts
2019-10-30 16:29:46 +00:00
*--------------------------------------
CS.RUN.Pak >LDYA ZPChunkLen
2020-02-28 07:21:46 +00:00
>SYSCALL GetMem
2019-10-30 16:29:46 +00:00
bcs .9
stx hDstBuf
>STYA ZPDstBufPtr
>PUSHEA.G PAKSTAT
>PUSHW ZPDstBufPtr
>PUSHW ZPChunkLen
>PUSHW ZPSrcBufPtr
>LIBCALL hLIB,LIBPAK.Pak
bcs .9
>STYA ZPChunkPakedLen
.9 rts
*--------------------------------------
2019-10-30 18:25:04 +00:00
CS.RUN.RewriteTable
2021-05-14 20:58:20 +00:00
>PUSHB hDstFile
2019-10-30 16:29:46 +00:00
>PUSHWZ
>PUSHW ZPDstTableOfs
2021-05-14 20:58:20 +00:00
>PUSHBI SEEK.SET
2020-08-25 10:56:00 +00:00
>SYSCALL FSeek
2019-10-30 18:25:04 +00:00
bcs CS.RUN.WriteTable.RTS
2019-10-30 16:29:46 +00:00
*--------------------------------------
CS.RUN.WriteTable
2021-05-14 20:58:20 +00:00
>PUSHB hDstFile
>PUSHEA.G PAKME.TABLE
2019-10-30 18:25:04 +00:00
>LDA.G PAKME.HEADER+7
2019-10-30 16:29:46 +00:00
asl
tay
lda #0
>PUSHYA
2020-08-25 10:56:00 +00:00
>SYSCALL FWrite
2022-11-02 06:54:30 +00:00
CS.RUN.WriteTable.RTS
2019-10-30 16:29:46 +00:00
rts
*--------------------------------------
CS.RUN.WritePak lda hDstFile
2020-08-25 10:56:00 +00:00
>SYSCALL FTell
2019-10-30 16:29:46 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
>PULLW ZPChunkNewOfs
inc pStack
inc pStack
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hDstFile
2019-10-30 16:29:46 +00:00
>PUSHW ZPDstBufPtr
2021-05-14 20:58:20 +00:00
>PUSHW ZPChunkPakedLen
2020-08-25 10:56:00 +00:00
>SYSCALL FWrite
2019-11-05 13:36:10 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2020-02-29 14:06:28 +00:00
>PUSHW L.MSG.PAKED
2019-11-05 13:36:10 +00:00
>PUSHW ZPChunkPakedLen
2020-02-29 14:06:28 +00:00
>PUSHW ZPChunkNewOfs
2019-11-05 13:36:10 +00:00
>PUSHBI 4
2022-11-02 06:54:30 +00:00
>SYSCALL PrintF
2019-11-05 13:36:10 +00:00
.9
CS.RUN.WritePak.RTS
rts
*--------------------------------------
CS.RUN.WriteStore
lda hDstFile
2020-08-25 10:56:00 +00:00
>SYSCALL FTell
2019-11-05 13:36:10 +00:00
bcs CS.RUN.WritePak.RTS
2022-11-02 06:54:30 +00:00
2019-11-05 13:36:10 +00:00
>PULLW ZPChunkNewOfs
inc pStack
inc pStack
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hDstFile
2019-11-05 13:36:10 +00:00
>PUSHEA.G CHUNK.HEADER
2021-05-14 20:58:20 +00:00
>PUSHWI 3
2020-08-25 10:56:00 +00:00
>SYSCALL FWrite
2019-11-05 13:36:10 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2021-05-14 20:58:20 +00:00
>PUSHB hDstFile
2019-11-05 13:36:10 +00:00
>PUSHW ZPSrcBufPtr
2021-05-14 20:58:20 +00:00
>PUSHW ZPChunkLen
2020-08-25 10:56:00 +00:00
>SYSCALL FWrite
2019-11-05 13:36:10 +00:00
bcs .9
2022-11-02 06:54:30 +00:00
2020-02-29 14:06:28 +00:00
>PUSHW L.MSG.STORE
2019-11-05 13:36:10 +00:00
>PUSHW ZPChunkLen
2020-02-29 14:06:28 +00:00
>PUSHW ZPChunkNewOfs
2019-11-05 13:36:10 +00:00
>PUSHBI 4
2022-11-02 06:54:30 +00:00
>SYSCALL PrintF
2019-10-30 16:29:46 +00:00
.9 rts
*--------------------------------------
CS.RUN.UpdateTable
ldy #PAKME.HEADER+6
lda (pData),y
pha
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
dey
lda (pData),y
pha
lda ZPChunkIndex
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
asl
clc
adc #PAKME.TABLE
tay
2019-10-30 18:25:04 +00:00
2019-10-30 16:29:46 +00:00
pla
clc
adc ZPChunkNewOfs
sta (pData),y
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
iny
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
pla
adc ZPChunkNewOfs+1
sta (pData),y
rts
*--------------------------------------
2019-10-16 15:23:29 +00:00
CS.DOEVENT sec
rts
*--------------------------------------
2019-10-29 14:47:25 +00:00
CS.QUIT lda hDstFile
2019-10-16 15:23:29 +00:00
beq .2
2020-02-28 07:21:46 +00:00
>SYSCALL FClose
2022-11-02 06:54:30 +00:00
2019-10-29 14:47:25 +00:00
.2 lda hSrcFile
2019-10-16 15:23:29 +00:00
beq .3
2020-02-28 07:21:46 +00:00
>SYSCALL FClose
2022-11-02 06:54:30 +00:00
2019-10-30 16:29:46 +00:00
.3 jsr CS.QUIT.BUF
2019-10-16 15:23:29 +00:00
2019-10-30 16:29:46 +00:00
lda hLIB
2019-10-16 15:23:29 +00:00
beq .8
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
>SYSCALL UnloadLib
2022-11-02 06:54:30 +00:00
2019-10-16 15:23:29 +00:00
.8 clc
rts
*--------------------------------------
2019-10-30 16:29:46 +00:00
CS.QUIT.BUF lda hDstBuf
beq .1
stz hDstBuf
>SYSCALL FreeMem
.1 lda hSrcBuf
beq .8
stz hSrcBuf
>SYSCALL FreeMem
2022-11-02 06:54:30 +00:00
.8 rts
2019-10-30 16:29:46 +00:00
*--------------------------------------
2019-10-16 15:23:29 +00:00
CS.END
*--------------------------------------
2022-11-02 06:54:30 +00:00
MSG.USAGE .CZ "Usage : PAKME SourceBIN PackedBIN\r\n"
MSG.SRCFILE .CZ "Source File : %s, Size=%5D, Org=$%H, %d Chunks at $%H.\r\n"
MSG.CHUNK .CZ " Chunk #%02d : Ofs=$%H, Len=%5D ... "
MSG.PAKED .CZ "PAKed : %5D Bytes, New Ofs=$%H\r\n"
MSG.STORE .CZ "Store : %5D Bytes, New Ofs=$%H\r\n"
MSG.E.IARC .CZ "Invalid/corrupt archive"
TAG .CZ "PAKME"
2019-10-16 15:23:29 +00:00
*--------------------------------------
2019-12-03 15:42:17 +00:00
LIBPAK .AZ "libpak"
2019-10-16 15:23:29 +00:00
hLIB .BS 1
*--------------------------------------
.DUMMY
.OR 0
DS.START
2019-10-29 14:47:25 +00:00
STATBUF .BS S.STAT
PAKME.HEADER .BS 10
PAKME.TABLE .BS CHUNK.MAX*2
2019-10-29 16:11:45 +00:00
CHUNK.HEADER .BS 3
2019-10-16 15:23:29 +00:00
PAKSTAT .BS S.PAKSTAT
DS.END .ED
*--------------------------------------
MAN
2020-08-25 10:56:00 +00:00
SAVE usr/src/bin/pakme.s
2019-10-16 15:23:29 +00:00
ASM