2015-03-14 21:47:37 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF BIN/CHTYP
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2018-12-20 07:33:10 +00:00
|
|
|
|
.INB INC/MLI.I
|
2018-10-02 15:52:30 +00:00
|
|
|
|
.INB INC/MLI.E.I
|
2017-04-03 15:35:03 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-30 16:08:47 +00:00
|
|
|
|
X.ENTER.SUBDIR .EQ 0
|
2017-04-03 15:35:03 +00:00
|
|
|
|
X.COPY.TO.DEST .EQ 0
|
|
|
|
|
X.DELETE.SOURCE .EQ 0
|
2016-03-18 16:35:27 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPtr1 .EQ ZPBIN
|
|
|
|
|
ZPPtr2 .EQ ZPBIN+2
|
2017-04-03 15:35:03 +00:00
|
|
|
|
ZPFileName .EQ ZPBIN+4
|
|
|
|
|
ZPFileStat .EQ ZPBIN+6
|
2017-10-04 15:12:03 +00:00
|
|
|
|
ZPFullPath .EQ ZPBIN+8
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #16 SS
|
|
|
|
|
.DA #10 ZP
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2016-03-18 16:35:27 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2016-03-18 16:35:27 +00:00
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
2017-04-03 21:13:46 +00:00
|
|
|
|
L.MSG.FILE .DA MSG.FILE
|
2016-03-18 16:35:27 +00:00
|
|
|
|
L.MSG.OK .DA MSG.OK
|
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
2017-10-04 15:12:03 +00:00
|
|
|
|
L.PRODOS.FT.TXT .DA PRODOS.FT.TXT
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2017-10-04 15:12:03 +00:00
|
|
|
|
CS.INIT
|
|
|
|
|
.1 >INC.G ArgCount
|
2018-10-16 15:48:03 +00:00
|
|
|
|
>SYSCALL ArgV
|
2017-10-04 15:12:03 +00:00
|
|
|
|
bcs .7
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
2017-04-03 15:35:03 +00:00
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
2017-10-04 15:12:03 +00:00
|
|
|
|
ldy #1
|
2017-04-03 15:35:03 +00:00
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx OptionList
|
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2018-08-23 15:16:20 +00:00
|
|
|
|
.99 >PUSHBI 0
|
|
|
|
|
>LDYA L.MSG.USAGE
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2017-04-03 21:13:46 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-04-03 15:35:03 +00:00
|
|
|
|
.3 ldy OptionVars-1,x
|
|
|
|
|
lda #$80
|
2016-03-18 16:35:27 +00:00
|
|
|
|
sta (pData),y
|
2017-04-03 15:35:03 +00:00
|
|
|
|
bra .1
|
2017-04-03 21:13:46 +00:00
|
|
|
|
.4 ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .5
|
|
|
|
|
>LDYA ZPPtr1
|
2017-04-03 15:35:03 +00:00
|
|
|
|
jsr InitSrcDirYA
|
2017-04-03 21:13:46 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
rts
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.5 ldy #HexFileType
|
2017-04-03 21:13:46 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .99
|
|
|
|
|
jsr GetHexFileType
|
|
|
|
|
bcs .99
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.7 ldy #index processed all args
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .99 , no src ? ERROR
|
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
ldy #HexFileType
|
2017-04-03 21:13:46 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .99 we also have a TYPE
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>LDYAI 256
|
2018-07-20 11:51:08 +00:00
|
|
|
|
>SYSCALL getmem
|
2017-10-04 15:12:03 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPFullPath
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hSrcFullPath
|
2017-04-03 21:13:46 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2019-03-19 16:52:08 +00:00
|
|
|
|
CS.RUN ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>SYSCALL feof
|
|
|
|
|
bcs .99
|
|
|
|
|
tay
|
2019-05-02 09:52:32 +00:00
|
|
|
|
bne .10
|
2019-03-19 16:52:08 +00:00
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .99
|
2017-04-03 15:35:03 +00:00
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
beq .92 Abort....
|
|
|
|
|
cmp #$13 Ctrl-S
|
|
|
|
|
bne .10
|
|
|
|
|
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>LDA.G bPause
|
2017-04-03 15:35:03 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bne .80
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.10 >LDA.G bPause
|
2017-04-03 15:35:03 +00:00
|
|
|
|
bne .80 Pause...
|
|
|
|
|
jsr GetEntry
|
|
|
|
|
bcs .9
|
2019-04-30 16:08:47 +00:00
|
|
|
|
jsr FilterMatch
|
2017-04-03 15:35:03 +00:00
|
|
|
|
bcs .8 no match, skip....
|
2019-04-30 16:08:47 +00:00
|
|
|
|
ldy #S.STAT.P.DRIVE
|
2017-04-03 15:35:03 +00:00
|
|
|
|
lda (ZPFileStat),y ProDOS Device ?
|
2018-08-24 10:20:23 +00:00
|
|
|
|
bne CS.RUN.DEV
|
2017-04-03 15:35:03 +00:00
|
|
|
|
ldy #S.STAT.P.TYPE
|
|
|
|
|
lda (ZPFileStat),y
|
|
|
|
|
cmp #$0F Directory ?
|
2018-08-24 10:20:23 +00:00
|
|
|
|
bne CS.RUN.FILE
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2017-04-03 15:35:03 +00:00
|
|
|
|
jmp CS.RUN.DIR
|
|
|
|
|
.9 jsr LeaveSubDir
|
|
|
|
|
bcs .92
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2017-04-03 15:35:03 +00:00
|
|
|
|
jsr BasePath..
|
|
|
|
|
.8 jsr GetNextEntry
|
|
|
|
|
.80 clc
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
2017-04-03 15:35:03 +00:00
|
|
|
|
.92 lda #0
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2017-04-03 21:13:46 +00:00
|
|
|
|
CS.RUN.DIR
|
|
|
|
|
CS.RUN.DEV
|
2017-04-03 15:35:03 +00:00
|
|
|
|
.8 jsr GetNextEntry
|
2019-10-03 06:25:27 +00:00
|
|
|
|
clc.9
|
|
|
|
|
rts
|
2017-04-03 15:35:03 +00:00
|
|
|
|
*--------------------------------------
|
2017-04-03 21:13:46 +00:00
|
|
|
|
CS.RUN.FILE jsr CS.RUN.GetFilePath
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>PUSHW ZPFullPath
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 2
|
2017-04-03 21:13:46 +00:00
|
|
|
|
>LDYA L.MSG.FILE
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-04-03 21:13:46 +00:00
|
|
|
|
bcs .9
|
2017-04-04 13:07:58 +00:00
|
|
|
|
ldy #HexFileType
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
|
2018-09-05 15:22:46 +00:00
|
|
|
|
>LDYA ZPFullPath
|
2017-04-04 13:07:58 +00:00
|
|
|
|
>SYSCALL ChTyp
|
2017-04-03 21:13:46 +00:00
|
|
|
|
jsr CS.RUN.CheckErr
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>LDA.G bRecurse
|
2017-04-04 13:07:58 +00:00
|
|
|
|
bpl .8
|
2017-10-04 15:12:03 +00:00
|
|
|
|
lda (ZPFileName)
|
2017-04-04 13:07:58 +00:00
|
|
|
|
cmp #'.'
|
|
|
|
|
beq .8
|
|
|
|
|
>LDYA ZPFileName
|
|
|
|
|
jsr EnterSubDirYA
|
|
|
|
|
rts
|
2017-04-03 15:35:03 +00:00
|
|
|
|
.8 jsr GetNextEntry
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-04-03 21:13:46 +00:00
|
|
|
|
CS.RUN.CheckErr bcs .1
|
|
|
|
|
>LDYA L.MSG.OK
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>SYSCALL puts
|
2017-04-03 21:13:46 +00:00
|
|
|
|
rts
|
|
|
|
|
.1 pha
|
|
|
|
|
>PUSHA
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 1
|
2017-04-03 21:13:46 +00:00
|
|
|
|
>LDYA L.MSG.ERR
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2018-11-28 11:39:33 +00:00
|
|
|
|
>LDA.G bContinue
|
|
|
|
|
eor #$80
|
|
|
|
|
asl
|
2017-04-03 21:13:46 +00:00
|
|
|
|
pla
|
2018-11-28 11:39:33 +00:00
|
|
|
|
rts
|
2017-04-03 21:13:46 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.GetFilePath
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>LDA.G hSrcBasePath
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2017-04-03 21:13:46 +00:00
|
|
|
|
>PUSHYA
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>LDYA ZPFullPath
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>SYSCALL StrCpy
|
2017-04-03 21:13:46 +00:00
|
|
|
|
>PUSHW ZPFileName
|
2018-07-16 05:52:52 +00:00
|
|
|
|
>LDYA ZPFullPath
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>SYSCALL StrCat
|
2017-04-03 21:13:46 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-04-03 15:35:03 +00:00
|
|
|
|
CS.DOEVENT sec
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-04-03 15:35:03 +00:00
|
|
|
|
CS.QUIT jsr LeaveSubDir
|
|
|
|
|
bcc CS.QUIT
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>LDA.G hFilter
|
|
|
|
|
beq .1
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.1 >LDA.G hSrcFullPath
|
|
|
|
|
beq .8
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.8 clc
|
2016-03-18 16:35:27 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-04 15:12:03 +00:00
|
|
|
|
GetHexFileType ldy #$ff
|
|
|
|
|
|
|
|
|
|
.10 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .10
|
2019-03-19 16:52:08 +00:00
|
|
|
|
|
2017-10-04 15:12:03 +00:00
|
|
|
|
cpy #3
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bne .9
|
2017-10-04 15:12:03 +00:00
|
|
|
|
lda (ZPPtr1)
|
2017-04-03 21:13:46 +00:00
|
|
|
|
cmp #'0'
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bne .1
|
2019-03-19 16:52:08 +00:00
|
|
|
|
ldy #1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2019-03-19 16:52:08 +00:00
|
|
|
|
jsr IsDigit16
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>STA.G HexFileType
|
2019-03-19 16:52:08 +00:00
|
|
|
|
ldy #2
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2019-03-19 16:52:08 +00:00
|
|
|
|
jsr IsDigit16
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bcs .9
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>ORA.G HexFileType
|
2016-03-18 16:35:27 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 ldx #0
|
|
|
|
|
>LDYA L.PRODOS.FT.TXT
|
|
|
|
|
>STYA ZPPtr2
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.2 ldy #2
|
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.21 lda (ZPPtr1),y
|
|
|
|
|
cmp #'a'
|
2017-10-04 15:12:03 +00:00
|
|
|
|
bcc .4
|
2016-03-18 16:35:27 +00:00
|
|
|
|
cmp #'z'+1
|
2017-10-04 15:12:03 +00:00
|
|
|
|
bcs .4
|
2016-03-18 16:35:27 +00:00
|
|
|
|
eor #$20
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.4 cmp (ZPPtr2),y
|
|
|
|
|
bne .5
|
2016-03-18 16:35:27 +00:00
|
|
|
|
dey
|
2017-10-04 15:12:03 +00:00
|
|
|
|
bpl .21
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda PRODOS.FT.ID,x
|
2017-10-04 15:12:03 +00:00
|
|
|
|
>STA.G HexFileType
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-10-04 15:12:03 +00:00
|
|
|
|
.5 clc
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda ZPPtr2
|
|
|
|
|
adc #3
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
lda ZPPtr2+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPtr2+1
|
|
|
|
|
inx
|
|
|
|
|
cpx #PRODOS.FT.COUNT
|
|
|
|
|
bne .2
|
2019-03-19 16:52:08 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
IsDigit16 cmp #'0'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcc .8
|
|
|
|
|
cmp #'A'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'F'+1
|
|
|
|
|
bcc .1
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'f'+1
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
eor #$20
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.1
|
2019-03-19 16:52:08 +00:00
|
|
|
|
* clc
|
|
|
|
|
sbc #'A'-11 cc so A->10 (11-CC)
|
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.8 and #$0F
|
2019-03-19 16:52:08 +00:00
|
|
|
|
rts
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2017-04-03 15:35:03 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-17 17:17:13 +00:00
|
|
|
|
.INB USR/SRC/BIN/X.FILEENUM.S
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2017-04-03 15:35:03 +00:00
|
|
|
|
*--------------------------------------
|
2017-06-25 12:04:33 +00:00
|
|
|
|
OptionList >PSTR "CRcr"
|
|
|
|
|
OptionVars .DA #bContinue,#bRecurse,#bContinue,#bRecurse
|
2017-04-03 15:35:03 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-19 20:16:43 +00:00
|
|
|
|
MSG.USAGE .AS "Usage : CHTYP [File *,? wildcards allowed] [File type]\r\n"
|
|
|
|
|
.AS " File types : 0xx (Hexadecimal byte),SYS,TXT...\r\n"
|
|
|
|
|
.AS " -C : Continue on error\r\n"
|
|
|
|
|
.AZ " -R : Recurse subdirectories\r\n"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
MSG.OK .AZ "[OK]"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.ERR .AZ "[%h]\r\n"
|
|
|
|
|
MSG.FILE .AZ "CHTYP File:%S..."
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2018-08-24 10:20:23 +00:00
|
|
|
|
PRODOS.FT.COUNT .EQ 6
|
|
|
|
|
PRODOS.FT.ID .HS 0406FAFCFDFF
|
2016-03-18 16:35:27 +00:00
|
|
|
|
PRODOS.FT.TXT .AS "TXT"
|
|
|
|
|
.AS "BIN"
|
2018-08-24 10:20:23 +00:00
|
|
|
|
.AS "ASM"
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.AS "BAS"
|
|
|
|
|
.AS "VAR"
|
|
|
|
|
.AS "SYS"
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2015-03-14 21:47:37 +00:00
|
|
|
|
DS.START
|
2017-10-04 15:12:03 +00:00
|
|
|
|
ArgCount .BS 1
|
|
|
|
|
|
|
|
|
|
hSrcFullPath .BS 1
|
2017-04-03 15:35:03 +00:00
|
|
|
|
bPause .BS 1
|
2017-04-03 21:13:46 +00:00
|
|
|
|
bContinue .BS 1
|
2017-04-03 15:35:03 +00:00
|
|
|
|
bRecurse .BS 1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
HexFileType .BS 1
|
2019-09-20 15:15:06 +00:00
|
|
|
|
|
|
|
|
|
.INB USR/SRC/BIN/X.FILEENUM.G
|
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
DS.END
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.ED
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/BIN/CHTYP.S
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ASM
|