Kernel version 0.8 : LS : adding -R options

This commit is contained in:
Rémy GIBERT 2016-10-20 18:04:35 +02:00
parent 529c992d9b
commit 83a75b7fef
4 changed files with 99 additions and 121 deletions

Binary file not shown.

Binary file not shown.

View File

@ -51,7 +51,7 @@ CS.INIT >SYSCALL SYS.GetArgC
sta ArgCount
.1 dec ArgCount
beq .8
beq .5
lda ArgCount
>SYSCALL SYS.GetArgA
@ -59,12 +59,12 @@ CS.INIT >SYSCALL SYS.GetArgC
lda (ZPPtr1)
cmp #2
bne .7
bne .4
ldy #1
lda (ZPPtr1),y
cmp #'-'
bne .7
bne .4
iny
lda (ZPPtr1),y
@ -75,105 +75,38 @@ CS.INIT >SYSCALL SYS.GetArgC
beq .3
dex
bne .2
beq .90 Syntax error
lda #SYSMGR.ERRSYN
sec
rts
.3 ldy OptionVars-1,x
lda #$80
sta (pData),y
bra .1
.7 >LDYA ZPPtr1
jsr CS.INIT.OPENDIR
bcs .99
ldy #hDIR A=hDir
sta (pData),y
bra .1
.4 >LDYA ZPPtr1
jsr InitSrcDirYA
bcs .9
.8 ldy #hDIR
bra .1 scan for any other args
.5 ldy #hDIRs
lda (pData),y
bne .80
bne .8
ldy #S.PS.hPREFIX
lda (pPs),y
>SYSCALL SYS.GetMemPtrA
>SYSCALL SYS.OPENDIRYA
bcs .99
jsr InitSrcDirYA
bcs .9
ldy #hDIR
sta (pData),y
.80 lda (pPs)
.8 lda (pPs)
ora #S.PS.F.EVENT Now accept events
sta (pPs)
clc
rts
.90 lda #SYSMGR.ERRSYN
.99 sec
rts
*--------------------------------------
CS.INIT.OPENDIR >SYSCALL SYS.GetFullPathYA
bcs .99
stx .90+1
>STYA ZPPtr1
>PUSHW L.STAT
>PUSHW ZPPtr1
>SYSCALL SYS.STAT
bcc .7 File exists, do not extract wildcard
lda (ZPPtr1)
tay
.2 lda (ZPPtr1),y search backward for a /
cmp #'/'
beq .3
dey
bne .2
.3 tya
cmp (ZPPtr1)
beq .7 Make sure at least one char
ldx #0
phy save / pos to trunk string later
.4 iny
inx
lda (ZPPtr1),y
sta UsrBuf256,x
tya
cmp (ZPPtr1)
bne .4
pla get back / pos
sta (ZPPtr1) trunk it for Opendir
stx UsrBuf256
>LDYAI UsrBuf256
>SYSCALL SYS.NewPstrYA
bcs .9
txa
ldy #hFilter
sta (pData),y
.7 >LDYA ZPPtr1
>SYSCALL SYS.OPENDIRYA
bcs .9
jsr .9 Cleanup
clc
.99 rts
.9 pha
.90 lda #$ff
>SYSCALL SYS.FreeMemA
pla
sec
rts
.9 rts
*--------------------------------------
CS.RUN ldy #bCANCEL
lda (pData),y
@ -187,8 +120,11 @@ CS.RUN ldy #bCANCEL
clc
rts
.2 ldy #hDIR
.2 ldy #hDIRs
lda (pData),y
tay
lda (pData),y
>SYSCALL SYS.READDIRA
bcc .20
@ -459,10 +395,8 @@ CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
.9 sec
rts
*--------------------------------------
CS.QUIT ldy #hDIR
lda (pData),y
>SYSCALL SYS.CLOSEDIRA
CS.QUIT jsr LeaveSubDir
bcc CS.QUIT
ldy #hFilter
lda (pData),y
@ -504,6 +438,8 @@ FileType2PSTR ldy #0
lda L.PRODOS.FT.TXT+1
adc #0
rts
*--------------------------------------
.INB BIN/X.CPLSMVRM.S
*--------------------------------------
CS.END
*--------------------------------------
@ -535,8 +471,8 @@ ArgCount .BS 1
.DUMMY
.OR 0
DS.START
hDIR .BS 1
hDIRs .BS MAX.RECURSE+1
hBasePath .BS 1
hFilter .BS 1
bSTOP .BS 1
bCANCEL .BS 1

View File

@ -9,9 +9,11 @@ AUTO 6
* hDIRs .BS MAX.RECURSE+1
* hBasePath .BS 1
*--------------------------------------
SetSrcDirYA >SYSCALL SYS.GetFullPathYA
bcs .99
stx .90+1
InitSrcDirYA >SYSCALL SYS.GetFullPathYA
bcc .10
rts
.10 stx .90+1
>STYA ZPPtr1
lda (ZPPtr1)
@ -26,7 +28,7 @@ SetSrcDirYA >SYSCALL SYS.GetFullPathYA
lda STAT+S.STAT.PRODOS.TYPE
cmp #$0f
beq .7 TYPE=DIR, do not estract wildcard
beq .5 TYPE=DIR, do not extract wildcard
.1 lda (ZPPtr1)
tay
@ -39,7 +41,7 @@ SetSrcDirYA >SYSCALL SYS.GetFullPathYA
.3 tya
cmp (ZPPtr1)
beq .7 Make sure at least one char
beq .5 Make sure at least one char
ldx #0
phy save / pos to trunk string later
@ -81,16 +83,20 @@ SetSrcDirYA >SYSCALL SYS.GetFullPathYA
>SYSCALL SYS.OPENDIRYA
bcs .9
pha
ldy #hDIRs
sta (pData),y set hDIRs[1] = Src Hdir
tya
inc
sta (pData),y
iny set hDIRs[1] = Src Hdir
pla
sta (pData),y set hDIRs index=hDIRs[1]
jsr .9 Cleanup
clc
.99 rts
rts
.9 pha
.90 lda #$ff self modified
@ -99,38 +105,74 @@ SetSrcDirYA >SYSCALL SYS.GetFullPathYA
sec
rts
*--------------------------------------
EnterDirYA >PUSHYA push Src for StrCat
EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
ldy #hDIRs
lda (pData),y
cmp #hDIRs+MAX.RECURSE+1
beq .99
ldy #hBasePath
lda (pData),y
>SYSCALL SYS.GetMemPtrA
>STYA ZPPtr1 save full path
>PUSHYA push Src for StrCat
>SYSCALL SYS.StrCat
>PUSHW ZPPtr1 push Src for StrCat
>PUSHW ZPPtr2
>SYSCALL SYS.PStrCat
jsr GetNextDir
>LDYA ZPPtr1
>SYSCALL SYS.OPENDIRYA
beq .99 CS
bcs .99
pha
clc
.99 rts
*--------------------------------------
LeaveDir
*--------------------------------------
GetNextDir ldy #hDIRs
ldy #hDIRs
lda (pData),y
cmp #hDIRs+MAX.RECURSE+1
beq .99 CS full!!! all hDIRs already alloacated
inc
sta (pData),y
tay
pla
sta (pData),y
clc
.99 rts
*--------------------------------------
GetLastDir
LeaveSubDir ldy #hDIRs
lda (pData),y
tay
lda (pData),y
>SYSCALL SYS.CLOSEDIRA
ldy #hBasePath
lda (pData),y
>SYSCALL SYS.GetMemPtrA
>STYA ZPPtr1 save full path
lda (ZPPtr1) get len
tay
.1 dey At first run, discard ending /
lda (ZPPtr1),y
cmp #'/'
bne .1
tya
sta (ZPPtr1) cut DIR2/ from /dir1/DIR2/
ldy #hDIRs
lda (pData),y
dec
sta (pData),y
cmp #hDIRs
beq .9 CS
clc
.9 rts
*--------------------------------------
MAN
SAVE BIN/X.CPLSMVRM.S.txt
SAVE BIN/X.CPLSMVRM.S