2019-04-03 05:51:28 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2019-04-03 05:51:28 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.TF bin/pak
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2019-09-19 15:22:14 +00:00
|
|
|
|
.INB INC/KERNEL.I
|
2019-09-25 15:34:43 +00:00
|
|
|
|
.INB INC/PAK.I
|
2019-09-23 14:08:17 +00:00
|
|
|
|
.INB INC/LIBPAK.I
|
2019-04-03 05:51:28 +00:00
|
|
|
|
.INB INC/MLI.E.I
|
|
|
|
|
*--------------------------------------
|
2019-04-30 16:08:47 +00:00
|
|
|
|
X.ENTER.SUBDIR .EQ 0
|
2019-04-03 05:51:28 +00:00
|
|
|
|
X.COPY.TO.DEST .EQ 0
|
|
|
|
|
X.DELETE.SOURCE .EQ 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
ZPFileName .BS 2
|
|
|
|
|
ZPFileStat .BS 2
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
2019-04-03 05:51:28 +00:00
|
|
|
|
ZPFullPath .BS 2
|
2019-09-19 15:22:14 +00:00
|
|
|
|
ZPRelPath .BS 2
|
|
|
|
|
|
2019-10-02 15:21:03 +00:00
|
|
|
|
ZPSrcBufPtr .BS 2
|
|
|
|
|
ZPDstBufPtr .BS 2
|
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
bAppend .BS 1
|
|
|
|
|
bRecurse .BS 1
|
|
|
|
|
bPause .BS 1
|
|
|
|
|
|
2019-04-03 05:51:28 +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
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.DA #64 Stack Size
|
2019-04-03 05:51:28 +00:00
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2019-09-25 15:34:43 +00:00
|
|
|
|
L.LIBPAK .DA LIBPAK
|
2019-04-03 05:51:28 +00:00
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.DIR .DA MSG.DIR
|
|
|
|
|
L.MSG.FILE .DA MSG.FILE
|
|
|
|
|
L.MSG.OK .DA MSG.OK
|
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
2019-09-23 14:08:17 +00:00
|
|
|
|
L.MSG.E.IARC .DA MSG.E.IARC
|
2019-09-19 15:22:14 +00:00
|
|
|
|
L.ARC.Header .DA ARC.Header
|
2019-04-03 05:51:28 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2019-09-25 15:34:43 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBPAK
|
|
|
|
|
>SYSCALL LoadLib
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
sta hLIB
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2019-04-05 05:59:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN >INC.G ArgIndex
|
2019-04-03 05:51:28 +00:00
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .8
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
jsr CS.RUN.CheckOpt
|
2020-02-29 14:06:28 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
bne CS.RUN
|
|
|
|
|
|
|
|
|
|
>INC.G ArgIndex -X
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>SYSCALL StrDup
|
|
|
|
|
bcs .9
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G hExclude
|
|
|
|
|
bra CS.RUN
|
|
|
|
|
|
|
|
|
|
.9 >PUSHW L.MSG.USAGE
|
|
|
|
|
>PUSHBI 0
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-04-03 05:51:28 +00:00
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
2019-04-05 05:59:06 +00:00
|
|
|
|
.99 rts
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.4 >LDA.G ArcName
|
|
|
|
|
bne .5
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G ArgIndex
|
|
|
|
|
>STA.G ArcName
|
|
|
|
|
bra CS.RUN
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.5 >LDA.G hSrcBasePath
|
2019-04-05 05:59:06 +00:00
|
|
|
|
bne .9
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr1
|
|
|
|
|
jsr InitSrcDirYA
|
2019-04-05 05:59:06 +00:00
|
|
|
|
bcc CS.RUN
|
2019-04-03 05:51:28 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.8 >LDA.G ArcName
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
beq .9
|
2020-02-29 14:06:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-17 15:31:18 +00:00
|
|
|
|
>LDYAI 256
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2019-04-03 05:51:28 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPFullPath
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hSrcFullPath
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
2019-10-28 16:20:40 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.80 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .80
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc ZPFullPath
|
|
|
|
|
sta ZPRelPath
|
|
|
|
|
lda ZPFullPath+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPRelPath+1
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.OpenArc
|
2019-10-02 15:21:03 +00:00
|
|
|
|
.98 bcs .99
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>LDYAI CHNK.SIZE
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2019-10-29 06:32:04 +00:00
|
|
|
|
bcs .98
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>STYA ZPSrcBufPtr
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hSrcBuf
|
|
|
|
|
|
|
|
|
|
>LDYAI CHNK.SIZE
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMem
|
2019-10-02 15:21:03 +00:00
|
|
|
|
bcs .98
|
|
|
|
|
>STYA ZPDstBufPtr
|
2019-09-19 15:22:14 +00:00
|
|
|
|
txa
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>STA.G hDstBuf
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-05 05:59:06 +00:00
|
|
|
|
CS.RUN.LOOP ldy #S.PS.hStdIn
|
2019-04-03 05:51:28 +00:00
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL feof
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .1
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #$03 Ctrl-C
|
2019-04-17 15:31:18 +00:00
|
|
|
|
beq .99 Abort....
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
|
|
|
|
cmp #$13 Ctrl-S
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bne .1
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
lda bPause
|
2019-04-03 05:51:28 +00:00
|
|
|
|
eor #$ff
|
2019-09-19 15:22:14 +00:00
|
|
|
|
sta bPause
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bne CS.RUN.LOOP
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
.1 lda bPause
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bne CS.RUN.LOOP Pause...
|
2019-09-23 14:08:17 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-03 05:51:28 +00:00
|
|
|
|
jsr GetEntry
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-29 14:47:25 +00:00
|
|
|
|
jsr FilterMatch
|
|
|
|
|
bcs .8 no match, skip....
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
jsr ExcludeMatch
|
|
|
|
|
bcc .8 match, skip
|
|
|
|
|
|
2020-04-13 17:04:02 +00:00
|
|
|
|
ldy #S.STAT.MODE+1
|
2019-04-03 05:51:28 +00:00
|
|
|
|
lda (ZPFileStat),y
|
2020-04-13 17:04:02 +00:00
|
|
|
|
and #$70
|
|
|
|
|
beq .6
|
|
|
|
|
|
|
|
|
|
cmp /S.STAT.MODE.DIR
|
|
|
|
|
bne .8
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
jsr CS.RUN.DIR
|
|
|
|
|
bcs .99
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bra .8
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.6 jsr CS.RUN.FILE
|
|
|
|
|
bcs .99
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bra .8
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
2019-04-03 05:51:28 +00:00
|
|
|
|
.9 jsr LeaveSubDir
|
2019-04-17 15:31:18 +00:00
|
|
|
|
bcs .90
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
|
|
|
|
jsr BasePath..
|
|
|
|
|
|
|
|
|
|
.8 jsr GetNextEntry
|
2019-04-17 15:31:18 +00:00
|
|
|
|
jmp CS.RUN.LOOP
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.90 lda #0
|
2019-04-03 05:51:28 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2019-04-17 15:31:18 +00:00
|
|
|
|
CS.RUN.DEV lda #E.BADPATH
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-09-19 15:22:14 +00:00
|
|
|
|
CS.RUN.DIR lda bRecurse
|
2019-08-26 06:29:18 +00:00
|
|
|
|
bpl .8
|
2020-04-13 17:04:02 +00:00
|
|
|
|
|
2019-08-26 06:29:18 +00:00
|
|
|
|
lda (ZPFileName)
|
2019-04-17 15:31:18 +00:00
|
|
|
|
cmp #'.'
|
2020-04-13 17:04:02 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPFileName),y
|
2019-04-17 15:31:18 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2020-04-13 17:04:02 +00:00
|
|
|
|
cmp #'.'
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPFileName),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.1 jsr CS.RUN.BuildFilePath
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
>PUSHW L.MSG.DIR
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>PUSHW ZPRelPath
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-04-03 05:51:28 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcHdrDir
|
2019-09-19 15:22:14 +00:00
|
|
|
|
bcs .9
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
|
|
|
|
>LDYA ZPFileName
|
2019-09-19 15:22:14 +00:00
|
|
|
|
jsr EnterSubDirYA
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
.9 jmp CS.RUN.CheckErr
|
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.8 clc
|
2019-09-19 15:22:14 +00:00
|
|
|
|
rts
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-29 14:47:25 +00:00
|
|
|
|
CS.RUN.FILE jsr CS.RUN.BuildFilePath
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>PUSHW ZPFullPath
|
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
tay
|
2019-09-23 14:08:17 +00:00
|
|
|
|
lda OF.Table.hPath-1,y
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL GetMemptr
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>SYSCALL strcmp
|
|
|
|
|
bcc .8
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
>PUSHW L.MSG.FILE
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>PUSHW ZPRelPath
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
|
|
|
|
>PUSHBI 2
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-04-03 05:51:28 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcHdrFile
|
2019-09-19 15:22:14 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.OpenFile
|
|
|
|
|
bcs .9
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
.1 lda #'.'
|
|
|
|
|
>SYSCALL putchar
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.ReadFile
|
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
cmp #MLI.E.EOF
|
|
|
|
|
bne .4
|
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
jsr CS.RUN.CloseFile
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
|
|
|
|
bra .9
|
|
|
|
|
|
2019-10-02 15:21:03 +00:00
|
|
|
|
.2 jsr CS.RUN.Pak
|
2019-10-14 15:58:16 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.WritePakData
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
bra .4
|
|
|
|
|
|
|
|
|
|
.3 jsr CS.RUN.WriteSrcData
|
2019-09-23 14:08:17 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.4 pha
|
|
|
|
|
jsr CS.RUN.CloseFile
|
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.9 jmp CS.RUN.CheckErr
|
2019-04-03 05:51:28 +00:00
|
|
|
|
|
2019-04-17 15:31:18 +00:00
|
|
|
|
.8 clc
|
2019-09-19 15:22:14 +00:00
|
|
|
|
rts
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckErr bcs .1
|
|
|
|
|
>LDYA L.MSG.OK
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-04-03 05:51:28 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 pha
|
2020-02-29 14:06:28 +00:00
|
|
|
|
>PUSHW L.MSG.ERR
|
|
|
|
|
pla
|
|
|
|
|
pha
|
2019-04-03 05:51:28 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PrintF
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
2019-04-03 05:51:28 +00:00
|
|
|
|
pla
|
2019-09-19 15:22:14 +00:00
|
|
|
|
sec
|
2019-04-03 05:51:28 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-29 14:47:25 +00:00
|
|
|
|
CS.RUN.BuildFilePath
|
2019-04-03 05:51:28 +00:00
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
>LDYA ZPFullPath
|
|
|
|
|
|
|
|
|
|
>SYSCALL StrCpy
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPFileName
|
|
|
|
|
>LDYA ZPFullPath
|
|
|
|
|
>SYSCALL StrCat
|
2019-10-29 14:47:25 +00:00
|
|
|
|
|
2019-04-03 05:51:28 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-02-29 14:06:28 +00:00
|
|
|
|
CS.RUN.OpenFile >PUSHW ZPFullPath
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>PUSHBI O.RDONLY
|
2020-02-29 14:06:28 +00:00
|
|
|
|
>PUSHBI 0 Type
|
|
|
|
|
>PUSHWZ Aux type
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STA.G hFile
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.ReadFile >PUSHWI CHNK.SIZE
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>PUSHW ZPSrcBufPtr
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>LDA.G hFile
|
|
|
|
|
>SYSCALL fread
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>STYA.G Shunk.SrcSize
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CloseFile
|
|
|
|
|
>LDA.G hFile
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2019-09-23 14:08:17 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STZ.G hFile
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-10-02 15:21:03 +00:00
|
|
|
|
CS.RUN.Pak >PUSHEA.G PAKSTAT
|
|
|
|
|
>PUSHW ZPDstBufPtr
|
|
|
|
|
>PUSHW.G Shunk.SrcSize
|
|
|
|
|
>PUSHW ZPSrcBufPtr
|
|
|
|
|
>LIBCALL hLIB,LIBPAK.Pak
|
2019-10-16 14:31:49 +00:00
|
|
|
|
bcs .9
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>STYA.G Shunk.DstSize
|
2019-10-16 14:31:49 +00:00
|
|
|
|
.9 rts
|
2019-10-02 15:21:03 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-29 14:06:28 +00:00
|
|
|
|
CS.RUN.OpenArc >LDA.G ArcName
|
|
|
|
|
>SYSCALL Argv
|
|
|
|
|
>PUSHYA
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
|
|
|
|
bit bAppend
|
2019-10-28 06:32:12 +00:00
|
|
|
|
bmi CS.RUN.AppendArc
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>PUSHBI O.CREATE+O.WRONLY
|
2020-02-29 14:06:28 +00:00
|
|
|
|
>PUSHBI $CF PAK
|
|
|
|
|
>PUSHWZ Aux type
|
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>SYSCALL FOpen
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STA.G hArcFile
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
>PUSHW L.ARC.Header
|
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
>SYSCALL fputs
|
2019-10-28 06:32:12 +00:00
|
|
|
|
.9
|
|
|
|
|
CS.RUN.OpenArc.RTS
|
|
|
|
|
rts
|
2019-09-19 15:22:14 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-28 06:32:12 +00:00
|
|
|
|
CS.RUN.AppendArc
|
|
|
|
|
>PUSHBI O.RDWR+O.APPEND
|
2020-02-29 14:06:28 +00:00
|
|
|
|
>PUSHBI $CF PAK
|
|
|
|
|
>PUSHWZ Aux type
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL FOpen
|
2019-10-28 06:32:12 +00:00
|
|
|
|
bcs CS.RUN.OpenArc.RTS
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>STA.G hArcFile
|
2019-10-28 06:32:12 +00:00
|
|
|
|
rts
|
2020-02-29 14:06:28 +00:00
|
|
|
|
|
|
|
|
|
|
2019-10-28 06:32:12 +00:00
|
|
|
|
>PUSHBI SEEK.SET
|
|
|
|
|
>PUSHWI 0
|
|
|
|
|
>PUSHWI 0
|
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
>SYSCALL fseek
|
|
|
|
|
bcs CS.RUN.OpenArc.RTS
|
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>PUSHWI 3
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>PUSHW ZPSrcBufPtr
|
2019-10-28 06:32:12 +00:00
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>SYSCALL fread
|
2019-09-19 15:22:14 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
cpy #3
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
.2 lda ARC.Header,y
|
2019-10-02 15:21:03 +00:00
|
|
|
|
cmp (ZPSrcBufPtr),y
|
2019-09-23 14:08:17 +00:00
|
|
|
|
bne .99
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
>PUSHBI SEEK.END
|
|
|
|
|
>PUSHWI 0
|
|
|
|
|
>PUSHWI 0
|
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
>SYSCALL fseek
|
2019-10-28 06:32:12 +00:00
|
|
|
|
* bcc .9
|
|
|
|
|
* cmp #MLI.E.EOF
|
|
|
|
|
* bne .99
|
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
|
|
|
|
.99 >LDYA L.MSG.E.IARC
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL PutS
|
2019-09-23 14:08:17 +00:00
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.WriteArcHdrDir
|
|
|
|
|
lda #CHNK.T.DIR
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcc CS.RUN.WriteArcHdr
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
CS.RUN.WriteArcHdrFile
|
|
|
|
|
lda #CHNK.T.FILE
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs CS.RUN.WriteArcHdr.9
|
|
|
|
|
|
|
|
|
|
ldy #S.STAT.P.TYPE
|
|
|
|
|
jsr CS.RUN.WriteArcByteY
|
|
|
|
|
bcs CS.RUN.WriteArcHdr.9
|
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
ldy #S.STAT.P.AUXTYPE
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcByteY
|
|
|
|
|
bcs CS.RUN.WriteArcHdr.9
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.STAT.P.AUXTYPE+1
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcByteY
|
|
|
|
|
bcs CS.RUN.WriteArcHdr.9
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
2019-09-23 14:08:17 +00:00
|
|
|
|
CS.RUN.WriteArcHdr
|
2019-09-19 15:22:14 +00:00
|
|
|
|
ldy #$ff
|
2020-04-13 17:04:02 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPRelPath),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
tya
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs CS.RUN.WriteArcHdr.9
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPRelPath
|
|
|
|
|
>LDA.G hArcFile
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>SYSCALL fputs
|
|
|
|
|
|
|
|
|
|
CS.RUN.WriteArcHdr.9
|
2019-09-19 15:22:14 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-14 15:58:16 +00:00
|
|
|
|
CS.RUN.WriteSrcData
|
2019-09-23 14:08:17 +00:00
|
|
|
|
lda #CHNK.T.DATA
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
2019-09-19 15:22:14 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-14 15:58:16 +00:00
|
|
|
|
>LDA.G Shunk.SrcSize
|
2019-10-17 10:36:45 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #3
|
|
|
|
|
pha
|
|
|
|
|
>LDA.G Shunk.SrcSize+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
pla
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
2019-09-20 15:15:06 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-17 10:36:45 +00:00
|
|
|
|
lda ZPPtr1+1
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
2019-10-02 15:21:03 +00:00
|
|
|
|
bcs .9
|
2019-09-23 14:08:17 +00:00
|
|
|
|
|
2019-10-14 15:58:16 +00:00
|
|
|
|
lda #0 NO COMPRESSION
|
2019-09-23 14:08:17 +00:00
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs .9
|
2019-10-15 15:33:51 +00:00
|
|
|
|
|
2019-10-17 10:36:45 +00:00
|
|
|
|
>LDA.G Shunk.SrcSize
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDA.G Shunk.SrcSize+1
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-14 15:58:16 +00:00
|
|
|
|
>PUSHW.G Shunk.SrcSize
|
|
|
|
|
>PUSHW ZPSrcBufPtr
|
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
>SYSCALL fwrite
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.WritePakData
|
|
|
|
|
lda #CHNK.T.DATA
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDA.G Shunk.DstSize
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDA.G Shunk.DstSize+1
|
|
|
|
|
jsr CS.RUN.WriteArcByteA
|
|
|
|
|
bcs .9
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2019-10-02 15:21:03 +00:00
|
|
|
|
>PUSHW.G Shunk.DstSize
|
|
|
|
|
>PUSHW ZPDstBufPtr
|
2019-09-23 14:08:17 +00:00
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
>SYSCALL fwrite
|
2019-09-20 15:15:06 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-09-23 14:08:17 +00:00
|
|
|
|
CS.RUN.WriteArcByteY
|
|
|
|
|
lda (ZPFileStat),y
|
|
|
|
|
|
|
|
|
|
CS.RUN.WriteArcByteA
|
|
|
|
|
>PUSHA
|
|
|
|
|
>LDA.G hArcFile
|
|
|
|
|
>SYSCALL fputc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-04-03 05:51:28 +00:00
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT jsr LeaveSubDir
|
|
|
|
|
bcc CS.QUIT
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
ldy #hExclude
|
|
|
|
|
jsr .7
|
|
|
|
|
ldy #hFilter
|
|
|
|
|
jsr .7
|
|
|
|
|
ldy #hSrcFullPath
|
|
|
|
|
jsr .7
|
|
|
|
|
ldy #hDstBuf
|
|
|
|
|
jsr .7
|
|
|
|
|
ldy #hSrcBuf
|
|
|
|
|
jsr .7
|
|
|
|
|
|
|
|
|
|
>LDA.G hArcFile
|
2019-04-03 05:51:28 +00:00
|
|
|
|
beq .1
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FClose
|
2019-10-02 15:21:03 +00:00
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.1 lda hLIB
|
|
|
|
|
beq .2
|
2019-09-25 15:34:43 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL UnloadLib
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.2 clc
|
2019-04-03 05:51:28 +00:00
|
|
|
|
rts
|
2020-02-29 14:06:28 +00:00
|
|
|
|
|
|
|
|
|
.7 lda (pData),y
|
|
|
|
|
beq .8
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
.8 rts
|
2019-09-19 15:22:14 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckOpt ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx #OptionVars-OptionList-1
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.1 cmp OptionList,x
|
|
|
|
|
beq .2
|
2019-09-19 15:22:14 +00:00
|
|
|
|
dex
|
2020-02-29 14:06:28 +00:00
|
|
|
|
bpl .1
|
2019-09-19 15:22:14 +00:00
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.2 ldy OptionVars,x
|
|
|
|
|
beq .8
|
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
sta 0,y
|
2020-02-29 14:06:28 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2019-09-19 15:22:14 +00:00
|
|
|
|
rts
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB USR/SRC/BIN/X.FILEENUM.S
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2020-02-29 14:06:28 +00:00
|
|
|
|
OptionList .AS "AaRrXx"
|
|
|
|
|
OptionVars .DA #bAppend,#bAppend,#bRecurse,#bRecurse,#0,#0
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MSG.USAGE .AS "Usage : PAK Archive [File *,? wildcards allowed]\r\n"
|
2019-09-19 15:22:14 +00:00
|
|
|
|
.AS " -A : Append to archive\r\n"
|
2020-02-29 14:06:28 +00:00
|
|
|
|
.AS " -R : Recurse subdirectories\r\n"
|
|
|
|
|
.AZ " -X <*,? wildcards allowed> : exclude files \r\n"
|
2019-04-03 05:51:28 +00:00
|
|
|
|
MSG.OK .AZ "[OK]"
|
|
|
|
|
MSG.ERR .AZ "[%h]\r\n"
|
2019-09-23 14:08:17 +00:00
|
|
|
|
MSG.E.IARC .AZ "Invalid/corrupt archive"
|
2019-04-17 15:31:18 +00:00
|
|
|
|
MSG.DIR .AZ "Reading Dir:%s..."
|
|
|
|
|
MSG.FILE .AZ "Adding File:%s..."
|
2019-09-19 15:22:14 +00:00
|
|
|
|
ARC.Header .AZ "PAK"
|
2019-09-25 15:34:43 +00:00
|
|
|
|
*--------------------------------------
|
2019-12-10 16:06:51 +00:00
|
|
|
|
LIBPAK .AZ "libpak"
|
2019-09-25 15:34:43 +00:00
|
|
|
|
hLIB .BS 1
|
2019-04-03 05:51:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
ArgIndex .BS 1
|
2019-04-17 15:31:18 +00:00
|
|
|
|
ArcName .BS 1
|
2019-04-03 05:51:28 +00:00
|
|
|
|
hSrcFullPath .BS 1
|
2019-10-02 15:21:03 +00:00
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
hFile .BS 1
|
2019-10-02 15:21:03 +00:00
|
|
|
|
hArcFile .BS 1
|
2019-04-17 15:31:18 +00:00
|
|
|
|
|
2019-10-02 15:21:03 +00:00
|
|
|
|
hSrcBuf .BS 1
|
|
|
|
|
hDstBuf .BS 1
|
|
|
|
|
|
|
|
|
|
Shunk.SrcSize .BS 2
|
|
|
|
|
Shunk.DstSize .BS 2
|
|
|
|
|
|
|
|
|
|
PAKSTAT .BS S.PAKSTAT
|
|
|
|
|
|
2019-09-19 15:22:14 +00:00
|
|
|
|
.INB USR/SRC/BIN/X.FILEENUM.G
|
2019-04-03 05:51:28 +00:00
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE USR/SRC/BIN/PAK.S
|
|
|
|
|
ASM
|