2015-03-14 21:47:37 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:47:37 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.TF /A2OSX.BOOT/BIN/CHTYP
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2016-03-18 16:35:27 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPtr1 .EQ ZPBIN
|
|
|
|
|
ZPPtr2 .EQ ZPBIN+2
|
|
|
|
|
ZPPtr3 .EQ ZPBIN+4
|
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
|
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.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
|
|
|
|
|
L.MSG.OK .DA MSG.OK
|
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
|
|
|
|
L.FullPath .DA FullPath
|
|
|
|
|
L.PRODOS.FT.TXT .DA PRODOS.FT.TXT-1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-03-18 16:35:27 +00:00
|
|
|
|
CS.INIT ldy #S.PS.hARGS
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2016-03-18 16:35:27 +00:00
|
|
|
|
beq .98
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI $20 Push SEP=' '
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>PUSHBI 0 Push 0 for getting CMD & ARGS
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.PStrGetTkn
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldy #hArg1
|
|
|
|
|
sta (pData),y
|
|
|
|
|
txa
|
|
|
|
|
beq .98
|
|
|
|
|
ldy #hArg2
|
|
|
|
|
sta (pData),y
|
2016-03-20 22:17:05 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
jsr GetHexFileTypeA
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldy #hArg1
|
|
|
|
|
lda (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
beq .98
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ldy #1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'/'
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bne .10
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ldy #S.PS.hARGS
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
bra .3
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
.10 ldy #S.PS.hARGS
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
ldy #S.PS.hPREFIX
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>SYSCALL SYS.PStrCat
|
|
|
|
|
sta hDIRPATH
|
|
|
|
|
|
2016-06-24 06:02:32 +00:00
|
|
|
|
.3 >SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>SYSCALL SYS.ListDirInitYA
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
ldy #hS.LISTDIR
|
|
|
|
|
sta (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pPs)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sta (pPs)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.98 >LDYA L.MSG.USAGE
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>SYSCALL SYS.PStrOutYA
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.99 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-18 16:35:27 +00:00
|
|
|
|
CS.RUN ldy #bCANCEL
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .10
|
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.10 ldy #bSTOP
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.99 rts
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.1 ldy #hS.LISTDIR
|
|
|
|
|
lda (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.ListDirNextA
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bcs .99
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
pha
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
and #$0F
|
2016-03-18 16:35:27 +00:00
|
|
|
|
sta (ZPPtr1) Adjust Filename len
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
and #$F0
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bne .8 skip VOLHeader ($f),DIRHeader ($e),DIR ($d)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
ldy #hS.LISTDIR
|
|
|
|
|
lda (pData),y
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPtr2
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
ldy #S.LISTDIR.hPATH
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPtr2
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
tax
|
|
|
|
|
tay
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.2 lda (ZPPtr2),y
|
|
|
|
|
sta FullPath,y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
dey
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bne .2
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
.3 inx
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta FullPath,x
|
|
|
|
|
tya
|
|
|
|
|
cmp (ZPPtr1)
|
|
|
|
|
bne .3
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
stx FullPath
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>LDYA L.FullPath
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>SYSCALL SYS.PStrOutYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>LDYA L.FullPath
|
|
|
|
|
>SYSCALL SYS.MLIGetFileInfoYA
|
|
|
|
|
bcs .5
|
|
|
|
|
>STYA ZPPtr3
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>LDYA L.MSG.OK
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>SYSCALL SYS.PStrOutYA
|
2016-03-18 16:35:27 +00:00
|
|
|
|
bra .8
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.5 >PUSHA
|
|
|
|
|
>LDYA L.MSG.ERR
|
2016-09-21 15:20:37 +00:00
|
|
|
|
>SYSCALL SYS.PStrOutYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.8 pla
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
clc
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
ldy #S.PS.hINDEV
|
2015-11-22 22:30:06 +00:00
|
|
|
|
cmp (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bne .9
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
lda (pEvent)
|
|
|
|
|
and #S.EVT.F.KEY is it a KEY event?
|
|
|
|
|
beq .9
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
bne .9
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
bne .1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
lda #$FF
|
2016-03-18 16:35:27 +00:00
|
|
|
|
ldy #bCANCEL
|
|
|
|
|
sta (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bra .8
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 cmp #$13 Ctrl-S
|
|
|
|
|
bne .8
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
|
|
|
|
ldy #bSTOP
|
|
|
|
|
lda (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
eor #$FF
|
2016-03-18 16:35:27 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2015-03-14 21:47:37 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-18 16:35:27 +00:00
|
|
|
|
CS.QUIT ldy #hS.LISTDIR
|
|
|
|
|
lda (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
beq .1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
>SYSCALL SYS.ListDirCloseA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.1 ldy #hDIRPATH
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .2
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.2 ldy #hArg2
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .3
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.3 ldy #hArg1
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .8
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
GetHexFileTypeA >SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #3
|
|
|
|
|
bne .9
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'$'
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'0'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcs .9
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta Tmp
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'0'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcs .9
|
|
|
|
|
and #$F
|
|
|
|
|
ora Tmp
|
|
|
|
|
ldy #HexFileType
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 ldx #0
|
|
|
|
|
>LDYA L.PRODOS.FT.TXT
|
|
|
|
|
>STYA ZPPtr2
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
.2 ldy #3
|
|
|
|
|
.21 lda (ZPPtr1),y
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .3
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
bcs .3
|
|
|
|
|
eor #$20
|
|
|
|
|
|
|
|
|
|
.3 cmp (ZPPtr2),y
|
|
|
|
|
bne .4
|
|
|
|
|
dey
|
|
|
|
|
bne .21
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
2016-03-18 16:35:27 +00:00
|
|
|
|
lda PRODOS.FT.ID,x
|
|
|
|
|
ldy #HexFileType
|
|
|
|
|
sta (pData),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-03-18 16:35:27 +00:00
|
|
|
|
|
|
|
|
|
.4 clc
|
|
|
|
|
lda ZPPtr2
|
|
|
|
|
adc #3
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
lda ZPPtr2+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPPtr2+1
|
|
|
|
|
inx
|
|
|
|
|
cpx #PRODOS.FT.COUNT
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2016-03-18 16:35:27 +00:00
|
|
|
|
MSG.USAGE >PSTRING "Usage : CHTYP [File *,? wildcards allowed] [File type : $xx or SYS,TXT....]\n"
|
|
|
|
|
MSG.OK >PSTRING " [Ok]\n"
|
|
|
|
|
MSG.ERR >PSTRING " [%h]\n"
|
|
|
|
|
FullPath .BS 64
|
|
|
|
|
Tmp .BS 1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-18 16:35:27 +00:00
|
|
|
|
PRODOS.FT.COUNT .EQ 7
|
2015-03-14 21:47:37 +00:00
|
|
|
|
PRODOS.FT.ID .HS 0406FAFCFDE2FF
|
2016-03-18 16:35:27 +00:00
|
|
|
|
PRODOS.FT.TXT .AS "TXT"
|
|
|
|
|
.AS "BIN"
|
|
|
|
|
.AS "S-C"
|
|
|
|
|
.AS "BAS"
|
|
|
|
|
.AS "VAR"
|
|
|
|
|
.AS "ATK"
|
|
|
|
|
.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
|
|
|
|
|
hDIRPATH .BS 1
|
|
|
|
|
hS.LISTDIR .BS 1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
hArg1 .BS 1
|
|
|
|
|
hArg2 .BS 1
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bSTOP .BS 1
|
|
|
|
|
bCANCEL .BS 1
|
2016-03-18 16:35:27 +00:00
|
|
|
|
HexFileType .BS 1
|
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
|
|
|
|
|
SAVE BIN/CHTYP.S
|
|
|
|
|
ASM
|