CIFS, UNAME -h -v switches, KERNEL IRQ manager, bugfix & bytes saved in CP,RM,MV

This commit is contained in:
Rémy GIBERT 2021-06-26 22:24:25 +02:00
parent d3c27ab61b
commit 9ae1da903b
17 changed files with 618 additions and 371 deletions

Binary file not shown.

Binary file not shown.

View File

@ -19,14 +19,17 @@ X.DELETE.SOURCE .EQ 0
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AS "CRYQcryq"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet
OptionList .AS "CcQqRrYy"
OptionVars .DA #bContinue,#bContinue
.DA #bQuiet,#bQuiet
.DA #bRecurse,#bRecurse
.DA #bNoConfirm,#bNoConfirm
*--------------------------------------
MSG.USAGE .AS "Usage : CP [Src File/Dir, *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
.AS " -Q : Quiet\r\n"
.AS " -R : Recurse subdirectories\r\n"
.AZ " -Y : Dont't prompt for override\r\n"
.AZ " -Y : Don't prompt for override\r\n"
MSG.DIR .AZ "CP Dir :%s to %s..."
MSG.REG .AZ "CP File:%s to %s..."
MSG.OVERWRITE .AZ "Overwrite %s [Yes,No,All]?"
@ -37,12 +40,7 @@ MSG.DONE .AZ "%D File(s) Copied.\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
bContinue .BS 1
bRecurse .BS 1
bNoConfirm .BS 1
bQuiet .BS 1
.INB usr/src/shared/x.cpmvrm.g
DS.START .INB usr/src/shared/x.cpmvrm.g
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------

View File

@ -19,8 +19,11 @@ X.DELETE.SOURCE .EQ 1
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AS "CRYQcryq"
OptionVars .DA #bContinue,#bRecurse,#bNoConfirm,#bQuiet,#bContinue,#bRecurse,#bNoConfirm,#bQuiet
OptionList .AS "CcQqRrYy"
OptionVars .DA #bContinue,#bContinue
.DA #bQuiet,#bQuiet
.DA #bRecurse,#bRecurse
.DA #bNoConfirm,#bNoConfirm
*--------------------------------------
MSG.USAGE .AS "Usage : MV [Src File/Dir, *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
@ -37,12 +40,7 @@ MSG.DONE .AZ "%D File(s) Moved.\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
bContinue .BS 1
bRecurse .BS 1
bNoConfirm .BS 1
bQuiet .BS 1
.INB usr/src/shared/x.cpmvrm.g
DS.START .INB usr/src/shared/x.cpmvrm.g
.INB usr/src/shared/x.fileenum.g
DS.END .ED
*--------------------------------------

View File

@ -19,8 +19,10 @@ X.DELETE.SOURCE .EQ 1
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AS "CRQcrq"
OptionVars .DA #bContinue,#bRecurse,#bQuiet,#bContinue,#bRecurse,#bQuiet
OptionList .AS "CcQqRr"
OptionVars .DA #bContinue,#bContinue
.DA #bQuiet,#bQuiet
.DA #bRecurse,#bRecurse
*--------------------------------------
MSG.USAGE .AS "Usage : RM [File/Dir, *,? wildcards allowed]\r\n"
.AS " -C : Continue on error\r\n"
@ -35,14 +37,9 @@ MSG.DONE .AZ "%D File(s) Removed.\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
bContinue .BS 1
bRecurse .BS 1
bQuiet .BS 1
.INB usr/src/shared/x.cpmvrm.g
DS.START .INB usr/src/shared/x.cpmvrm.g
.INB usr/src/shared/x.fileenum.g
DS.END
.ED
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/rm.s

View File

@ -18,8 +18,7 @@ ZPPtr2 .BS 2
Index .BS 1
Count .BS 1
BufPtr .BS 2
hBuf .BS 1
hFILE .BS 1
bHostName .BS 1
@ -114,7 +113,11 @@ CS.RUN ldy #S.PS.ARGC
CS.RUN.PRINT bit bHostName
bpl .1
jsr CS.RUN.GetHostName
bcs .1
>LDYA pData
jsr CS.RUN.PRINTYA
.1 bit bMachineType
bpl .2
@ -204,38 +207,61 @@ CS.RUN.PRINT bit bHostName
sec
rts
*--------------------------------------
CS.RUN.GetHostName
>LDYA L.ETCHOSTNAME
bra CS.RUN.GetFile
CS.RUN.GetBuild >LDYA L.ETCVERSION
>SYSCALL LoadTxtFile
CS.RUN.GetFile stz hFILE
>PUSHYA
>PUSHBI O.RDONLY
>PUSHBI 0
sta (pData)
>PUSHWZ
>SYSCALL FOpen
bcs .9
stx hBuf
txa
>SYSCALL GetMemPtr
>STYA BufPtr
sta hFILE
>LEA.G FGetSBuf
>STYA ZPPtr1
.1 >PUSHB hFILE
>PUSHW ZPPtr1
>PUSHWI 64
>SYSCALL FGetS
bcs .8
lda (ZPPtr1)
beq .1
cmp #'#'
beq .1
ldy #$ff
.1 iny
lda (BufPtr),y
beq .2
cmp #C.CR
beq .2
cpy #64
beq .2
.2 iny
lda (ZPPtr1),y
sta (pData),y
bra .1
bne .2
.8 clc
.2 lda #0
sta (pData),y
.9 php
pha
lda hBuf
>SYSCALL FreeMem
* clc
lda hFILE
beq .90
.9 rts
>SYSCALL FClose
.90 pla
plp
rts
*--------------------------------------
CS.RUN.PRINTYA >PUSHYA
>PUSHBI 0
@ -279,7 +305,7 @@ CS.RUN.CheckOpt ldy #1
*--------------------------------------
CS.END
*--------------------------------------
OptionList .AS "HhMmCcSsAaVvKkZz"
OptionList .AS "HhMmCcSsAaVvBbKkZz"
OptionVars .DA #bHostName,#bHostName
.DA #bMachineType,#bMachineType
.DA #bCPUType,#bCPUType
@ -321,6 +347,7 @@ KERNEL.PREEMPT .AZ "Preemptive_Mode"
.DUMMY
.OR 0
DS.START .BS 65
FGetSBuf .BS 65
DS.END .ED
*--------------------------------------
MAN

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
*--------------------------------------
K.VER .EQ $5E00 94.0
K.VER .EQ $5E00 94.0
K.ENV.SIZE .EQ 256
*--------------------------------------
K.MEM.ALIGN .EQ 16
@ -176,7 +176,7 @@ AF.INET .EQ 2
AF.APPLETALK .EQ 4
*--------------------------------------
O.RDONLY .EQ %00000001
O.WRONLY .EQ %00000010
O.WRONLY .EQ %00000010
O.RDWR .EQ %00000011
O.TRUNC .EQ %00000100
O.APPEND .EQ %00001000
@ -481,7 +481,7 @@ S.FD.PFT .EQ 1
S.FD.REG.REF .EQ 2
S.FD.REG.IOBUF .EQ 3
*
S.FD.REG .EQ 4
S.FD.REG .EQ 16
*--------------------------------------
S.FD.DIR.EL .EQ 4
S.FD.DIR.EPB .EQ 5
@ -491,7 +491,7 @@ S.FD.DIR.UID .EQ 10
S.FD.DIR.GID .EQ 12
S.FD.DIR.MODE .EQ 14
*
S.FD.DIR .EQ 16
S.FD.DIR .EQ 16
*--------------------------------------
S.FD.DEV.BUSID .EQ 2
S.FD.DEV.DEVID .EQ 3
@ -610,7 +610,7 @@ S.TIME.WDAY .EQ 7 1..7
*
S.TIME .EQ 8
*--------------------------------------
* S.STAT
* S.STAT
*--------------------------------------
S.STAT.MODE .EQ 0
S.STAT.MODE.XO .EQ $0001

View File

@ -1,10 +1,10 @@
NEW
AUTO 3,1
*--------------------------------------
IO.D2.SeekTimeR .EQ 58 LIBBLKDEV Recalibration
IO.D2.SeekTimeF .EQ 58 LIBBLKDEV Track Formatter
IO.D2.SeekTimeB .EQ 28 LIBBLKDEV Boot Block
IO.D2.SeekTimeP .EQ 28 ProDOS.FX initial
IO.D2.SeekTimeR .EQ 45 LIBBLKDEV Recalibration
IO.D2.SeekTimeF .EQ 55 LIBBLKDEV Track Formatter
IO.D2.SeekTimeB .EQ 55 LIBBLKDEV Boot Block
IO.D2.SeekTimeP .EQ 40 ProDOS.FX initial
IO.D2.SeekTimeI .EQ 10 ProDOS.FX increment -> until > 128
*--------------------------------------
IO.D2.Ph0Off .EQ $C080

View File

@ -395,13 +395,12 @@ BB.Seek lda BB.HdrTrk get track we're on
lda #0
jsr BB.Wait100usecA
lda IO.D2.Ph0Off,y
bcc .90
bcc .10
lda IO.D2.Ph0Off,x
.90
nop
nop
.10 lda IO.D2.Ph0Off,y
*--------------------------------------
BB.Read ldx BB.Slotn0

View File

@ -136,13 +136,13 @@ D2.MoveHead.SEI lda D2.CurrentQTrack
jsr D2.Wait25600usec
lda IO.D2.Ph0Off,y
bcc .90
lda IO.D2.Ph0Off,x
nop
nop
.90 lda IO.D2.Ph0Off,y
.90
rts
*--------------------------------------
D2.SeekPhOnY and #6

View File

@ -20,7 +20,7 @@ CIFS.Stat >STYA pPath resolved path
jsr GetCTX
jsr MakeTrans2Req
jsr RequestT2SetupX
ldx #0
@ -49,6 +49,8 @@ CIFS2.Stat jsr ReadSocket
jsr GetRespData
jsr CheckSMBStatus
lda #MLI.E.INVPATH Return this for stat() match ProDOS Behavior
bcs .90
jsr GetRespDataPtr1
@ -72,9 +74,11 @@ CIFS2.Stat jsr ReadSocket
*--------------------------------------
CIFS.MKDir >STYA pPath resolved path
jsr ClearSocket
jsr GetCtx
jsr MakeTrans2Req
jsr RequestT2SetupX
ldx #0
@ -172,7 +176,7 @@ CIFS.ReadDir jsr GetPFD
ora (pFD),y
bne CIFS.ReadDir.Next
jsr MakeTrans2Req
jsr RequestT2SetupX
ldx #0
@ -186,7 +190,7 @@ CIFS.ReadDir jsr GetPFD
bra CIFS.ReadDir.Send
CIFS.ReadDir.Next
jsr MakeTrans2Req
jsr RequestT2SetupX
ldx #0
@ -500,16 +504,20 @@ CIFS.FOpen >STYA pPath resolved path
ldy #3 fopen flags
lda (pStack),y
bpl .3 O.CREATE
bit #O.WRONLY
beq .8
bit #O.CREATE
bne .3
ldx #3 FILE_OPEN_IF
.3 bit #O.APPEND
bmi .4
bne .8
ldx #5 FILE_OVERWRITE_IF
.4 txa
.8 txa
ldy #S.NETBIOS+S.SMB.H+SMB.Trans2.H.Len+7 CreateDisposition
sta (ZPReqPtr),y
@ -529,19 +537,9 @@ CIFS2.FOpen jsr ReadSocket
jsr CheckSMBStatus
bcs .90
>LDYAI S.FD.REG
>SYSCALL2 GetMem
jsr CIFS.NewFD
bcs .91
>STYA pFD
lda #S.FD.T.REG
sta (pFD)
lda hHandler
ldy #S.FD.PFT
sta (pFD),y
ldy #S.NETBIOS+S.SMB.H+6 FileID
lda (ZPRespPtr),y
pha
@ -553,8 +551,35 @@ CIFS2.FOpen jsr ReadSocket
dey
pla
sta (pFD),y
ldy #3 fopen flags
lda (pStack),y
bit #O.APPEND
beq .3
ldy #4 path
ldy #S.NETBIOS+S.SMB.H+56+3 EOF
ldx #4
.1 lda (ZPRespPtr),y
pha
dey
dex
bne .1
ldx #4
ldy #S.FD.REG.REF+2
.2 pla
sta (pFD),y
iny
dex
bne .2
bra .8
.3 jsr CIFS.Seek0
.8 ldy #4 path
lda (pStack),y
>PUSHA
@ -562,11 +587,10 @@ CIFS2.FOpen jsr ReadSocket
>PUSHA
>PUSHWZ mod
txa hFD
>PUSHA
>PUSHB hFD
>SYSCALL2 mknod
.91 jsr Exit.OK
.91 jsr Exit.KO
bra .90
.9 jsr Exit.NODATA
@ -656,19 +680,24 @@ CIFS.FRead ldy #4 hNod
jsr ReqSetupPtr2
ldy #S.FD.REG.REF
lda (pFD),y
pha
iny
lda (pFD),y
ldy #S.NETBIOS+S.SMB.H+6 FileID
sta (ZPReqPtr),y
pla
dey
sta (ZPReqPtr),y
jsr CIFS.RWGetFidOfs
ldy #1 DataLen HI
lda (pStack),y
bne .2
lda #0
ldx #1 256 bytes to read
bra .3
.2 lda (pStack) DataLen LO
ldx #0
.3 ldy #S.NETBIOS+S.SMB.H+11 MaxCountOfBytesToReturn
sta (ZPReqPtr),y
iny
txa
sta (ZPReqPtr),y
jsr SetReqLen
@ -687,18 +716,84 @@ CIFS2.FRead jsr ReadSocket
jsr CheckSMBStatus
bcs .90
lda hResp
>SYSCALL2 FreeMem
ldy #S.NETBIOS+S.SMB.H+10
lda (ZPRespPtr),y
iny
ora (ZPRespPtr),y
bne .10
jsr Exit.OK
lda #MLI.E.EOF
sec
bra .90
ldy #1
.10 ldy #S.NETBIOS+S.SMB.H+13 DataOffset LO
lda (ZPRespPtr),y
inc
inc
* clc
adc ZPRespPtr
sta ZPPtr1
lda #0
adc ZPRespPtr+1
sta ZPPtr1+1
ldy #3 DataPtr HI
lda (pStack),y
ora (pStack)
clc
beq .90
sta ZPPtr2+1
stz CIFS.Status Back to CIFS.FRead for next chunk
dey DataPtr LO
lda (pStack),y
sta ZPPtr2
jmp Sleep2
ldy #S.NETBIOS+S.SMB.H+11 DataLength LO
lda (ZPRespPtr),y
tax
jsr CIFS.CopyX
ldy #S.NETBIOS+S.SMB.H+11
jsr CIFS2.RWSetOfsY
ldy #S.NETBIOS+S.SMB.H+11 DataLength HI
lda (ZPRespPtr),y
beq .2 less than 256
inc CIFS.Cnt+1
ldy #1 DataLen HI
lda (pStack),y
dec
sta (pStack),y
ldy #3 DataPtr HI
lda (pStack),y
inc
sta (pStack),y
bra .7
.2 dey DataLength LO
lda (ZPRespPtr),y
sta CIFS.Cnt
lda #0
sta (pStack) DataLen LO
.7 jsr Exit.OK
ldy #1 DataLen HI
lda (pStack),y
ora (pStack) DataLen LO
bne .8
>LDYA CIFS.Cnt
bra .90
.8 jmp Sleep2 Back to CIFS.FRead for next chunk
.9 jsr Exit.NODATA
beq .99
@ -726,18 +821,8 @@ CIFS.FWrite ldy #4 hNod
bne .1
jsr ReqSetupPtr2
ldy #S.FD.REG.REF
lda (pFD),y
pha
iny
lda (pFD),y
ldy #S.NETBIOS+S.SMB.H+6 FileID
sta (ZPReqPtr),y
pla
dey
sta (ZPReqPtr),y
jsr CIFS.RWGetFidOfs
ldy #3 DataPtr HI
lda (pStack),y
@ -762,14 +847,11 @@ CIFS.FWrite ldy #4 hNod
.6 pha
ldy #S.NETBIOS+S.SMB.H+21 DataLength
clc
adc #2
sta (ZPReqPtr),y
iny
txa
adc #0
sta (ZPReqPtr),y
pla
@ -791,15 +873,10 @@ CIFS.FWrite ldy #4 hNod
iny
sta (ZPReqPtr),y
ldy #0
plx
.70 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
dex
bne .70
jsr CIFS.CopyX
jsr SetReqLen
jsr WriteSocket
@ -834,18 +911,31 @@ CIFS2.FWrite jsr ReadSocket
jsr CheckSMBStatus
bcs .90
lda hResp
>SYSCALL2 FreeMem
ldy #S.NETBIOS+S.SMB.H+5 Count LO
jsr CIFS2.RWSetOfsY
ldy #1
ldy #S.NETBIOS+S.SMB.H+5 Count LO
lda (ZPRespPtr),y
bne .1
inc CIFS.Cnt+1
bra .7
.1 sta CIFS.Cnt
.7 jsr Exit.OK
ldy #1 DataLen HI
lda (pStack),y
ora (pStack)
ora (pStack) DataLen LO
bne .8
>LDYA CIFS.Cnt
clc
beq .90
bra .90
stz CIFS.Status Back to CIFS.FWrite for next chunk
jmp Sleep2
.8 jmp Sleep2
.9 jsr Exit.NODATA
beq .99
@ -870,7 +960,7 @@ CIFS.Remove >STYA pPath resolved path
jsr ClearSocket
jsr GetCTX
ldx #S.SMB.H.CMD.DELETE
jsr RequestSetupX
@ -955,6 +1045,15 @@ CIFS.Rename >STYA pPath resolved src path
ldy #1
lda (pStack),y
sta pPath+1
.2 inc pPath skip /mount
bne .3
inc pPath+1
.3 lda (pPath)
cmp #'/'
bne .2
lda #$04 BufferFormat
jsr PutBytePtr2
@ -991,6 +1090,104 @@ CIFS2.Rename jsr ReadSocket
.99 >RET 4
*--------------------------------------
CIFS.NewFD >LDYAI S.FD.REG
>SYSCALL2 GetMem
bcs .9
>STYA pFD
stx hFD
lda #S.FD.T.REG
sta (pFD)
lda hHandler
ldy #S.FD.PFT
sta (pFD),y
* clc
.9 rts
*--------------------------------------
CIFS.RWGetFidOfs
ldx #6
ldy #S.FD.REG.REF
.1 lda (pFD),y
pha
iny
dex
bne .1
ldx #6
ldy #S.NETBIOS+S.SMB.H+5+5
.2 pla
sta (ZPReqPtr),y
dey
dex
bne .2
rts
*--------------------------------------
CIFS2.RWSetOfsY phy
ldy #4 hNod
lda (pStack),y
jsr GetPFD
ply Count LO
phy
lda (ZPRespPtr),y
ldy #S.FD.REG.REF+2
clc
adc (pFD),y
sta (pFD),y
ply
iny Count HI
lda (ZPRespPtr),y
ldy #S.FD.REG.REF+3
adc (pFD),y
sta (pFD),y
bcc .8
iny
lda (pFD),y
inc
sta (pFD),y
bne .8
iny
lda (pFD),y
inc
sta (pFD),y
.8 rts
*--------------------------------------
CIFS.CopyX ldy #0
.1 lda (ZPPtr1),y
sta (ZPPtr2),y
iny
dex
bne .1
rts
*--------------------------------------
CIFS.Seek0 ldx #4
ldy #S.FD.REG.REF+2
lda #0
.1 sta (pFD),y
iny
dex
bne .1
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libcifs.io.s
LOAD usr/src/lib/libcifs.s

View File

@ -575,7 +575,12 @@ GetCTX lda MountTable+2
>STYA ZPCtxPtr
rts
*--------------------------------------
MakeTrans2Req ldx #S.SMB.H.CMD.TRANS2
GetSMBContext lda (pStack),y
>SYSCALL2 GetMemPtr
>STYA ZPCtxPtr
rts
*--------------------------------------
RequestT2SetupX ldx #S.SMB.H.CMD.TRANS2
jsr RequestSetupX
ldx #0
@ -589,11 +594,6 @@ MakeTrans2Req ldx #S.SMB.H.CMD.TRANS2
rts
*--------------------------------------
GetSMBContext lda (pStack),y
>SYSCALL2 GetMemPtr
>STYA ZPCtxPtr
rts
*--------------------------------------
RequestSetupX phx
lda hReq
@ -617,7 +617,10 @@ RequestSetupX phx
*--------------------------------------
ReqSetupPtr2 sty ByteCountOfs
lda #0
sta (ZPReqPtr),y Reset ByteCount
iny
sta (ZPReqPtr),y
iny +2 for ByteCount
ReqT2SetupPtr2 sty ZPReqLen
@ -811,13 +814,13 @@ Exit.OK lda hResp
* clc
rts
*--------------------------------------
Exit.KO pha
Exit.KO php
pha
lda hResp
>SYSCALL2 FreeMem
pla
plp
stz CIFS.Status
sec
rts
*--------------------------------------
Exit.NODATA cmp #E.NODATA
@ -849,47 +852,6 @@ GetRespData sta hResp
sta ZPRespPtr+1
rts
*--------------------------------------
CheckSMBStatus ldy #S.NETBIOS+S.SMB.H.STATUS
lda (ZPRespPtr),y
clc
beq FreeRespData.RTS
stz CIFS.Status
cmp #2 SRV
bcs .9
iny
iny
lda (ZPRespPtr),y ERR CODE
ldx #MLIERR01-SMBERR01
.1 cmp SMBERR01-1,x
beq .2
dex
bne .1
sec
bra .9
.2 lda MLIERR01-1,x
sec
bra FreeRespData
.9 lda #MLI.E.IO
*--------------------------------------
FreeRespData php
pha
lda hResp
>SYSCALL2 FreeMem
pla
plp
FreeRespData.RTS
rts
*--------------------------------------
GetRespDataPtr1 ldy #S.NETBIOS+S.SMB.H+15 Data Offset
lda (ZPRespPtr),y
clc
@ -912,6 +874,44 @@ GetRespDataPtr1 ldy #S.NETBIOS+S.SMB.H+15 Data Offset
rts
*--------------------------------------
CheckSMBStatus ldy #S.NETBIOS+S.SMB.H.STATUS
lda (ZPRespPtr),y
clc
beq FreeRespData.RTS
stz CIFS.Status
cmp #2 SRV
bcs .9
iny
iny
lda (ZPRespPtr),y ERR CODE
ldx #MLIERR01-SMBERR01
.1 cmp SMBERR01-1,x
beq .2 CS
dex
bne .1
.9 lda #MLI.E.IO
sec
bra FreeRespData
.2 lda MLIERR01-1,x
*--------------------------------------
FreeRespData php
pha
lda hResp
>SYSCALL2 FreeMem
pla
plp
FreeRespData.RTS
rts
*--------------------------------------
FileInfo2StatBuf
phx
@ -1181,7 +1181,7 @@ SMB.ComRead.H .DA #10 WORD COUNT
.HS FF000000 NO MORE CMD
.BS 2 FID
.BS 4 Offset
.HS 0001 MaxCountOfBytesToReturn
.BS 2 MaxCountOfBytesToReturn
.HS 0000 MinCountOfBytesToReturn
.HS 00000000 Timeout
.HS 0000 Remaining
@ -1268,11 +1268,13 @@ hReq .BS 1
CIFS.Status .BS 1
CIFS.PID .BS 1
CIFS.Retries .BS 1
CIFS.Cnt .BS 2
*--------------------------------------
MountTable .BS 2 pMountPoint
.BS 1 hSMBContext
.BS 1 hSocket
*--------------------------------------
hFD .BS 1
hFILE .BS 1
StatBuf .BS S.STAT
*--------------------------------------

View File

@ -836,13 +836,14 @@ XRW.SeekYA sta XRW.D2Trk-1,x will be current track at the end
jsr XRW.Wait25600usec
lda IO.D2.Ph0Off,y
bcc .90
lda IO.D2.Ph0Off,x
nop
clc Exit wit CC (recalibrate)
.90 lda IO.D2.Ph0Off,y
.90 clc Exit wit CC (recalibrate)
rts
*--------------------------------------
XRW.SeekPhOnY and #6

View File

@ -17,11 +17,10 @@ hDstFile .BS 1
bCopy .BS 1
hCopyBuf .BS 1
CopyRC .BS 1
.FIN
.DO X.DELETE.SOURCE=1
hToDelete .BS 1
.FIN
*--------------------------------------
MAN

View File

@ -11,6 +11,13 @@ ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPFileName .BS 2
ZPFileStat .BS 2
bContinue .BS 1
bRecurse .BS 1
bQuiet .BS 1
.DO X.COPY.TO.DEST=1
bNoConfirm .BS 1
.FIN
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -54,14 +61,16 @@ CS.INIT
lda (ZPPtr1)
cmp #'-'
bne .4
ldy #1
lda (ZPPtr1),y
ldx #OptionVars-OptionList-1
ldy #OptionVars-OptionList-1
.2 cmp OptionList,x
.2 cmp OptionList,y
beq .3
dex
dey
bpl .2
.99 >PUSHW L.MSG.USAGE
@ -71,9 +80,9 @@ CS.INIT
sec
rts
.3 ldy OptionVars,x
lda #$80
sta (pData),y
.3 ldx OptionVars,y
* sec
ror $0,x
bra .1
.4 >LDA.G index
@ -87,14 +96,17 @@ CS.INIT
>LDYA ZPPtr1
jsr InitSrcDirYA
bcc .1 success, scan for any other args
.9 rts
.DO X.COPY.TO.DEST=1
.5 >LDA.G hDstBasePath
bne .99 we already have a second arg....error!
>LDYA ZPPtr1
jsr InitDstDirYA
bcc .1 success, scan for any other args
rts
.FIN
@ -104,6 +116,7 @@ CS.INIT
.DO X.COPY.TO.DEST=1
>LDA.G hDstBasePath
bne .8 we also have a Dst folder
ldy #S.PS.hCWD no dst folder, use actual prefix
lda (pPS),y
>SYSCALL GetMemPtr
@ -114,6 +127,7 @@ CS.INIT
.8 >LDYAI 256
>SYSCALL GetMem
bcs .9
txa
>STA.G hSrcFullPath
@ -121,6 +135,7 @@ CS.INIT
>LDYAI 256
>SYSCALL GetMem
bcs .9
txa
>STA.G hDstFullPath
@ -139,6 +154,7 @@ CS.RUN ldy #S.PS.hStdIn
bcs CS.INIT.RTS I/O error
cmp #$03 Ctrl-C
bne .10
sec
rts Abort....
@ -170,9 +186,11 @@ CS.RUN ldy #S.PS.hStdIn
.DO X.DELETE.SOURCE=0
beq .20 no copy error
sec
jsr CS.RUN.CheckErr we have an error....
bcs .9
jmp CS.RUN.NEXT
.20 jsr CS.RUN.CheckErr Success!!
@ -180,9 +198,11 @@ CS.RUN ldy #S.PS.hStdIn
jmp CS.RUN.NEXT
.ELSE
beq .2
sec
jsr CS.RUN.CheckErr we have an error....
bcc .21
rts
.21 >STZ.G hToDelete Cancel delete if any
@ -205,8 +225,10 @@ CS.RUN ldy #S.PS.hStdIn
jsr CS.RUN.CheckErr Success!!!
jsr CS.RUN.IncCount
jmp CS.RUN.NEXT
.22 jsr CS.RUN.CheckErr
bcs .9
jmp CS.RUN.NEXT
.FIN
*--------------------------------------
@ -226,8 +248,9 @@ CS.RUN ldy #S.PS.hStdIn
.5 cmp /S.STAT.MODE.DIR DIR ?
bne .7
>LDA.G bRecurse
bit bRecurse
bpl CS.RUN.NEXT
lda (ZPFileName)
cmp #'.'
beq CS.RUN.NEXT Skip "." & ".."
@ -246,6 +269,7 @@ CS.RUN.NEXT jsr GetNextEntry
*--------------------------------------
CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
bcs .99 base, we are done, exit
jsr BasePath..
.DO X.DELETE.SOURCE=1
* .DO X.COPY.TO.DEST=0
@ -265,8 +289,7 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
jmp CS.RUN.NEXT
.99 ldy #bQuiet
lda (pData),y
.99 bit bQuiet
bmi .91
>PUSHW L.MSG.DONE
@ -288,23 +311,19 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
jsr CS.RUN.DIR.MSG
bcs CS.RUN.LEAVE.RTS
ldy #hDstFullPath
jsr CS.RUN.GetPathY
>PUSHYA
>PUSHW L.STAT
>SYSCALL Stat
jsr CS.RUN.StatDst
bcs .3 File Not exists...go create
ldy #bNoConfirm
lda (pData),y
bit bNoConfirm
bmi .21 no prompt, nothing to create, enter subdir
jsr CS.RUN.OVERWRITE.MSG
bcs CS.RUN.DIR.RTS
.1 >SLEEP
>SYSCALL GetChar
bcs .1
cmp #3
beq .99 abort
@ -312,21 +331,23 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
cmp #'N'
bne .2
jmp CS.RUN.CR.NEXT no overwrite, nothing to do, no recurse
.2 cmp #'Y'
beq .21 no create, but recurse
cmp #'A'
bne .1
ldy #bNoConfirm
lda #$ff
sta (pData),y
* sec
ror bNoConfirm
.21 clc
lda #0
bra .4
.3 ldy #hDstFullPath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
ldy #S.STAT.MODE+1
lda (ZPFileStat),y
>PUSHA
@ -348,20 +369,16 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
sec
CS.RUN.DIR.RTS rts
*--------------------------------------
CS.RUN.REG jsr CS.RUN.REG.MSG
CS.RUN.REG ldx #2
jsr CS.RUN.REG.MSG
bcs CS.RUN.DIR.RTS
.DO X.COPY.TO.DEST=1
ldy #hDstFullPath
jsr CS.RUN.GetPathY
>PUSHYA
>PUSHW L.STAT
>SYSCALL Stat
jsr CS.RUN.StatDst
bcs .2 File Not exists...go create
ldy #bNoConfirm
lda (pData),y
bmi .2 no prompt, ovverwrite
bit bNoConfirm
bmi .2 no prompt, overwrite
jsr CS.RUN.OVERWRITE.MSG
bcs .9
@ -369,6 +386,7 @@ CS.RUN.REG jsr CS.RUN.REG.MSG
.1 >SLEEP
>SYSCALL GetChar
bcs .1
cmp #3
beq .99 abort
@ -376,24 +394,27 @@ CS.RUN.REG jsr CS.RUN.REG.MSG
cmp #'N'
bne .11
jmp CS.RUN.CR.NEXT no overwrite exit
.90 rts
.11 cmp #'Y'
beq .12 copy
cmp #'A'
bne .1
ldy #bNoConfirm
lda #$ff
sta (pData),y
* sec
ror bNoConfirm
.12 jsr GetEntry get back current entry corrupted by SLEEP
.2 .DO X.DELETE.SOURCE=1 mv file, check if srcbase=dstbase
ldy #hSrcBasePath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
ldy #hDstBasePath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
>SYSCALL StrCaseCmp
bcs .3 not same dir, go copy/delete
@ -420,36 +441,27 @@ CS.RUN.REG jsr CS.RUN.REG.MSG
ldy #hToDelete
sta (pData),y
.FIN
clc
.9 rts
.99 ldy #RC
lda (pData),y get global RC in case of bContinue
.99 >LDA.G RC get global RC in case of bContinue
sec
rts
*--------------------------------------
CS.RUN.DIR.MSG sec
.HS 90 bcc opcode
CS.RUN.REG.MSG clc
CS.RUN.DIR.MSG ldx #0
>LDA.G bQuiet
CS.RUN.REG.MSG bit bQuiet
bmi .8
bcc .1
>LDYA L.MSG.DIR
bcs .2
.1 >LDYA L.MSG.REG
>PUSHW L.MSG.DIR,x
.2 >PUSHYA
ldy #hSrcFullPath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
.DO X.COPY.TO.DEST=1
ldy #hDstFullPath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
>PUSHBI 4
.ELSE
@ -465,14 +477,14 @@ CS.RUN.REG.MSG clc
*--------------------------------------
.DO X.COPY.TO.DEST=1
CS.RUN.OVERWRITE.MSG
>LDA.G bQuiet
bit bQuiet
bmi .1
jsr CS.RUN.CR
.1 >PUSHW L.MSG.OVERWRITE
ldy #hDstFullPath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
>PUSHBI 2
>SYSCALL PrintF
rts
@ -486,14 +498,14 @@ CS.RUN.CR >PUSHW L.MSG.CRLF
.DO X.COPY.TO.DEST=1
.DO X.DELETE.SOURCE=1
CS.RUN.Rename ldy #hSrcFullPath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
ldy #hDstFullPath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
>SYSCALL Rename
bcs .9
jsr CS.RUN.IncCount
.9 rts
.FIN
.FIN
@ -523,6 +535,7 @@ CS.RUN.CopyStart
ldy #hDstFullPath
lda #O.WRONLY+O.CREATE
jsr CS.RUN.Open
.9 bcs CS.RUN.CopyEnd
>STA.G hDstFile
@ -555,8 +568,7 @@ CS.RUN.Copy >PUSHB.G hSrcFile
>SYSCALL FWrite
bcs .9
ldy #bQuiet
lda (pData),y
bit bQuiet
bmi .8
lda #'.'
@ -592,8 +604,7 @@ CS.RUN.CopyEnd php
.FIN
*--------------------------------------
CS.RUN.Open pha Save open mode
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
pla
>PUSHA
@ -611,7 +622,7 @@ CS.RUN.Open pha Save open mode
*--------------------------------------
CS.RUN.CheckErr bcs .1
>LDA.G bQuiet
bit bQuiet
bmi .8
>LDYA L.MSG.OK
@ -626,7 +637,7 @@ CS.RUN.CheckErr bcs .1
>PUSHBI 1
>SYSCALL PrintF
>LDA.G bContinue
lda bContinue
eor #$80
asl
pla
@ -634,38 +645,27 @@ CS.RUN.CheckErr bcs .1
*--------------------------------------
CS.RUN.BuildFilePath
ldy #hSrcFullPath
jsr CS.RUN.GetPathY
>STYA ZPPtr1
>PUSHYA
jsr CS.RUN.PushPathY
ldy #hSrcBasePath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
>SYSCALL StrCpy
>PUSHW ZPPtr1
ldy #hSrcFullPath
jsr CS.RUN.PushPathY
>PUSHW ZPFileName
>SYSCALL StrCat
.DO X.COPY.TO.DEST=1
ldy #hDstFullPath
jsr CS.RUN.GetPathY
>STYA ZPPtr1
>PUSHYA
jsr CS.RUN.PushPathY
ldy #hDstBasePath
jsr CS.RUN.GetPathY
>PUSHYA
jsr CS.RUN.PushPathY
>SYSCALL StrCpy
>PUSHW ZPPtr1
ldy #hDstFullPath
jsr CS.RUN.PushPathY
ldy #hDstFileName
lda (pData),y
>LDA.G hDstFileName
beq .1
>SYSCALL GetMemPtr
@ -678,18 +678,43 @@ CS.RUN.BuildFilePath
.FIN
rts
*--------------------------------------
CS.RUN.GetPathY lda (pData),y
>SYSCALL GetMemPtr
.DO X.COPY.TO.DEST=1
CS.RUN.StatDst ldy #hDstFullPath
jsr CS.RUN.PushPathY
>PUSHW L.STAT
>SYSCALL Stat
rts
.FIN
*--------------------------------------
CS.RUN.GetPathY sec
.HS 90 BCC
CS.RUN.PushPathY
clc
php
lda (pData),y
>SYSCALL GetMemPtr
plp
bcs .8
>PUSHYA
.8 rts
*--------------------------------------
CS.RUN.IncCount >INCW.G Count
rts
*--------------------------------------
CS.RUN.ToUpper cmp #'a'
bcc .8
cmp #'z'+1
bcs .8
eor #$20
.8 rts
*--------------------------------------
CS.DOEVENT sec
@ -715,6 +740,9 @@ CS.QUIT jsr LeaveSubDir
jsr .7
ldy #hFilter
jsr .7
ldy #hExclude
.7 lda (pData),y
beq .9

View File

@ -1,16 +1,17 @@
NEW
AUTO 3,1
.LIST OFF
.LIST OFF
*--------------------------------------
X.MAX.RECURSE .EQ 8
*--------------------------------------
* Uses: (pData)
* Index .BS 1
* hDIRs .BS X.MAX.RECURSE+1
* hDIRENTs .BS X.MAX.RECURSE+1
* Index .BS 1
* oDIRENTs .BS X.MAX.RECURSE*2
* STAT .BS S.STAT
* hSrcBasePath .BS 1
* hDstBasePath .BS 1 (optional)
* STAT .BS S.STAT
* hFilter .BS 1
* hExclude .BS 1
*--------------------------------------
@ -32,9 +33,9 @@ ExcludeMatch sec
tay
lda (pData),y
plp
tax
beq FilterMatch.RTS No filter....exit with CS excluded
>SYSCALL GetMemPtr
@ -44,65 +45,65 @@ ExcludeMatch sec
lda (ZPFileStat),y
tax if 0, Regular ProDOS....
bne .10
>LDYA ZPPtr2 ... so CI compare
>SYSCALL StrUpr
.10 lda (ZPPtr2) Get first pattern byte
beq .8 Match always if empty
ldy #0
bra .2
.1 jsr FilterMatch.NextPtr2 get next pattern char
.1 jsr FilterMatch.NextPtr2 get next pattern char
beq .41 end of pattern...
.2 cmp #'*'
.2 cmp #'*'
beq .5
.3 lda (ZPFileName),y we must match ? or regular char, check if at end of string
beq .9 no char left, exit with error
lda (ZPPtr2) get back pattern char
cmp #'?'
beq .4 no need to compare, any char will match
jsr FilterMatch.CmpPtr2CharPtr1Y Regular Char, compare with string at Y
bne .9 no match, exit
.3 lda (ZPFileName),y we must match ? or regular char, check if at end of string
beq .9 no char left, exit with error
.4 iny advance to next char to compare
bra .1 continue if remaining char in pattern
lda (ZPPtr2) get back pattern char
cmp #'?'
beq .4 no need to compare, any char will match
.41 lda (ZPFileName),y end of pattern, but end of string ?
beq .8 yes, string matched entirely
* no, remaining char in string, no match
.9 sec
rts
jsr FilterMatch.CmpPtr2CharPtr1Y Regular Char, compare with string at Y
bne .9 no match, exit
.5 jsr FilterMatch.NextPtr2 we have '*', last char of pattern ?
beq .8 yes, match everything, including empty string
cmp #'*' another '*' ?
beq .5 yes, '**' = '*', go next char
.4 iny advance to next char to compare
bra .1 continue if remaining char in pattern
cmp #'?' '*?' ? we must match a least one char
beq .3
.7 lda (ZPFileName),y we need at least one remaining char in string, check if at end of string
beq .9 no chance to match ? or regular char
iny
jsr FilterMatch.CmpPtr2CharPtr1Y compare with char in string
bne .7 not equal to next non wildcard in pattern
.41 lda (ZPFileName),y end of pattern, but end of string ?
beq .8 yes, string matched entirely
* no, remaining char in string, no match
.9 sec
rts
.5 jsr FilterMatch.NextPtr2 we have '*', last char of pattern ?
beq .8 yes, match everything, including empty string
cmp #'*' another '*' ?
beq .5 yes, '**' = '*', go next char
cmp #'?' '*?' ? we must match a least one char
beq .3
.7 lda (ZPFileName),y we need at least one remaining char in string, check if at end of string
beq .9 no chance to match ? or regular char
iny
bra .1 go check remaining char in pattern...
.8
jsr 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
clc
FilterMatch.RTS
rts
rts
*--------------------------------------
FilterMatch.CmpPtr2CharPtr1Y
phx
@ -117,17 +118,17 @@ FilterMatch.CmpPtr2CharPtr1Y
bcs .1
eor #$20
.1 cmp (ZPPtr2)
rts
.2 lda (ZPPtr2)
cmp (ZPFileName),y
rts
*--------------------------------------
FilterMatch.NextPtr2
inc ZPPtr2 Make PTR2 advance to next char
bne .1
inc ZPPtr2 Make PTR2 advance to next char
bne .1
inc ZPPtr2+1
@ -167,7 +168,7 @@ InitSrcDirYA >PUSHYA
beq .11
jmp .9
.11 jsr GetPtr1Len TYPE is not DIR, check if wc
dey
@ -261,17 +262,17 @@ InitSrcDirYA >PUSHYA
pla
sec
InitSrcDirYA.RTS
rts
rts
*--------------------------------------
ResetSrcDir jsr GethDIR
>SYSCALL CloseDir
>LDA.G hSrcBasePath
>SYSCALL GetMemPtr
>SYSCALL OpenDir
bcs .9
pha
>LDA.G index
@ -294,7 +295,8 @@ InitDstDirYA >PUSHYA
>STYA ZPPtr1
txa
>STA.G hFullPath
>PUSHW ZPPtr1
>PUSHW ZPPtr1
>PUSHEA.G STAT
>SYSCALL Stat
bcs .1 File/DIR does not exists, go extract DstFileName
@ -351,18 +353,18 @@ InitDstDirYA >PUSHYA
iny
lda #0
sta (ZPPtr2),y
.7 jsr .9 Cleanup
clc
.99 rts
.9 pha
>LDA.G hFullPath
>SYSCALL FreeMem
pla
sec
rts
rts
.FIN
*--------------------------------------
GetNextEntry jsr GetEntry
@ -374,6 +376,7 @@ GetNextEntry jsr GetEntry
clc
adc #S.STAT
sta ZPFileName
lda ZPFileStat+1
adc /S.STAT
sta ZPFileName+1 Make nDIRENTs[i] point to next DIRENT
@ -435,7 +438,7 @@ GetEntry jsr GethDIRENT
rts
.1 >SYSCALL GetMemPtr
>STYA ZPFileName
>STYA ZPFileName
jsr GetoDIRENT
lda ZPFileName
@ -452,7 +455,7 @@ GetEntry jsr GethDIRENT
.8 jsr GetFilenameLen
jsr SetFileStatPtr
clc
.9 rts
*--------------------------------------
@ -592,7 +595,7 @@ BasePath.. .DO X.COPY.TO.DEST=1
jsr BasePath..1
.FIN
ldy #hSrcBasePath
BasePath..1 lda (pData),y
>SYSCALL GetMemPtr
>STYA ZPPtr1 save full path
@ -600,7 +603,7 @@ BasePath..1 lda (pData),y
jsr GetPtr1Len get len
dey discard ending /
.2 dey
lda (ZPPtr1),y
cmp #'/'
@ -647,16 +650,15 @@ SetFileStatPtr sec
sta ZPFileStat+1
rts
*--------------------------------------
GethDIR ldy #index
lda (pData),y
GethDIR >LDA.G index
clc
adc #hDIRs-1
tay
lda (pData),y
rts
*--------------------------------------
GethDIRENT ldy #index
lda (pData),y
GethDIRENT >LDA.G index
GethDIRENT.A clc
adc #hDIRENTs-1
@ -664,8 +666,7 @@ GethDIRENT.A clc
lda (pData),y
rts
*--------------------------------------
GetoDIRENT ldy #index
lda (pData),y
GetoDIRENT >LDA.G index
asl
clc
adc #oDIRENTs-1

View File

@ -42,35 +42,35 @@ IRQ.Handler cld
pha
sta CLRWRITEAUX Driver may R/W in screen holes
lda MSLOT Save MSLOT
pha
* lda MSLOT Save MSLOT
* pha
lda RDCXROM C100-C7ff state
pha
sta CLRCXROM Enable access to slot C100-C7ff space
* lda RDCXROM C100-C7ff state
* pha
* sta CLRCXROM Enable access to slot C100-C7ff space
IRQ.JSR jsr CORE.IRQ.DEV SELF MODIFIED
ldx #CLRCXROM
* ldx #CLRCXROM
pla Get CXROM State
bpl .3
* pla Get CXROM State
* bpl .3
inx X = SETCXROM
* inx X = SETCXROM
.3 sta $C000,x
*.3 sta $C000,x
pla Get back MSLOT
sta MSLOT
sta IRQ.2+2
* pla Get back MSLOT
* sta MSLOT
* sta IRQ.2+2
and #$F0
eor #$C0 ....mmm...not looking like Cn....
bne IRQ.3
* and #$F0
* eor #$C0 ....mmm...not looking like Cn....
* bne IRQ.3
sta CLRC8ROM Release $C800
* sta CLRC8ROM Release $C800
IRQ.2 lda $ff00 SELF MODIFIED
*IRQ.2 lda $ff00 SELF MODIFIED
IRQ.3 pla Must keep Carry
bpl .1