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-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-01-06 22:09:20 +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-01-06 22:09:20 +00:00
|
|
|
|
L.MSG.OK .DA MSG.OK
|
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
2015-08-05 20:38:05 +00:00
|
|
|
|
L.FullPath .DA FullPath
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
CS.INIT >SYSCALL GetArgC
|
2016-08-28 20:48:01 +00:00
|
|
|
|
cmp #1
|
|
|
|
|
bne .99
|
|
|
|
|
|
|
|
|
|
lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
|
|
|
|
>SYSCALL GetFullPathYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
stx hFullPath
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL ListDirInitYA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
bcs .98
|
2015-08-05 20:38:05 +00:00
|
|
|
|
ldy #hS.LISTDIR
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
jsr .98
|
|
|
|
|
|
2015-08-05 20:38:05 +00:00
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-08-28 20:48:01 +00:00
|
|
|
|
.98 pha
|
|
|
|
|
lda hFullPath
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2016-08-28 20:48:01 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 >LDYA L.MSG.USAGE
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrOutYA
|
2016-03-18 16:34:30 +00:00
|
|
|
|
lda #SYSMGR.ERRSYN
|
2016-08-28 20:48:01 +00:00
|
|
|
|
sec
|
2015-08-05 20:38:05 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN ldy #bCANCEL
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.10 ldy #bSTOP
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .1
|
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.1 ldy #hS.LISTDIR
|
|
|
|
|
lda (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL ListDirNextA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
pha
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-01-06 22:09:20 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
2015-08-05 20:38:05 +00:00
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
and #$0F
|
2016-01-06 22:09:20 +00:00
|
|
|
|
sta (ZPPtr1) Adjust Filename len
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
and #$F0
|
|
|
|
|
cmp #$F0 Volume ($F) HEADER ?
|
|
|
|
|
beq .8
|
|
|
|
|
cmp #$E0 Dir ($E) HEADER ?
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
ldy #hS.LISTDIR
|
|
|
|
|
lda (pData),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-01-06 22:09:20 +00:00
|
|
|
|
>STYA ZPPtr2
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.LISTDIR.hPATH
|
2016-01-06 22:09:20 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetMemPtrA
|
2016-01-06 22:09:20 +00:00
|
|
|
|
>STYA ZPPtr2
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-01-06 22:09:20 +00:00
|
|
|
|
lda (ZPPtr2)
|
2015-08-05 20:38:05 +00:00
|
|
|
|
tax
|
|
|
|
|
tay
|
|
|
|
|
|
2016-01-06 22:09:20 +00:00
|
|
|
|
.2 lda (ZPPtr2),y
|
2015-08-05 20:38:05 +00:00
|
|
|
|
sta FullPath,y
|
|
|
|
|
dey
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
.3 inx
|
|
|
|
|
iny
|
2016-01-06 22:09:20 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2015-08-05 20:38:05 +00:00
|
|
|
|
sta FullPath,x
|
|
|
|
|
tya
|
2016-01-06 22:09:20 +00:00
|
|
|
|
cmp (ZPPtr1)
|
2015-08-05 20:38:05 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
stx FullPath
|
|
|
|
|
|
2016-01-06 22:09:20 +00:00
|
|
|
|
>LDYA L.FullPath
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrOutYA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.FullPath
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL MLIDestroyYA
|
2016-01-06 22:09:20 +00:00
|
|
|
|
bcs .5
|
|
|
|
|
>LDYA L.MSG.OK
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrOutYA
|
2016-01-06 22:09:20 +00:00
|
|
|
|
bra .8
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-01-06 22:09:20 +00:00
|
|
|
|
.5 >PUSHA
|
|
|
|
|
>LDYA L.MSG.ERR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PStrOutYA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
|
|
|
|
.8 pla
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
clc
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT ldy #hS.LISTDIR
|
|
|
|
|
lda (pData),y
|
2016-03-18 16:34:30 +00:00
|
|
|
|
beq .1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL ListDirCloseA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-05-01 21:13:54 +00:00
|
|
|
|
.1 ldy #hDirPath
|
2015-08-05 20:38:05 +00:00
|
|
|
|
lda (pData),y
|
2016-03-18 16:34:30 +00:00
|
|
|
|
beq .2
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2015-08-05 20:38:05 +00:00
|
|
|
|
|
2016-03-18 16:34:30 +00:00
|
|
|
|
.2 clc
|
2015-08-05 20:38:05 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG.USAGE >PSTR "Usage : RM [file/Dir, *,? wildcards allowed]\n"
|
|
|
|
|
MSG.OK >PSTR " [Ok]\n"
|
|
|
|
|
MSG.ERR >PSTR " [%h]\n"
|
2016-08-28 20:48:01 +00:00
|
|
|
|
hFullPath .BS 1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
FullPath .BS 64
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2016-05-01 21:13:54 +00:00
|
|
|
|
hDirPath .BS 1
|
2015-08-05 20:38:05 +00:00
|
|
|
|
hS.LISTDIR .BS 1
|
|
|
|
|
bSTOP .BS 1
|
|
|
|
|
bCANCEL .BS 1
|
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/RM.S
|
|
|
|
|
ASM
|