mirror of
https://github.com/A2osX/A2osX.git
synced 2025-02-16 18:30:26 +00:00
CIFSD:bugfix & type/auxtype mapping
CP,MV,RM:memory leak & new X.FILEENUM LIBTUI:TBOX improvment
This commit is contained in:
parent
c4ca3e5907
commit
17aee1f2a8
Binary file not shown.
Binary file not shown.
10
BIN/CP.S.txt
10
BIN/CP.S.txt
@ -19,17 +19,19 @@ X.DELETE.SOURCE .EQ 0
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
OptionList .AS "CcQqRrYy"
|
||||
OptionVars .DA #bContinue,#bContinue
|
||||
OptionList .AS "IiCcQqRrYy"
|
||||
OptionVars .DA #0,#0
|
||||
.DA #bContinue,#bContinue
|
||||
.DA #bQuiet,#bQuiet
|
||||
.DA #bRecurse,#bRecurse
|
||||
.DA #bNoConfirm,#bNoConfirm
|
||||
*--------------------------------------
|
||||
MSG.USAGE .CS "Usage : CP [Src File/Dir, *,? wildcards allowed]\r\n"
|
||||
.CS " -C : Continue on error\r\n"
|
||||
.CS " -I <*,? wildcards allowed> : Ignore matching files\r\n"
|
||||
.CS " -Q : Quiet\r\n"
|
||||
.CS " -R : Recurse subdirectories\r\n"
|
||||
.CZ " -Y : Don't prompt for override\r\n"
|
||||
.CZ " -Y : Don't prompt for overwrite\r\n"
|
||||
MSG.DIR .CZ "CP Dir :%s to %s..."
|
||||
MSG.REG .CZ "CP File:%s to %s..."
|
||||
MSG.OVERWRITE .CZ "Overwrite %s [Yes,No,All]?"
|
||||
@ -40,7 +42,7 @@ MSG.DONE .CZ "%D File(s) Copied.\r\n"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START .INB usr/src/shared/x.cpmvrm.g
|
||||
DS.START
|
||||
.INB usr/src/shared/x.fileenum.g
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
|
@ -894,6 +894,7 @@ MSG.USAGE .CS "Usage : LS [-A] [-C] [-F] [-L] [-R] [filespec]\r\n"
|
||||
.CS " -A : Show all files\r\n"
|
||||
.CS " -C : List in one column\r\n"
|
||||
.CS " -F : Show full paths\r\n"
|
||||
.CS " -I <*,? wildcards allowed> : Ignore matching files\r\n"
|
||||
.CS " -L : Use long listing format\r\n"
|
||||
.CZ " -R : Recursively list subdirectories\r\n"
|
||||
*--------------------------------------
|
||||
|
10
BIN/MV.S.txt
10
BIN/MV.S.txt
@ -19,17 +19,19 @@ X.DELETE.SOURCE .EQ 1
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
OptionList .AS "CcQqRrYy"
|
||||
OptionVars .DA #bContinue,#bContinue
|
||||
OptionList .AS "IiCcQqRrYy"
|
||||
OptionVars .DA #0,#0
|
||||
.DA #bContinue,#bContinue
|
||||
.DA #bQuiet,#bQuiet
|
||||
.DA #bRecurse,#bRecurse
|
||||
.DA #bNoConfirm,#bNoConfirm
|
||||
*--------------------------------------
|
||||
MSG.USAGE .CS "Usage : MV [Src File/Dir, *,? wildcards allowed]\r\n"
|
||||
.CS " -C : Continue on error\r\n"
|
||||
.CS " -I <*,? wildcards allowed> : Ignore matching files\r\n"
|
||||
.CS " -Q : Quiet\r\n"
|
||||
.CS " -R : Recurse subdirectories\r\n"
|
||||
.CZ " -Y : Dont't prompt for override\r\n"
|
||||
.CZ " -Y : Dont't prompt for overwrite\r\n"
|
||||
MSG.DIR .CZ "MV Dir :%s to %s..."
|
||||
MSG.REG .CZ "MV File:%s to %s..."
|
||||
MSG.OVERWRITE .CZ "Overwrite %s [Yes,No,All]?"
|
||||
@ -40,7 +42,7 @@ MSG.DONE .CZ "%D File(s) Moved.\r\n"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START .INB usr/src/shared/x.cpmvrm.g
|
||||
DS.START
|
||||
.INB usr/src/shared/x.fileenum.g
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
|
@ -19,13 +19,15 @@ X.DELETE.SOURCE .EQ 1
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
OptionList .AS "CcQqRr"
|
||||
OptionVars .DA #bContinue,#bContinue
|
||||
OptionList .AS "IiCcQqRr"
|
||||
OptionVars .DA #0,#0
|
||||
.DA #bContinue,#bContinue
|
||||
.DA #bQuiet,#bQuiet
|
||||
.DA #bRecurse,#bRecurse
|
||||
*--------------------------------------
|
||||
MSG.USAGE .CS "Usage : RM [File/Dir, *,? wildcards allowed]\r\n"
|
||||
.CS " -C : Continue on error\r\n"
|
||||
.CS " -I <*,? wildcards allowed> : Ignore matching files\r\n"
|
||||
.CS " -Q : Quiet\r\n"
|
||||
.CZ " -R : Recurse subdirectories\r\n"
|
||||
MSG.DIR .CZ "RM Dir :%s..."
|
||||
@ -37,7 +39,7 @@ MSG.DONE .CZ "%D File(s) Removed.\r\n"
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START .INB usr/src/shared/x.cpmvrm.g
|
||||
DS.START
|
||||
.INB usr/src/shared/x.fileenum.g
|
||||
DS.END .ED
|
||||
*--------------------------------------
|
||||
|
@ -922,6 +922,12 @@ OBJ.CurOff ldy #S.OBJ.F
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
OBJ.ZeroWordAtY lda #0
|
||||
lda (ZPObjPtr),y
|
||||
iny
|
||||
sta (ZPObjPtr),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
OBJ.IncWordAtY lda (ZPObjPtr),y
|
||||
inc
|
||||
sta (ZPObjPtr),y
|
||||
|
@ -20,7 +20,7 @@ TBOX.New lda #S.OBJ.T.TBOX
|
||||
|
||||
jsr OBJ.Insert
|
||||
bcs .99
|
||||
|
||||
|
||||
lda hObj
|
||||
* clc
|
||||
rts
|
||||
@ -47,7 +47,7 @@ TBOX.Run ldy #S.OBJ.S
|
||||
|
||||
.1 cmp #C.DEL
|
||||
beq .3
|
||||
|
||||
|
||||
jsr TBOX.GetBuf
|
||||
jsr TBOX.ToBuf1
|
||||
bcs .8 Buffer full
|
||||
@ -55,7 +55,7 @@ TBOX.Run ldy #S.OBJ.S
|
||||
jsr TBOX.RUN.FS1
|
||||
bit bRepaintAll
|
||||
bmi .2
|
||||
|
||||
|
||||
jsr OBJ.CurUpdPos
|
||||
|
||||
jmp TBOX.DrawCurLine
|
||||
@ -74,8 +74,8 @@ TBOX.Run ldy #S.OBJ.S
|
||||
jmp TBOX.DrawCurLine
|
||||
|
||||
.4 jmp TBOX.DrawAllLines
|
||||
|
||||
.8
|
||||
|
||||
.8
|
||||
*--------------------------------------
|
||||
TBOX.RUN.Ignore lda #0
|
||||
sec
|
||||
@ -87,13 +87,13 @@ TBOX.RUN.SelBegin
|
||||
tax
|
||||
iny
|
||||
lda (ZPObjPtr),y
|
||||
|
||||
|
||||
ldy #S.TBOX.SelBegin+1
|
||||
sta (ZPObjPtr),y
|
||||
txa
|
||||
dey
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
|
||||
bra TBOX.RUN.Sel
|
||||
*--------------------------------------
|
||||
TBOX.RUN.SelEnd ldy #S.TBOX.BufPtr
|
||||
@ -101,7 +101,7 @@ TBOX.RUN.SelEnd ldy #S.TBOX.BufPtr
|
||||
tax
|
||||
iny
|
||||
lda (ZPObjPtr),y
|
||||
|
||||
|
||||
ldy #S.TBOX.SelEnd+1
|
||||
sta (ZPObjPtr),y
|
||||
txa
|
||||
@ -117,18 +117,18 @@ TBOX.RUN.Sel ldy #S.TBOX.SelEnd
|
||||
lda (ZPObjPtr),y
|
||||
ldy #S.TBOX.SelBegin+1
|
||||
sbc (ZPObjPtr),y
|
||||
|
||||
|
||||
ldy #S.TBOX.bSelect
|
||||
lda #0
|
||||
ror
|
||||
pha
|
||||
eor (ZPObjPtr),y
|
||||
bpl .1
|
||||
|
||||
|
||||
pla
|
||||
sta (ZPObjPtr),y
|
||||
jmp TBOX.SetViewPort
|
||||
|
||||
|
||||
.1 pla
|
||||
clc
|
||||
rts
|
||||
@ -161,7 +161,7 @@ TBOX.RUN.BS ldy #S.TBOX.BufPtr+1
|
||||
*--------------------------------------
|
||||
TBOX.RUN.LF jsr TBOX.GetBuf
|
||||
|
||||
jsr TBOX.GetCurlineInAX
|
||||
TBOX.RUN.LF1 jsr TBOX.GetCurlineInAX
|
||||
inx
|
||||
bne .1
|
||||
|
||||
@ -262,17 +262,17 @@ TBOX.RUN.SOL lda #0
|
||||
sta (ZPObjPtr),y
|
||||
iny
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
|
||||
jsr TBOX.GetCurlineInAX
|
||||
jsr TBOX.GetLineAX
|
||||
|
||||
|
||||
ldy #S.TBOX.BufPtr
|
||||
lda TempC BufPtr at SOL
|
||||
sta (ZPObjPtr),y
|
||||
iny
|
||||
lda TempC+1
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
|
||||
jmp TBOX.CheckViewPort
|
||||
*--------------------------------------
|
||||
TBOX.RUN.EOL jsr TBOX.GetCurlineInAX
|
||||
@ -304,19 +304,34 @@ TBOX.RUN.CR jsr TBOX.GetBuf
|
||||
jsr TBOX.ToBuf1
|
||||
bcs .8 Buffer full
|
||||
|
||||
jmp TBOX.RUN.FS1
|
||||
lda #0
|
||||
ldy #S.TBOX.DocX
|
||||
sta (ZPObjPtr),y
|
||||
iny
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
jsr TBOX.RUN.LF1
|
||||
|
||||
jsr OBJ.CurUpdPos
|
||||
|
||||
bit bRepaintAll
|
||||
bmi .1
|
||||
|
||||
jsr TBOX.DrawBottom
|
||||
|
||||
.1 jmp TBOX.DrawAllLines
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TBOX.RUN.PGUP
|
||||
TBOX.RUN.PGUP
|
||||
*--------------------------------------
|
||||
TBOX.RUN.PGDN lda #0
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
TBOX.RUN.QUIT lda #3 User Interrupt
|
||||
clc
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
TBOX.RUN.Home ldy #S.TBOX.DocX
|
||||
@ -342,7 +357,7 @@ TBOX.RUN.EraseCL
|
||||
jsr TBOX.GetLineAX
|
||||
jsr TBOX.GetLineLenInAXC
|
||||
jsr TBOX.DeleteAXC
|
||||
|
||||
|
||||
jmp TBOX.RUN.VT1
|
||||
*--------------------------------------
|
||||
TBOX.RUN.EOF lda #$ff
|
||||
@ -353,9 +368,9 @@ TBOX.RUN.EOF lda #$ff
|
||||
lda TempI
|
||||
sta (ZPObjPtr),y
|
||||
tax
|
||||
|
||||
|
||||
lda TempI+1
|
||||
iny
|
||||
iny
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
jsr TBOX.GetLineAX
|
||||
@ -377,7 +392,7 @@ TBOX.RUN.EOF lda #$ff
|
||||
sta (ZPObjPtr),y
|
||||
iny
|
||||
txa
|
||||
sta (ZPObjPtr),y
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
jmp TBOX.CheckViewPort
|
||||
*--------------------------------------
|
||||
@ -388,26 +403,50 @@ TBOX.DrawAllLines
|
||||
|
||||
jsr OBJ.Draw.Body
|
||||
inc pStack
|
||||
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
TBOX.DrawBottom ldy #S.OBJ.InnerY
|
||||
lda (ZPObjPtr),y
|
||||
|
||||
clc
|
||||
|
||||
ldy #S.OBJ.CurY
|
||||
adc (ZPObjPtr),y
|
||||
>PUSHA Start
|
||||
|
||||
ldy #S.OBJ.InnerH
|
||||
lda (ZPObjPtr),y
|
||||
|
||||
sec
|
||||
|
||||
ldy #S.OBJ.CurY
|
||||
sbc (ZPObjPtr),y
|
||||
>PUSHA Count
|
||||
|
||||
ldy #S.OBJ.CurY
|
||||
lda (ZPObjPtr),y Relative Y
|
||||
>PUSHA
|
||||
|
||||
jmp OBJ.Draw.Lines
|
||||
*--------------------------------------
|
||||
TBOX.DrawCurLine
|
||||
ldy #S.OBJ.InnerY
|
||||
lda (ZPObjPtr),y
|
||||
|
||||
|
||||
clc
|
||||
|
||||
|
||||
ldy #S.OBJ.CurY
|
||||
adc (ZPObjPtr),y
|
||||
>PUSHA Start
|
||||
|
||||
|
||||
lda #1
|
||||
>PUSHA Count
|
||||
|
||||
ldy #S.OBJ.CurY
|
||||
lda (ZPObjPtr),y Relative Y
|
||||
>PUSHA
|
||||
|
||||
|
||||
jmp OBJ.Draw.Lines
|
||||
*--------------------------------------
|
||||
TBOX.Draw ldy #S.TBOX.VScroll
|
||||
@ -425,15 +464,15 @@ TBOX.Draw ldy #S.TBOX.VScroll
|
||||
|
||||
ldy #S.TBOX.HScroll
|
||||
lda (ZPObjPtr),y
|
||||
beq .12
|
||||
|
||||
tax
|
||||
beq .12
|
||||
|
||||
.1 jsr TBOX.GetLineChar
|
||||
beq .12
|
||||
beq .5
|
||||
|
||||
cmp #C.CR
|
||||
beq .12
|
||||
beq .5
|
||||
|
||||
dex
|
||||
bne .1
|
||||
@ -454,7 +493,7 @@ TBOX.Draw ldy #S.TBOX.VScroll
|
||||
|
||||
.3 txa
|
||||
bne .6
|
||||
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
@ -471,7 +510,7 @@ TBOX.Draw ldy #S.TBOX.VScroll
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
TBOX.Activate
|
||||
TBOX.Activate
|
||||
*--------------------------------------
|
||||
TBOX.Deactivate clc
|
||||
rts
|
||||
@ -524,7 +563,7 @@ TBOX.GetLineAX stx TempW
|
||||
|
||||
jsr TBOX.GetLineLenInAXC
|
||||
bcc .9
|
||||
|
||||
|
||||
php
|
||||
pha
|
||||
|
||||
@ -569,18 +608,18 @@ TBOX.GetLineChar
|
||||
|
||||
lda (ZPPtr1)
|
||||
beq .8
|
||||
|
||||
|
||||
inc ZPPtr1
|
||||
bne .7
|
||||
|
||||
|
||||
inc ZPPtr1+1
|
||||
|
||||
|
||||
.7 inc TempC
|
||||
bne .8
|
||||
|
||||
|
||||
inc TempC+1
|
||||
|
||||
.8 rts
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
TBOX.GetLineLenInAXC
|
||||
lda ZPPtr1+1
|
||||
@ -706,9 +745,9 @@ TBOX.CheckViewPort
|
||||
jsr TBOX.SetViewPort
|
||||
bit bRepaintAll
|
||||
bpl .8
|
||||
|
||||
|
||||
jmp TBOX.DrawAllLines
|
||||
|
||||
|
||||
.8 jmp OBJ.CurUpdPos
|
||||
*--------------------------------------
|
||||
TBOX.SetViewPort
|
||||
@ -899,7 +938,7 @@ TBOX.SetViewPort
|
||||
|
||||
.40 ldy #S.OBJ.CurY
|
||||
sta (ZPObjPtr),y
|
||||
|
||||
|
||||
dec bRepaintAll
|
||||
|
||||
.41 clc CLC RTS to jmp to
|
||||
|
@ -112,6 +112,14 @@ CORE.AppendPathPtr2
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.AppendTypePtr2
|
||||
pha
|
||||
|
||||
lda #'.'
|
||||
sta (ZPPtr2),y
|
||||
iny
|
||||
|
||||
pla
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 cmp PRODOS.FT.HEX,x
|
||||
@ -121,6 +129,43 @@ CORE.AppendTypePtr2
|
||||
cpx #PRODOS.FT.TXT-PRODOS.FT.HEX
|
||||
bne .1
|
||||
|
||||
pha
|
||||
|
||||
lda #'0'
|
||||
sta (ZPPtr2),y
|
||||
iny
|
||||
|
||||
pla
|
||||
bra CORE.AppendHEXPtr2
|
||||
|
||||
.4 txa
|
||||
asl
|
||||
asl
|
||||
tax
|
||||
|
||||
.6 lda PRODOS.FT.TXT,x
|
||||
sta (ZPPtr2),y
|
||||
beq .8
|
||||
|
||||
inx
|
||||
iny
|
||||
bra .6
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
CORE.AppendAuxTPtr2
|
||||
pha
|
||||
|
||||
lda #'_'
|
||||
sta (ZPPtr2),y
|
||||
iny
|
||||
|
||||
pla
|
||||
jsr CORE.AppendHEXPtr2
|
||||
|
||||
txa
|
||||
*--------------------------------------
|
||||
CORE.AppendHEXPtr2
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
@ -133,7 +178,9 @@ CORE.AppendTypePtr2
|
||||
|
||||
adc #6
|
||||
|
||||
.2 sta PRODOS.FT.DFLT+1
|
||||
.2 sta (ZPPtr2),y
|
||||
iny
|
||||
|
||||
pla
|
||||
and #$0F
|
||||
|
||||
@ -143,26 +190,10 @@ CORE.AppendTypePtr2
|
||||
|
||||
adc #6
|
||||
|
||||
.3 sta PRODOS.FT.DFLT+2
|
||||
|
||||
.4 txa
|
||||
asl
|
||||
asl
|
||||
tax
|
||||
|
||||
lda #'.'
|
||||
sta (ZPPtr2),y
|
||||
.3 sta (ZPPtr2),y
|
||||
iny
|
||||
|
||||
.6 lda PRODOS.FT.TXT,x
|
||||
sta (ZPPtr2),y
|
||||
beq .8
|
||||
|
||||
inx
|
||||
iny
|
||||
bra .6
|
||||
|
||||
.8 rts
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
CORE.Add2ByteCount
|
||||
ldy ByteCountOfs
|
||||
@ -256,7 +287,6 @@ CORE.SetReqLen lda ZPReqLen
|
||||
sta (ZPReqPtr),y
|
||||
|
||||
lda ZPReqLen+1
|
||||
sec
|
||||
sbc /S.NETBIOS
|
||||
dey
|
||||
sta (ZPReqPtr),y
|
||||
|
@ -39,7 +39,7 @@ IO.Sleep ldy #S.PS.PID
|
||||
sta CIFS.PID
|
||||
|
||||
dec CIFS.Status
|
||||
|
||||
|
||||
stz CIFS.Cnt
|
||||
stz CIFS.Cnt+1
|
||||
|
||||
@ -231,7 +231,7 @@ IO.Q.OpenDir >STYA pPath resolved path
|
||||
|
||||
.98 jmp IO.Exit
|
||||
*--------------------------------------
|
||||
* IO.R.OpenDir
|
||||
* IO.R.OpenDir
|
||||
*--------------------------------------
|
||||
* A = hDIR
|
||||
*--------------------------------------
|
||||
@ -472,72 +472,12 @@ IO.R.ReadDir.FillBuf
|
||||
sec
|
||||
jsr IO.AddA2Ptr1
|
||||
|
||||
txa
|
||||
sec
|
||||
sbc #4 "x.EXT" ?
|
||||
bcc .7
|
||||
jsr IO.R.ReadDir.AuxT
|
||||
|
||||
tay
|
||||
|
||||
lda (ZPPtr2),y
|
||||
cmp #'.'
|
||||
bne .7
|
||||
|
||||
ldx #0
|
||||
|
||||
.4 phy Y = '.' offset
|
||||
|
||||
phx
|
||||
|
||||
.5 iny
|
||||
lda (ZPPtr2),y
|
||||
beq .51
|
||||
|
||||
cmp #'A'
|
||||
bcc .50
|
||||
|
||||
cmp #'Z'+1
|
||||
bcs .50
|
||||
|
||||
eor #$20
|
||||
|
||||
.50 cmp PRODOS.FT.TXT,x
|
||||
bne .6
|
||||
|
||||
inx
|
||||
bra .5
|
||||
|
||||
.51 pla
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
lda PRODOS.FT.HEX,x
|
||||
sta StatBuf+S.STAT.P.TYPE
|
||||
|
||||
ply
|
||||
lda #0
|
||||
sta (ZPPtr2),y
|
||||
|
||||
tya
|
||||
bra .70
|
||||
|
||||
.6 pla
|
||||
clc
|
||||
adc #4
|
||||
tax
|
||||
|
||||
ply
|
||||
|
||||
cpx #PRODOS.FT.END
|
||||
bne .4
|
||||
|
||||
tya
|
||||
* sec
|
||||
adc #3
|
||||
bra .70
|
||||
jsr IO.R.ReadDir.Type
|
||||
|
||||
.7 txa
|
||||
.70 sec +\0
|
||||
sec +\0
|
||||
jsr IO.AddA2Ptr2
|
||||
|
||||
jsr IO.StatBuf2Ptr2
|
||||
@ -552,6 +492,180 @@ IO.R.ReadDir.FillBuf
|
||||
sta (ZPPtr2)
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
IO.R.ReadDir.AuxT
|
||||
txa X = filename len
|
||||
sec
|
||||
sbc #5 "x.EXT_hhhh" ?
|
||||
bcc .99
|
||||
beq .99
|
||||
|
||||
tay
|
||||
|
||||
lda (ZPPtr2),y
|
||||
cmp #'_'
|
||||
bne .99
|
||||
|
||||
phy
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
|
||||
jsr IO.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta StatBuf+S.STAT.P.AUXTYPE+1
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
|
||||
jsr IO.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
ora StatBuf+S.STAT.P.AUXTYPE+1
|
||||
sta StatBuf+S.STAT.P.AUXTYPE+1
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
|
||||
jsr IO.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta StatBuf+S.STAT.P.AUXTYPE
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
|
||||
jsr IO.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
ora StatBuf+S.STAT.P.AUXTYPE
|
||||
sta StatBuf+S.STAT.P.AUXTYPE
|
||||
|
||||
pla
|
||||
tax
|
||||
tay
|
||||
lda #0
|
||||
sta (ZPPtr2),y
|
||||
rts
|
||||
|
||||
.9 plx
|
||||
|
||||
.99 stz StatBuf+S.STAT.P.AUXTYPE
|
||||
stz StatBuf+S.STAT.P.AUXTYPE+1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
IO.R.ReadDir.Type
|
||||
txa X = filename len
|
||||
sec
|
||||
sbc #4 "x.EXT" ?
|
||||
bcc .99
|
||||
beq .99
|
||||
|
||||
tay
|
||||
|
||||
lda (ZPPtr2),y
|
||||
cmp #'.'
|
||||
bne .99
|
||||
|
||||
phx
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 phy Y = '.' offset
|
||||
|
||||
.2 iny
|
||||
lda (ZPPtr2),y
|
||||
beq .4
|
||||
|
||||
cmp #'A'
|
||||
bcc .3
|
||||
|
||||
cmp #'Z'+1
|
||||
bcs .3
|
||||
|
||||
eor #$20
|
||||
|
||||
.3 cmp PRODOS.FT.TXT,x
|
||||
bne .5
|
||||
|
||||
inx
|
||||
bra .2
|
||||
|
||||
.4 txa
|
||||
lsr
|
||||
lsr
|
||||
tax
|
||||
lda PRODOS.FT.HEX,x
|
||||
sta StatBuf+S.STAT.P.TYPE
|
||||
|
||||
ply
|
||||
bra .8
|
||||
|
||||
.5 txa
|
||||
and #$FC
|
||||
clc
|
||||
adc #4
|
||||
tax
|
||||
|
||||
ply
|
||||
|
||||
cpx #PRODOS.FT.END
|
||||
bne .1
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
cmp #'0'
|
||||
bne .9
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
|
||||
jsr IO.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta StatBuf+S.STAT.P.TYPE
|
||||
|
||||
iny
|
||||
lda (ZPPtr2),y
|
||||
|
||||
jsr IO.IsHexDigit
|
||||
bcs .9
|
||||
|
||||
ora StatBuf+S.STAT.P.TYPE
|
||||
sta StatBuf+S.STAT.P.TYPE
|
||||
|
||||
.8 pla
|
||||
sec
|
||||
sbc #4
|
||||
tax
|
||||
|
||||
tay
|
||||
lda #0
|
||||
sta (ZPPtr2),y
|
||||
|
||||
rts
|
||||
|
||||
.9 plx
|
||||
|
||||
.99 stz StatBuf+S.STAT.P.TYPE
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
||||
*--------------------------------------
|
||||
IO.Q.CloseReg
|
||||
IO.Q.CloseDir tax
|
||||
@ -574,7 +688,7 @@ IO.Q.CloseDir tax
|
||||
|
||||
jmp IO.Exit
|
||||
*--------------------------------------
|
||||
* IO.R.CloseDir
|
||||
* IO.R.CloseDir
|
||||
*--------------------------------------
|
||||
* short int fopen ( const char *filename, short int flags, short int ftype, int auxtype );
|
||||
*--------------------------------------
|
||||
@ -594,18 +708,38 @@ IO.Q.FOpen >STYA pPath resolved path
|
||||
|
||||
jsr CORE.ReqSetupPtr2
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y TYPE
|
||||
pha
|
||||
|
||||
jsr CORE.AppendPathPtr2
|
||||
|
||||
pla
|
||||
phy
|
||||
|
||||
ldy #2
|
||||
lda (pStack),y TYPE
|
||||
beq .2
|
||||
|
||||
ply
|
||||
|
||||
jsr CORE.AppendTypePtr2
|
||||
|
||||
.2 jsr CORE.AddYReqLen
|
||||
phy
|
||||
|
||||
lda (pStack) AUXT
|
||||
tax
|
||||
|
||||
ldy #1
|
||||
ora (pStack),y
|
||||
beq .2
|
||||
|
||||
lda (pStack),y AUXT
|
||||
|
||||
ply
|
||||
|
||||
jsr CORE.AppendAuxTPtr2
|
||||
|
||||
phy
|
||||
|
||||
.2 ply
|
||||
|
||||
jsr CORE.AddYReqLen
|
||||
|
||||
tya
|
||||
|
||||
@ -784,8 +918,6 @@ IO.R.FClose sta hFILE
|
||||
|
||||
.99 jmp IO.SleepCont
|
||||
*--------------------------------------
|
||||
*
|
||||
*--------------------------------------
|
||||
IO.Q.FRead ldy #4 hFILE
|
||||
lda (pStack),y
|
||||
|
||||
@ -915,7 +1047,7 @@ IO.R.FRead jsr IO.ReadSocket
|
||||
>LDYA CIFS.Cnt
|
||||
|
||||
clc
|
||||
|
||||
|
||||
.98 >POP 5
|
||||
|
||||
jmp IO.Exit
|
||||
@ -1106,9 +1238,9 @@ IO.Q.FTell jsr IO.GetFD
|
||||
dey
|
||||
cpy #S.FD.REG.FPOS-1
|
||||
bne .1
|
||||
|
||||
|
||||
clc
|
||||
|
||||
|
||||
jmp IO.Exit
|
||||
*--------------------------------------
|
||||
* IO.R.FTell
|
||||
@ -1541,6 +1673,45 @@ IO.FileInfo2StatBufDT
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
IO.IsHexDigit jsr IO.IsDigit
|
||||
bcc .8
|
||||
|
||||
cmp #'A'
|
||||
bcc .9
|
||||
|
||||
cmp #'F'+1
|
||||
bcc .1
|
||||
|
||||
cmp #'a'
|
||||
bcc .9
|
||||
|
||||
cmp #'f'+1
|
||||
bcs .99
|
||||
|
||||
eor #$20
|
||||
|
||||
.1
|
||||
* clc
|
||||
sbc #'A'-11 cc so A->10 (11-CC)
|
||||
clc
|
||||
.8 rts
|
||||
|
||||
.9 sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
IO.IsDigit cmp #'0'
|
||||
bcc .9
|
||||
|
||||
cmp #'9'+1
|
||||
bcs .99
|
||||
|
||||
and #$0F
|
||||
* clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/sbin/cifsd.s.io
|
||||
LOAD usr/src/sbin/cifsd.s
|
||||
|
@ -450,7 +450,6 @@ PRODOS.FT.TXT .AZ "txt"
|
||||
.AZ "pak"
|
||||
.AZ "sys"
|
||||
PRODOS.FT.END .EQ *-PRODOS.FT.TXT
|
||||
PRODOS.FT.DFLT .AZ "$ "
|
||||
*--------------------------------------
|
||||
SMBERR01 .DA #2,#3,#32
|
||||
MLIERR01 .DA #MLI.E.FNOTFND,#MLI.E.PNOTFND,#MLI.E.OPEN
|
||||
|
@ -1,31 +0,0 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
ArgCount .BS 1
|
||||
bPause .BS 1
|
||||
|
||||
hSrcFullPath .BS 1
|
||||
Count .BS 2
|
||||
RC .BS 1
|
||||
|
||||
.DO X.COPY.TO.DEST=1
|
||||
hDstFileName .BS 1
|
||||
hDstFullPath .BS 1
|
||||
|
||||
bCopy .BS 1
|
||||
|
||||
hSrcFile .BS 1
|
||||
hDstFile .BS 1
|
||||
hCopyBuf .BS 1
|
||||
CopyRC .BS 1
|
||||
.FIN
|
||||
|
||||
.DO X.DELETE.SOURCE=1
|
||||
hToDelete .BS 1
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/shared/x.cpmvrm.g
|
||||
LOAD usr/src/bin/cp.s
|
||||
ASM
|
File diff suppressed because it is too large
Load Diff
@ -6,15 +6,17 @@ hDIRs .BS X.MAX.RECURSE+1
|
||||
hDIRENTs .BS X.MAX.RECURSE+1
|
||||
oDIRENTs .BS X.MAX.RECURSE*2
|
||||
STATBUF .BS S.STAT
|
||||
hFullPath .BS 1
|
||||
hSrcBasePath .BS 1
|
||||
hFilter .BS 1
|
||||
|
||||
hInclude .BS 1
|
||||
hExclude .BS 1
|
||||
|
||||
hSrcBasePath .BS 1
|
||||
.DO X.COPY.TO.DEST=1
|
||||
hDstBasePath .BS 1
|
||||
hDstFileName .BS 1
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/shared/x.fileenum.g
|
||||
LOAD usr/src/bin/ls.s
|
||||
LOAD usr/src/bin/cp.s
|
||||
ASM
|
||||
|
@ -4,7 +4,13 @@ NEW
|
||||
*--------------------------------------
|
||||
X.MAX.RECURSE .EQ 8
|
||||
*--------------------------------------
|
||||
* Uses: (pData)
|
||||
* Uses:
|
||||
* (ZP)
|
||||
* ZPPtr1 .BS 2
|
||||
* ZPPtr2 .BS 2
|
||||
* ZPFileName .BS 2
|
||||
* ZPFileStat .BS 2
|
||||
* (pData)
|
||||
* Index .BS 1
|
||||
* hDIRs .BS X.MAX.RECURSE+1
|
||||
* hDIRENTs .BS X.MAX.RECURSE+1
|
||||
@ -12,38 +18,35 @@ X.MAX.RECURSE .EQ 8
|
||||
* STATBUF .BS S.STAT
|
||||
* hSrcBasePath .BS 1
|
||||
* hDstBasePath .BS 1 (optional)
|
||||
* hFilter .BS 1
|
||||
* hInclude .BS 1
|
||||
* hExclude .BS 1
|
||||
*--------------------------------------
|
||||
* Compare a ZPFileName against hFilter (e.g. '*test?.*')
|
||||
* Compare a ZPFileName against hInclude (e.g. '*test?.*')
|
||||
* CC : match
|
||||
* CS : no match
|
||||
*--------------------------------------
|
||||
FilterMatch >LDA.G index
|
||||
X.IncludeMatch >LDA.G index
|
||||
dec
|
||||
bne FilterMatch.CLCRTS in a subdir, match everything
|
||||
bne X.FilterMatch.CLCRTS in a subdir, match everything
|
||||
|
||||
clc
|
||||
.HS B0 BCS
|
||||
|
||||
ExcludeMatch sec
|
||||
php
|
||||
lda #hFilter
|
||||
adc #0
|
||||
tay
|
||||
lda (pData),y
|
||||
plp
|
||||
|
||||
tax
|
||||
|
||||
beq FilterMatch.RTS No filter....exit with passed carry
|
||||
X.IgnoreMatch sec
|
||||
ldy #hInclude
|
||||
bcc .11
|
||||
|
||||
iny
|
||||
|
||||
.11 lda (pData),y
|
||||
beq X.FilterMatch.RTS No filter....exit with passed carry
|
||||
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtr2
|
||||
|
||||
ldy #S.STAT.FSID
|
||||
lda (ZPFileStat),y if 0, Regular ProDOS....
|
||||
pha save FSID for comapring later
|
||||
pha save FSID for comparing later
|
||||
bne .10
|
||||
|
||||
>LDYA ZPPtr2 ... so CI compare
|
||||
@ -57,7 +60,7 @@ ExcludeMatch sec
|
||||
ldy #0
|
||||
bra .2
|
||||
|
||||
.1 jsr FilterMatch.NextPtr2 get next pattern char
|
||||
.1 jsr X.FilterMatch.NextPtr2 get next pattern char
|
||||
beq .41 end of pattern...
|
||||
|
||||
.2 cmp #'*'
|
||||
@ -70,7 +73,7 @@ ExcludeMatch sec
|
||||
cmp #'?'
|
||||
beq .4 no need to compare, any char will match
|
||||
|
||||
jsr FilterMatch.CmpPtr2CharPtr1Y Regular Char, compare with string at Y
|
||||
jsr X.FilterMatch.CmpPtr2CharPtr1Y Regular Char, compare with string at Y
|
||||
bne .9 no match, exit
|
||||
|
||||
.4 iny advance to next char to compare
|
||||
@ -82,7 +85,7 @@ ExcludeMatch sec
|
||||
.9 sec
|
||||
rts
|
||||
|
||||
.5 jsr FilterMatch.NextPtr2 we have '*', last char of pattern ?
|
||||
.5 jsr X.FilterMatch.NextPtr2 we have '*', last char of pattern ?
|
||||
beq .8 yes, match everything, including empty string
|
||||
|
||||
cmp #'*' another '*' ?
|
||||
@ -95,40 +98,30 @@ ExcludeMatch sec
|
||||
beq .9 no chance to match ? or regular char
|
||||
|
||||
iny
|
||||
jsr FilterMatch.CmpPtr2CharPtr1Y compare with char in string
|
||||
jsr X.FilterMatch.CmpPtr2CharPtr1Y compare with char in string
|
||||
bne .7 not equal to next non wildcard in pattern
|
||||
|
||||
iny
|
||||
bra .1 go check remaining char in pattern...
|
||||
|
||||
.8
|
||||
FilterMatch.CLCRTS
|
||||
X.FilterMatch.CLCRTS
|
||||
clc
|
||||
FilterMatch.RTS
|
||||
X.FilterMatch.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
FilterMatch.CmpPtr2CharPtr1Y
|
||||
X.FilterMatch.CmpPtr2CharPtr1Y
|
||||
lda (ZPFileName),y
|
||||
phx
|
||||
plx
|
||||
bne .2 Foreign FS or ProDOS.FX : CS compare
|
||||
bne .1 Foreign FS or ProDOS.FX : CS compare
|
||||
|
||||
lda (ZPFileName),y
|
||||
cmp #'a'
|
||||
bcc .1
|
||||
|
||||
cmp #'z'+1
|
||||
bcs .1
|
||||
|
||||
eor #$20
|
||||
jsr X.ToUpper
|
||||
|
||||
.1 cmp (ZPPtr2)
|
||||
rts
|
||||
|
||||
.2 lda (ZPPtr2)
|
||||
cmp (ZPFileName),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
FilterMatch.NextPtr2
|
||||
X.FilterMatch.NextPtr2
|
||||
inc ZPPtr2 Make PTR2 advance to next char
|
||||
bne .1
|
||||
|
||||
@ -137,22 +130,19 @@ FilterMatch.NextPtr2
|
||||
.1 lda (ZPPtr2)
|
||||
rts
|
||||
*--------------------------------------
|
||||
InitSrcDirYA >PUSHYA
|
||||
>PUSHWZ Allocate
|
||||
>SYSCALL RealPath
|
||||
bcs FilterMatch.RTS
|
||||
X.InitSrcDirYA >STYA ZPPtr1
|
||||
|
||||
>STYA ZPPtr1
|
||||
txa
|
||||
>STA.G hFullPath
|
||||
X.InitSrcDirPtr1
|
||||
jsr X.InitGetBuf Get a 256 buffer to store BasePath
|
||||
bcs .99
|
||||
|
||||
>STA.G hSrcBasePath
|
||||
|
||||
ldy #1
|
||||
lda (ZPPtr1),y
|
||||
beq .5 we have '/'
|
||||
lda (ZPPtr2),y
|
||||
beq .8 we have '/'
|
||||
|
||||
>PUSHW ZPPtr1
|
||||
>PUSHEA.G STATBUF
|
||||
>SYSCALL Stat
|
||||
jsr X.Init.StatBuf
|
||||
bcs .1 File/DIR does not exists, go extract pattern
|
||||
|
||||
.DO X.ENTER.SUBDIR=1
|
||||
@ -169,15 +159,16 @@ InitSrcDirYA >PUSHYA
|
||||
.1 cmp #MLI.E.INVPATH
|
||||
beq .11
|
||||
|
||||
jmp .9
|
||||
sec
|
||||
rts
|
||||
|
||||
.11 jsr GetPtr1Len TYPE is not DIR, check if wc
|
||||
.11 jsr X.GetPtr2Len TYPE is not DIR, check if wc
|
||||
|
||||
dey
|
||||
|
||||
ldx #0 Init Wildcard count
|
||||
|
||||
.2 lda (ZPPtr1),y search backward for a /
|
||||
.2 lda (ZPPtr2),y search backward for a /
|
||||
cmp #'/'
|
||||
beq .3
|
||||
|
||||
@ -192,58 +183,16 @@ InitSrcDirYA >PUSHYA
|
||||
bne .2
|
||||
|
||||
.3 txa
|
||||
beq .90 no wc, file not found....
|
||||
beq .98 no wc, file not found....
|
||||
|
||||
.4 jsr GetPtr1Len Search end of string.....
|
||||
.4 jsr X.InitSplitBuf
|
||||
bcs .99
|
||||
|
||||
lda #'/'
|
||||
>STA.G hInclude
|
||||
|
||||
.42 dey
|
||||
cmp (ZPPtr1),y Search backward /
|
||||
bne .42
|
||||
|
||||
tya
|
||||
sec +1 to skip '/'
|
||||
adc ZPPtr1
|
||||
sta ZPPtr2
|
||||
tay
|
||||
lda ZPPtr1+1
|
||||
adc #0
|
||||
sta ZPPtr2+1
|
||||
|
||||
>SYSCALL StrDup
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
>STA.G hFilter
|
||||
|
||||
lda #0
|
||||
sta (ZPPtr2) cut path at last '/' to remove wildcards
|
||||
|
||||
.5 >LDYAI 256
|
||||
>SYSCALL GetMem Get a 256 buffer to store BasePath
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr2
|
||||
txa
|
||||
>STA.G hSrcBasePath
|
||||
|
||||
jsr StrcpyPtr1ptr2
|
||||
|
||||
dey
|
||||
lda #'/'
|
||||
cmp (ZPPtr2),y
|
||||
beq .7
|
||||
|
||||
iny
|
||||
sta (ZPPtr2),y
|
||||
iny
|
||||
lda #0
|
||||
sta (ZPPtr2),y
|
||||
|
||||
.7 >LDYA ZPPtr2
|
||||
.8 >LDYA ZPPtr2
|
||||
>SYSCALL OpenDir
|
||||
bcs .9
|
||||
bcs .99
|
||||
|
||||
ldy #hDIRs
|
||||
sta (pData),y set hDIRs[0] = Src Hdir
|
||||
@ -251,22 +200,16 @@ InitSrcDirYA >PUSHYA
|
||||
lda #1
|
||||
sta (pData),y index=hDIRs[0]
|
||||
|
||||
jsr .9 Cleanup
|
||||
* clc
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.90 lda #MLI.E.FNOTFND
|
||||
|
||||
.9 pha
|
||||
>LDA.G hFullPath
|
||||
>SYSCALL FreeMem
|
||||
pla
|
||||
.98 lda #MLI.E.INVPATH
|
||||
sec
|
||||
InitSrcDirYA.RTS
|
||||
rts
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
ResetSrcDir jsr GethDIR
|
||||
.DO X.RESETSRCDIR=1
|
||||
X.ResetSrcDir jsr X.GethDIR
|
||||
|
||||
>SYSCALL CloseDir
|
||||
|
||||
@ -287,92 +230,107 @@ ResetSrcDir jsr GethDIR
|
||||
|
||||
* clc
|
||||
.9 rts
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
.DO X.COPY.TO.DEST=1
|
||||
InitDstDirYA >PUSHYA
|
||||
>PUSHWZ Allocate
|
||||
>SYSCALL RealPath
|
||||
bcs InitSrcDirYA.RTS
|
||||
X.InitDstDirYA >STYA ZPPtr1
|
||||
|
||||
>STYA ZPPtr1
|
||||
txa
|
||||
>STA.G hFullPath
|
||||
|
||||
>PUSHW ZPPtr1
|
||||
>PUSHEA.G STATBUF
|
||||
>SYSCALL Stat
|
||||
X.InitDstDirPtr1
|
||||
jsr X.InitGetBuf Get a 256 buffer to store BasePath
|
||||
bcs .99
|
||||
|
||||
>STA.G hDstBasePath
|
||||
|
||||
jsr X.Init.StatBuf
|
||||
bcs .1 File/DIR does not exists, go extract DstFileName
|
||||
|
||||
>LDA.G STATBUF+S.STAT.MODE+1
|
||||
and #$F0
|
||||
cmp /S.STAT.MODE.DIR
|
||||
beq .5 Dst is a directory...no destfilename
|
||||
beq .8 Dst is a directory...no hDstFileName
|
||||
|
||||
.1 jsr GetPtr1Len Search end of string.....
|
||||
.1 jsr X.InitSplitBuf
|
||||
bcs .99
|
||||
|
||||
>STA.G hDstFileName
|
||||
|
||||
.8 jmp X.NormalizePtr2
|
||||
|
||||
.99 rts
|
||||
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
X.InitGetBuf >LDYAI 256
|
||||
>SYSCALL GetMem Get a 256 buffer to store BasePath
|
||||
bcs .99
|
||||
|
||||
>STYA ZPPtr2
|
||||
phx
|
||||
|
||||
>PUSHW ZPPtr1
|
||||
>PUSHW ZPPtr2
|
||||
>SYSCALL RealPath
|
||||
bcs .98
|
||||
|
||||
pla hBuf
|
||||
|
||||
* clc
|
||||
|
||||
rts
|
||||
|
||||
.98 plx
|
||||
|
||||
pha
|
||||
txa
|
||||
>SYSCALL FreeMem
|
||||
pla
|
||||
|
||||
sec
|
||||
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
X.Init.StatBuf >PUSHW ZPPtr2
|
||||
>PUSHEA.G STATBUF
|
||||
>SYSCALL Stat
|
||||
rts
|
||||
*--------------------------------------
|
||||
X.InitSplitBuf jsr X.GetPtr2Len Search end of string.....
|
||||
|
||||
lda #'/'
|
||||
|
||||
.2 dey
|
||||
cmp (ZPPtr1),y Search backward /
|
||||
bne .2
|
||||
.1 dey
|
||||
cmp (ZPPtr2),y Search backward /
|
||||
bne .1
|
||||
|
||||
tya
|
||||
sec +1 to skip '/'
|
||||
adc ZPPtr1
|
||||
sta ZPPtr2
|
||||
tay
|
||||
lda ZPPtr1+1
|
||||
adc ZPPtr2
|
||||
sta ZPPtr1
|
||||
|
||||
lda ZPPtr2+1
|
||||
adc #0
|
||||
sta ZPPtr2+1
|
||||
sta ZPPtr1+1
|
||||
|
||||
lda (ZPPtr1)
|
||||
beq .8 path is /dir/
|
||||
|
||||
>LDYA ZPPtr1
|
||||
>SYSCALL StrDup
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
>STA.G hDstFileName
|
||||
bcs .99
|
||||
|
||||
lda #0
|
||||
sta (ZPPtr2)
|
||||
sta (ZPPtr1)
|
||||
|
||||
.5 >LDYAI 256
|
||||
>SYSCALL GetMem Get a 256 buffer to store DstBasePath
|
||||
bcs .9
|
||||
|
||||
>STYA ZPPtr2
|
||||
txa
|
||||
>STA.G hDstBasePath
|
||||
|
||||
jsr StrcpyPtr1ptr2
|
||||
.8 clc
|
||||
|
||||
dey
|
||||
|
||||
lda #'/'
|
||||
cmp (ZPPtr2),y
|
||||
beq .7
|
||||
|
||||
iny
|
||||
sta (ZPPtr2),y
|
||||
iny
|
||||
lda #0
|
||||
sta (ZPPtr2),y
|
||||
|
||||
.7 jsr .9 Cleanup
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 pha
|
||||
>LDA.G hFullPath
|
||||
>SYSCALL FreeMem
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
.FIN
|
||||
.99 rts
|
||||
*--------------------------------------
|
||||
GetNextEntry jsr GetEntry
|
||||
X.GetNextEntry jsr X.GetEntry
|
||||
bcs .9
|
||||
|
||||
jsr GetFilenameLen Save actual file len for setting up
|
||||
jsr X.GetFilenameLen Save actual file len for setting up
|
||||
pha new offset later
|
||||
lda ZPFileStat
|
||||
clc
|
||||
@ -383,12 +341,12 @@ GetNextEntry jsr GetEntry
|
||||
adc /S.STAT
|
||||
sta ZPFileName+1 Make nDIRENTs[i] point to next DIRENT
|
||||
|
||||
jsr GetFilenameLen are we at end of this buffer ?
|
||||
jsr X.GetFilenameLen are we at end of this buffer ?
|
||||
beq .1 yes, go read next one ...
|
||||
|
||||
jsr SetFileStatPtr
|
||||
jsr X.SetFileStatPtr
|
||||
|
||||
jsr GetoDIRENT
|
||||
jsr X.GetoDIRENT
|
||||
|
||||
pla Get back previous file len
|
||||
sec
|
||||
@ -413,13 +371,13 @@ GetNextEntry jsr GetEntry
|
||||
rts
|
||||
|
||||
.1 pla
|
||||
jsr GetEntry.ReadDir
|
||||
jsr X.GetEntry.ReadDir
|
||||
bcs .9
|
||||
|
||||
jsr GetFilenameLen
|
||||
jsr X.GetFilenameLen
|
||||
beq .99
|
||||
|
||||
jsr SetFileStatPtr
|
||||
jsr X.SetFileStatPtr
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
@ -427,10 +385,10 @@ GetNextEntry jsr GetEntry
|
||||
.99 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
GetEntry jsr GethDIRENT
|
||||
X.GetEntry jsr X.GethDIRENT
|
||||
bne .1 we have a buffer to scan
|
||||
|
||||
jsr GetEntry.ReadDir First run, get first block
|
||||
jsr X.GetEntry.ReadDir First run, get first block
|
||||
bcs .9 ZPFileName = start of buffer
|
||||
|
||||
lda (ZPFileName) Empty !!!
|
||||
@ -441,7 +399,7 @@ GetEntry jsr GethDIRENT
|
||||
|
||||
.1 >SYSCALL GetMemPtr
|
||||
>STYA ZPFileName
|
||||
jsr GetoDIRENT
|
||||
jsr X.GetoDIRENT
|
||||
|
||||
lda ZPFileName
|
||||
clc
|
||||
@ -454,15 +412,15 @@ GetEntry jsr GethDIRENT
|
||||
adc (pData),y
|
||||
sta ZPFileName+1 ZPFileName=ZPFileName+oDIRENT
|
||||
|
||||
.8 jsr GetFilenameLen
|
||||
.8 jsr X.GetFilenameLen
|
||||
|
||||
jsr SetFileStatPtr
|
||||
jsr X.SetFileStatPtr
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
GetEntry.ReadDir
|
||||
jsr GethDIRENT
|
||||
X.GetEntry.ReadDir
|
||||
jsr X.GethDIRENT
|
||||
beq .1
|
||||
|
||||
pha
|
||||
@ -471,7 +429,7 @@ GetEntry.ReadDir
|
||||
pla
|
||||
>SYSCALL FreeMem discard previous hDIRENT
|
||||
|
||||
.1 jsr GethDIR
|
||||
.1 jsr X.GethDIR
|
||||
>SYSCALL ReadDir
|
||||
bcs .9
|
||||
|
||||
@ -484,7 +442,7 @@ GetEntry.ReadDir
|
||||
txa get hDIRENT in A
|
||||
sta (pData),y
|
||||
|
||||
jsr GetoDIRENT
|
||||
jsr X.GetoDIRENT
|
||||
|
||||
lda #0 and reset offset for this buffer
|
||||
sta (pData),y
|
||||
@ -493,15 +451,15 @@ GetEntry.ReadDir
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
|
||||
X.EnterSubDirYA >STYA ZPPtr1 save SUBDIR for StrCat
|
||||
|
||||
>LDA.G index
|
||||
cmp #X.MAX.RECURSE
|
||||
beq .9
|
||||
|
||||
ldy #hSrcBasePath
|
||||
jsr EnterSubDirY
|
||||
>LDYA ZPPtr1
|
||||
jsr X.EnterSubDirY
|
||||
>LDYA ZPPtr2
|
||||
>SYSCALL OpenDir
|
||||
bcs .9
|
||||
|
||||
@ -521,44 +479,44 @@ EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
|
||||
|
||||
.DO X.COPY.TO.DEST=1
|
||||
ldy #hDstBasePath
|
||||
jsr EnterSubDirY
|
||||
jsr X.EnterSubDirY
|
||||
.FIN
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
|
||||
EnterSubDirY lda (pData),y
|
||||
*--------------------------------------
|
||||
X.EnterSubDirY lda (pData),y
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtr1 save full path
|
||||
>STYA ZPPtr2 save full path
|
||||
|
||||
jsr .1 Make sure ending with /
|
||||
|
||||
>PUSHW ZPPtr1
|
||||
>PUSHW ZPPtr2
|
||||
>PUSHW ZPPtr1
|
||||
>SYSCALL StrCat
|
||||
|
||||
.1 jsr GetPtr1Len
|
||||
X.NormalizePtr2 jsr X.GetPtr2Len
|
||||
|
||||
dey
|
||||
lda #'/'
|
||||
cmp (ZPPtr1),y
|
||||
cmp (ZPPtr2),y
|
||||
beq .8
|
||||
|
||||
iny
|
||||
sta (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
|
||||
iny
|
||||
lda #0
|
||||
sta (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
|
||||
.8 rts
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
LeaveSubDir >LDA.G index
|
||||
X.LeaveSubDir >LDA.G index
|
||||
beq .7
|
||||
|
||||
jsr GethDIRENT.A
|
||||
jsr LeaveSubDir.free
|
||||
jsr X.GethDIRENT.A
|
||||
jsr X.LeaveSubDir.free
|
||||
|
||||
jsr GethDIR
|
||||
jsr X.GethDIR
|
||||
beq .1
|
||||
|
||||
pha
|
||||
@ -571,11 +529,11 @@ LeaveSubDir >LDA.G index
|
||||
bne .8
|
||||
|
||||
.7 >LDA.G hSrcBasePath
|
||||
jsr LeaveSubDir.free
|
||||
jsr X.LeaveSubDir.free
|
||||
|
||||
.DO X.COPY.TO.DEST=1
|
||||
>LDA.G hDstBasePath
|
||||
jsr LeaveSubDir.free
|
||||
jsr X.LeaveSubDir.free
|
||||
.FIN
|
||||
|
||||
sec
|
||||
@ -584,7 +542,7 @@ LeaveSubDir >LDA.G index
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
LeaveSubDir.free
|
||||
X.LeaveSubDir.free
|
||||
tax
|
||||
beq .8
|
||||
|
||||
@ -595,51 +553,53 @@ LeaveSubDir.free
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
BasePath.. .DO X.COPY.TO.DEST=1
|
||||
X.BasePath.. .DO X.COPY.TO.DEST=1
|
||||
|
||||
ldy #hDstBasePath
|
||||
jsr BasePath..1
|
||||
jsr X.BasePath..1
|
||||
.FIN
|
||||
ldy #hSrcBasePath
|
||||
|
||||
BasePath..1 lda (pData),y
|
||||
X.BasePath..1 lda (pData),y
|
||||
>SYSCALL GetMemPtr
|
||||
>STYA ZPPtr1 save full path
|
||||
>STYA ZPPtr2 save full path
|
||||
|
||||
jsr GetPtr1Len get len
|
||||
jsr X.GetPtr2Len get len
|
||||
|
||||
dey discard ending /
|
||||
|
||||
.2 dey
|
||||
lda (ZPPtr1),y
|
||||
lda (ZPPtr2),y
|
||||
cmp #'/'
|
||||
bne .2
|
||||
|
||||
iny
|
||||
lda #0
|
||||
sta (ZPPtr1),y cut DIR2/ from /dir1/DIR2/
|
||||
sta (ZPPtr2),y cut DIR2/ from /dir1/DIR2/
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
GetPtr1Len ldy #$ff
|
||||
X.ToUpper cmp #'a'
|
||||
bcc .8
|
||||
|
||||
cmp #'z'+1
|
||||
bcs .8
|
||||
|
||||
eor #$20
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
X.GetPtr2Len ldy #$ff
|
||||
|
||||
.1 iny
|
||||
|
||||
lda (ZPPtr1),y get len
|
||||
lda (ZPPtr2),y get len
|
||||
bne .1
|
||||
|
||||
rts
|
||||
rts
|
||||
*--------------------------------------
|
||||
StrcpyPtr1ptr2 ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPPtr1),y
|
||||
sta (ZPPtr2),y
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
GetFilenameLen ldy #$ff
|
||||
X.GetFilenameLen
|
||||
ldy #$ff
|
||||
|
||||
.1 iny
|
||||
lda (ZPFileName),y
|
||||
@ -648,7 +608,8 @@ GetFilenameLen ldy #$ff
|
||||
tya
|
||||
rts
|
||||
*--------------------------------------
|
||||
SetFileStatPtr sec
|
||||
X.SetFileStatPtr
|
||||
sec
|
||||
adc ZPFileName
|
||||
sta ZPFileStat
|
||||
lda ZPFileName+1
|
||||
@ -656,7 +617,7 @@ SetFileStatPtr sec
|
||||
sta ZPFileStat+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
GethDIR >LDA.G index
|
||||
X.GethDIR >LDA.G index
|
||||
|
||||
clc
|
||||
adc #hDIRs-1
|
||||
@ -664,15 +625,15 @@ GethDIR >LDA.G index
|
||||
lda (pData),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
GethDIRENT >LDA.G index
|
||||
X.GethDIRENT >LDA.G index
|
||||
|
||||
GethDIRENT.A clc
|
||||
X.GethDIRENT.A clc
|
||||
adc #hDIRENTs-1
|
||||
tay
|
||||
lda (pData),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
GetoDIRENT >LDA.G index
|
||||
X.GetoDIRENT >LDA.G index
|
||||
asl
|
||||
clc
|
||||
adc #oDIRENTs-1
|
||||
@ -681,5 +642,5 @@ GetoDIRENT >LDA.G index
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/shared/x.fileenum.s
|
||||
LOAD usr/src/bin/ls.s
|
||||
LOAD usr/src/bin/cp.s
|
||||
ASM
|
||||
|
Loading…
x
Reference in New Issue
Block a user