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 sta ArgCount
.1 dec ArgCount .1 dec ArgCount
beq .8 beq .5
lda ArgCount lda ArgCount
>SYSCALL SYS.GetArgA >SYSCALL SYS.GetArgA
@ -59,12 +59,12 @@ CS.INIT >SYSCALL SYS.GetArgC
lda (ZPPtr1) lda (ZPPtr1)
cmp #2 cmp #2
bne .7 bne .4
ldy #1 ldy #1
lda (ZPPtr1),y lda (ZPPtr1),y
cmp #'-' cmp #'-'
bne .7 bne .4
iny iny
lda (ZPPtr1),y lda (ZPPtr1),y
@ -75,105 +75,38 @@ CS.INIT >SYSCALL SYS.GetArgC
beq .3 beq .3
dex dex
bne .2 bne .2
beq .90 Syntax error
lda #SYSMGR.ERRSYN
sec
rts
.3 ldy OptionVars-1,x .3 ldy OptionVars-1,x
lda #$80 lda #$80
sta (pData),y sta (pData),y
bra .1 bra .1
.7 >LDYA ZPPtr1 .4 >LDYA ZPPtr1
jsr CS.INIT.OPENDIR jsr InitSrcDirYA
bcs .99 bcs .9
ldy #hDIR A=hDir
sta (pData),y
bra .1
.8 ldy #hDIR bra .1 scan for any other args
.5 ldy #hDIRs
lda (pData),y lda (pData),y
bne .80 bne .8
ldy #S.PS.hPREFIX ldy #S.PS.hPREFIX
lda (pPs),y lda (pPs),y
>SYSCALL SYS.GetMemPtrA >SYSCALL SYS.GetMemPtrA
>SYSCALL SYS.OPENDIRYA jsr InitSrcDirYA
bcs .99 bcs .9
ldy #hDIR
sta (pData),y
.80 lda (pPs) .8 lda (pPs)
ora #S.PS.F.EVENT Now accept events ora #S.PS.F.EVENT Now accept events
sta (pPs) sta (pPs)
clc clc
rts .9 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
*-------------------------------------- *--------------------------------------
CS.RUN ldy #bCANCEL CS.RUN ldy #bCANCEL
lda (pData),y lda (pData),y
@ -187,8 +120,11 @@ CS.RUN ldy #bCANCEL
clc clc
rts rts
.2 ldy #hDIR .2 ldy #hDIRs
lda (pData),y lda (pData),y
tay
lda (pData),y
>SYSCALL SYS.READDIRA >SYSCALL SYS.READDIRA
bcc .20 bcc .20
@ -459,10 +395,8 @@ CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
.9 sec .9 sec
rts rts
*-------------------------------------- *--------------------------------------
CS.QUIT ldy #hDIR CS.QUIT jsr LeaveSubDir
lda (pData),y bcc CS.QUIT
>SYSCALL SYS.CLOSEDIRA
ldy #hFilter ldy #hFilter
lda (pData),y lda (pData),y
@ -504,6 +438,8 @@ FileType2PSTR ldy #0
lda L.PRODOS.FT.TXT+1 lda L.PRODOS.FT.TXT+1
adc #0 adc #0
rts rts
*--------------------------------------
.INB BIN/X.CPLSMVRM.S
*-------------------------------------- *--------------------------------------
CS.END CS.END
*-------------------------------------- *--------------------------------------
@ -535,8 +471,8 @@ ArgCount .BS 1
.DUMMY .DUMMY
.OR 0 .OR 0
DS.START DS.START
hDIR .BS 1
hDIRs .BS MAX.RECURSE+1 hDIRs .BS MAX.RECURSE+1
hBasePath .BS 1
hFilter .BS 1 hFilter .BS 1
bSTOP .BS 1 bSTOP .BS 1
bCANCEL .BS 1 bCANCEL .BS 1

View File

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