2015-08-05 20:38:05 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF /A2OSX.BOOT/BIN/RM
|
|
|
|
|
*--------------------------------------
|
2016-10-26 20:51:06 +00:00
|
|
|
|
.INB /A2OSX.DEV/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.DEV/INC/A2OSX.I
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
2016-11-08 16:56:05 +00:00
|
|
|
|
X.MAX.RECURSE .EQ 8
|
|
|
|
|
X.DST.BASE.PATH .EQ 0
|
|
|
|
|
X.DELETE.SOURCE .EQ 0
|
2016-10-30 18:19:43 +00:00
|
|
|
|
*--------------------------------------
|
2016-01-06 22:09:20 +00:00
|
|
|
|
ZPPtr1 .EQ ZPBIN
|
|
|
|
|
ZPPtr2 .EQ ZPBIN+2
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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 Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2016-10-30 18:19:43 +00:00
|
|
|
|
*--------------------------------------
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2016-03-18 16:34:30 +00:00
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
2016-10-30 18:19:43 +00:00
|
|
|
|
L.MSG.DIR .DA MSG.DIR
|
|
|
|
|
L.MSG.FILE .DA MSG.FILE
|
2016-01-06 22:09:20 +00:00
|
|
|
|
L.MSG.OK .DA MSG.OK
|
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
2016-10-30 18:19:43 +00:00
|
|
|
|
L.STAT .DA STAT
|
2015-08-05 20:38:05 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
CS.INIT >SYSCALL GetArgC
|
2016-10-30 18:19:43 +00:00
|
|
|
|
sta ArgCount
|
2016-08-28 20:48:01 +00:00
|
|
|
|
cmp #1
|
2016-10-30 18:19:43 +00:00
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
.1 dec ArgCount
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
lda ArgCount
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #2
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx OptionList
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 ldy OptionVars-1,x
|
|
|
|
|
lda #$80
|
2015-08-05 20:38:05 +00:00
|
|
|
|
sta (pData),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bra .1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.4 >LDYA ZPPtr1
|
2016-11-03 07:29:24 +00:00
|
|
|
|
jsr InitSrcDirPatYA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bcs .9
|
2016-08-28 20:48:01 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bra .1 scan for any other args
|
|
|
|
|
|
|
|
|
|
.5 ldy #index
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
.8 lda (pPs)
|
2015-08-05 20:38:05 +00:00
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
clc
|
2016-08-28 20:48:01 +00:00
|
|
|
|
rts
|
2016-10-30 18:19:43 +00:00
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
.99 >LDYA L.MSG.USAGE
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-03-18 16:34:30 +00:00
|
|
|
|
lda #SYSMGR.ERRSYN
|
2016-08-28 20:48:01 +00:00
|
|
|
|
sec
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.9 rts
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN ldy #bCANCEL
|
|
|
|
|
lda (pData),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bmi .99
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
ldy #bSTOP
|
2015-08-05 20:38:05 +00:00
|
|
|
|
lda (pData),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bmi .8
|
|
|
|
|
|
|
|
|
|
jsr GetNextEntry
|
|
|
|
|
bcs .9
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
ldy #hFilter
|
2015-08-05 20:38:05 +00:00
|
|
|
|
lda (pData),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
beq .4 No filter....
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW ZPPtr1
|
|
|
|
|
>SYSCALL PStrMatch
|
|
|
|
|
bcs .8 no match, skip....
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.4 ldy #S.STAT.PRODOS.DRIVE
|
|
|
|
|
lda (ZPPtr2),y ProDOS Device ?
|
|
|
|
|
bne .5
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
ldy #S.STAT.PRODOS.TYPE
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
cmp #$0F Directory ?
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
jmp CS.RUN.DIR
|
|
|
|
|
.5 jmp CS.RUN.DEV
|
|
|
|
|
.6 jmp CS.RUN.FILE
|
|
|
|
|
|
|
|
|
|
.9 jsr LeaveSubDir
|
|
|
|
|
bcs .99
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
ldy #bRecurse
|
2015-08-05 20:38:05 +00:00
|
|
|
|
lda (pData),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bpl .8
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-11-08 16:56:05 +00:00
|
|
|
|
ldy #hSrcBasePath
|
2016-10-30 18:19:43 +00:00
|
|
|
|
lda (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG.DIR
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
jsr CS.RUN.DELETE.DIR
|
|
|
|
|
jsr CS.RUN.PRINT.RC
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
jsr BasePath..
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.DEV >PUSHW ZPPtr1
|
|
|
|
|
>LDYA L.MSG.FILE
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
ldy #bRecurse
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bpl .8
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.PRINT.FILE
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
clc
|
|
|
|
|
jsr CS.RUN.PRINT.RC
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr1
|
|
|
|
|
jmp EnterSubDirYA
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2016-11-03 07:29:24 +00:00
|
|
|
|
CS.RUN.DIR ldy #1
|
2016-01-06 22:09:20 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
cmp #'.'
|
|
|
|
|
beq .8
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-11-03 07:29:24 +00:00
|
|
|
|
ldy #bRecurse
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bpl CS.RUN.FILE
|
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
>LDYA ZPPtr1
|
|
|
|
|
jmp EnterSubDirYA
|
2016-11-03 07:29:24 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.FILE jsr CS.RUN.PRINT.FILE
|
|
|
|
|
bcs .9
|
|
|
|
|
jsr CS.RUN.DELETE.FILE
|
|
|
|
|
jsr CS.RUN.PRINT.RC
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.PRINT.FILE
|
|
|
|
|
>PUSHW ZPPtr1
|
2016-11-08 16:56:05 +00:00
|
|
|
|
ldy #hSrcBasePath
|
2016-10-30 18:19:43 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>PUSHYA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
>LDYA L.MSG.FILE
|
2016-11-03 16:27:43 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.DELETE.DIR
|
|
|
|
|
jsr CS.RUN.GET.BASE.PATH
|
|
|
|
|
bra CS.RUN.DELETE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.DELETE.FILE
|
|
|
|
|
jsr CS.RUN.GET.BASE.PATH
|
|
|
|
|
>PUSHW ZPPtr1
|
|
|
|
|
>PUSHWI UsrBuf256
|
|
|
|
|
>SYSCALL PStrCat
|
|
|
|
|
|
|
|
|
|
CS.RUN.DELETE >LDYAI UsrBuf256
|
|
|
|
|
>SYSCALL RemoveYA
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.GET.BASE.PATH
|
2016-11-08 16:56:05 +00:00
|
|
|
|
ldy #hSrcBasePath
|
2016-10-30 18:19:43 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHWI UsrBuf256
|
|
|
|
|
>SYSCALL PStrCpy
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.PRINT.RC pha
|
|
|
|
|
php
|
|
|
|
|
bcs .1
|
2016-01-06 22:09:20 +00:00
|
|
|
|
>LDYA L.MSG.OK
|
|
|
|
|
bra .8
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.1 >PUSHA
|
2016-01-06 22:09:20 +00:00
|
|
|
|
>LDYA L.MSG.ERR
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-11-03 16:27:43 +00:00
|
|
|
|
.8 >SYSCALL CPrintFYA
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
plp
|
|
|
|
|
ldy #bContinue
|
|
|
|
|
lda (pData),y
|
|
|
|
|
eor #$80
|
|
|
|
|
asl
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 plx
|
|
|
|
|
plx
|
2015-08-05 20:38:05 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
ldy #S.PS.hINDEV
|
|
|
|
|
cmp (pPs),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
lda (pEvent)
|
|
|
|
|
and #S.EVT.F.KEY is it a KEY event?
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #S.EVT.DATALO
|
|
|
|
|
lda (pEvent),y
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #$FF
|
|
|
|
|
ldy #bCANCEL
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.1 cmp #$13 Ctrl-S
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
ldy #bSTOP
|
|
|
|
|
lda (pData),y
|
|
|
|
|
eor #$FF
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-10-30 18:19:43 +00:00
|
|
|
|
CS.QUIT jsr LeaveSubDir
|
|
|
|
|
bcc CS.QUIT
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
ldy #hFilter
|
2015-08-05 20:38:05 +00:00
|
|
|
|
lda (pData),y
|
2016-10-30 18:19:43 +00:00
|
|
|
|
beq .3
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-30 18:19:43 +00:00
|
|
|
|
.3 clc
|
2015-08-05 20:38:05 +00:00
|
|
|
|
rts
|
2016-10-30 18:19:43 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-30 22:23:18 +00:00
|
|
|
|
.INB BIN/X.FILEENUM.S
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2016-10-30 18:19:43 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
OptionList >PSTR "CR"
|
|
|
|
|
OptionVars .DA #bContinue,#bRecurse
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MSG.USAGE >CSTR "Usage : RM [File/Dir, *,? wildcards allowed]\n -C : Continue on error\n -R : Recurse subdirectories\n"
|
|
|
|
|
MSG.DIR >CSTR "RM Dir :%S..."
|
|
|
|
|
MSG.FILE >CSTR "RM File:%S%S..."
|
|
|
|
|
MSG.OK >CSTR "[OK]\n"
|
|
|
|
|
MSG.ERR >CSTR "[%h]\n"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
STAT .BS S.STAT
|
|
|
|
|
ArgCount .BS 1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2016-10-30 18:19:43 +00:00
|
|
|
|
Index .BS 1
|
2016-11-08 16:56:05 +00:00
|
|
|
|
hDIRs .BS X.MAX.RECURSE
|
|
|
|
|
hDIRENTs .BS X.MAX.RECURSE
|
|
|
|
|
oDIRENTs .BS X.MAX.RECURSE*2
|
|
|
|
|
hSrcBasePath .BS 1
|
2016-10-30 18:19:43 +00:00
|
|
|
|
hFilter .BS 1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
bCANCEL .BS 1
|
2016-10-30 18:19:43 +00:00
|
|
|
|
bSTOP .BS 1
|
|
|
|
|
bContinue .BS 1
|
|
|
|
|
bRecurse .BS 1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/RM.S
|
|
|
|
|
ASM
|