annotate level1/cmds/copy.asm @ 2695:c321d41cd8d3 lwtools-port

Conditionalized VTIO to turn off caps-lock for coco2b port
author Boisy Pitre <boisy.pitre@nuance.com>
date Thu, 19 Jul 2012 14:36:52 -0500
parents abdd67f458dd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
2 * Copy - File copy utility
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
1325
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
7 * Comment
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1325
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
9 * 9 ????/??/??
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
10 * From Tandy OS-9 Level Two VR 02.00.01.
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
11 *
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
12 * 10 ????/??/?? Ron Lamardo
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
13 * Reworked.
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
14 *
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
15 * 11 2003/01/11 Boisy G. Pitre
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
16 * Added useful options, made more robust.
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 nam Copy
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
19 ttl File copy utility
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
21 ifp1
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
22 use defsfile
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
23 endc
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
24
921
617c1b90e623 Added DOHELP conditionals, set all to zero to eliminate help from commands
boisy
parents: 846
diff changeset
25 DOHELP set 0
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
26
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
27 tylg set Prgrm+Objct
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28 atrv set ReEnt+rev
1325
84ea83668304 Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents: 929
diff changeset
29 rev set $00
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
30 edition set 11
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
31
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 mod eom,name,tylg,atrv,start,size
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
33
929
c04528763543 stack/parameter size increased to prevent collisions with memory
boisy
parents: 921
diff changeset
34 STACKSZ equ 128 estimated stack size
c04528763543 stack/parameter size increased to prevent collisions with memory
boisy
parents: 921
diff changeset
35 PARMSZ equ 256 estimated parameter size
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
36 DDIRBSIZ equ 64 destination directory buffer size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
37
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
38 org 0
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
39 rdbufptr rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
40 parmptr rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
41 srcpath rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
42 dstpath rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
43 devtyp rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
44 bufsiz rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
45 srcflsiz rmb 4
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
46 abortflg rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
47 quiet rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
48 single rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
49 rewrite rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
50 filecnt rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
51 srccnt rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
52 srcmode rmb 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
53 wopt rmb 1
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
54 vopt rmb 1
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
55 srcfname rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
56 dstfptr rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
57 wfileptr rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
58 wfilelen rmb 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
59 lstfopen rmb 2 pointer to name of last file attempted open
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
60 lstfopln rmb 2 length of last file atteppted open
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
61 srcattr rmb 1
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
62 writemsb rmb 2
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
63 writelsb rmb 2
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
64 fdbufcpy rmb 16
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
65 optbuf rmb 32
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
66 wdest rmb DDIRBSIZ portion after '-w='
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
67 rmb DDIRBSIZ additional space
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
68 * Note: copy buffer must come just before the stack
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
69 vfybuff rmb 256 verify buffer
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
70 IFGT Level-1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
71 copybuff rmb 8*1024 8K default buffer for Level 2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
72 ELSE
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
73 copybuff rmb 512 512 byte default buffer for Level 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
74 ENDC
929
c04528763543 stack/parameter size increased to prevent collisions with memory
boisy
parents: 921
diff changeset
75 rmb STACKSZ+PARMSZ
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 size equ .
200
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 188
diff changeset
77
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 188
diff changeset
78 name fcs /Copy/
e9ce43cc215e Made major changes to headers for consistency and identification
boisy
parents: 188
diff changeset
79 fcb edition
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
80
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
81 SrcPmpt fcc /Ready SOURCE, hit C to continue: /
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
82 SrcPmptL equ *-SrcPmpt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
83 DstPmpt fcc /Ready DESTINATION, hit C to continue: /
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
84 DstPmptL equ *-DstPmpt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
85 CrRtn fcb C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
86 IFNE DOHELP
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
87 HlpMsg fcb C$LF
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
88 fcc /Use: Copy [<opts>] <srcpath> [<dstpath>] [<opts>]/
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
89 fcb C$LF
841
d5c84431e734 Shrank help a bit more to reduce size
boisy
parents: 823
diff changeset
90 fcc / -a = abort on error/
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
91 fcb C$LF
841
d5c84431e734 Shrank help a bit more to reduce size
boisy
parents: 823
diff changeset
92 fcc / -p = don't print files copied (use with -w)/
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
93 fcb C$LF
841
d5c84431e734 Shrank help a bit more to reduce size
boisy
parents: 823
diff changeset
94 fcc / -r = rewrite destination/
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
95 fcb C$LF
841
d5c84431e734 Shrank help a bit more to reduce size
boisy
parents: 823
diff changeset
96 fcc / -s = single drive copy/
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
97 fcb C$LF
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
98 fcc / -v = verify the copy/
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
99 fcb C$LF
846
c6e6cf68e03e Optimized
boisy
parents: 841
diff changeset
100 fcc / -w=<dir> = copy to <dir>/
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
101 fcb C$LF
841
d5c84431e734 Shrank help a bit more to reduce size
boisy
parents: 823
diff changeset
102 fcc / -x = copy from exec dir/
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
103 fcb C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
104 HlpMsgL equ *-HlpMsg
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
105 ENDC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
106 PLIncmp fcc /copy: destination must be complete pathlist/
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
107 fcb C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
108 TooMany fcc /copy: must specify output directory if more than 2 files/
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
109 fcb C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
110 Copying fcc /copying /
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
111 CopyingL equ *-Copying
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
112 CopyTo fcc / to /
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
113 CopyToL equ *-CopyTo
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
114 Cont fcc !Continue (y/n) ?!
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
115 ContL equ *-Cont
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
116 CantCpy fcc /copy: can't open /
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
117 CantCpyL equ *-CantCpy
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
118 SpcDsh fcc / - /
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
119 SpcDshL equ *-SpcDsh
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
120
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
121 * +-----------------+ <-- Y (highest address)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
122 * ! !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
123 * ! Parameter !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
124 * ! Area !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
125 * ! !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
126 * +-----------------+ <-- X, SP
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
127 * ! !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
128 * ! !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
129 * ! Data Area !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
130 * ! !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
131 * ! !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
132 * +-----------------+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
133 * ! Direct Page !
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
134 * +-----------------+ <-- U, DP (lowest address)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
135 *
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
136 * D = parameter area size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
137 * PC = module entry point abs. address
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
138 * CC = F=0, I=0, others undefined
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
139
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
140 start pshs u,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
141 leax <wdest,u
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
142 pshs x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
143 clrnxt clr ,u+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
144 cmpu ,s
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
145 bne clrnxt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
146 leas 2,s
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
147 puls x,u
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
148 leay copybuff,u point Y to copy buffer offset in U
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
149 stx <parmptr save parameter pointer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
150 sty <rdbufptr save pointer to buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
151 tfr s,d place top of stack in D
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
152 pshs y save Y on stack
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
153 subd ,s++ get size of space between copybuf and X
929
c04528763543 stack/parameter size increased to prevent collisions with memory
boisy
parents: 921
diff changeset
154 subd #STACKSZ+PARMSZ subtract out our stack
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
155 std <bufsiz size of our buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
156 lbsr SkipSpcs move past any spaces on command line
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
157 cmpa #C$CR CR?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
158 lbeq ShowHelp if so, show help
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
159 GetNChr lda ,x+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
160 cmpa #C$CR CR?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
161 lbeq CpyFiles branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
162 cmpa #'- option?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
163 beq GetDash
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
164 inc <filecnt must be a file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
165 lbsr SkipNSpc else go past non-spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
166 ChkDash lbsr SkipSpcs and any following spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
167 bra GetNChr and check for Cr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
168 GetDash lda #C$SPAC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
169 sta -1,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
170 GetDash2 ldd ,x+ load option char and char following
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
171 anda #$5F
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
172 cmpa #'S single drive copy?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
173 bne IsItA branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
174 inc <single
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
175 lbra FixCmdLn
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
176 IsItA cmpa #'A abort option?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
177 bne IsItP branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
178 inc <abortflg
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
179 lbra FixCmdLn
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
180 IsItP cmpa #'P supress output?
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
181 bne IsItV branch if not
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
182 inc <quiet
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
183 bra FixCmdLn
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
184 IsItV cmpa #'V supress output?
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
185 bne IsItX branch if not
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
186 inc <vopt
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
187 bra FixCmdLn
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
188 IsItX cmpa #'X execution dir?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
189 bne IsItW branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
190 lda #EXEC. else get EXEC.
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
191 sta <srcmode and save as source mode
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
192 bra FixCmdLn
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
193 IsItW cmpa #'W directory specification?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
194 bne IsItR branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
195 tst <wopt already specified?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
196 bne BadOpt show help if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
197 cmpb #'= 2nd char =?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
198 bne BadOpt show help if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
199 inc <wopt else tag wopt as specified
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
200 ldb #C$SPAC get space
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
201 stb -$01,x write over w
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
202 stb ,x+ and = sign, inc X to dest dir
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
203 * check for valid char after -w=
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
204 lda ,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
205 cmpa #C$SPAC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
206 lbeq ShowHelp
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
207 cmpa #C$COMA
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
208 lbeq ShowHelp
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
209 cmpa #C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
210 lbeq ShowHelp
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
211 leay <wdest,u point Y to parameber buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
212 sty <dstfptr save pointer to destination file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
213 tfr y,d transfer Y to D
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
214 addd #DDIRBSIZ add size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
215 pshs b,a save updated ptr value
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
216 ldb #C$SPAC get space
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
217 L0339 lda ,x get byte at X
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
218 stb ,x+ store space at X and inc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
219 sta ,y+ save loaded byte at Y and inc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
220 cmpy ,s are we at end?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
221 beq L035D branch if so (buffer too small)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
222 cmpa #C$SPAC else is char in A a space?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
223 beq L0350 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
224 cmpa #C$COMA coma?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
225 beq L0350 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
226 cmpa #C$CR cr?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
227 bne L0339 get next byte if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
228 L0350 leax -1,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
229 sta ,x restore previous A
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
230 lda #PDELIM get pathlist delimiter
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
231 sta -$01,y save slash at end (for building path later)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
232 sty <wfileptr save pointer for -w pathlist file copying
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
233 leas $02,s kill stack
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
234 lbra ChkDash
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
235 L035D leas $02,s
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
236 ldb #$BF else buffer size too small
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
237 orcc #Carry
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
238 lbra Exit
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
239 IsItR cmpa #'R rewrite?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
240 bne BadOpt branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
241 inc <rewrite
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
242 FixCmdLn lda #C$SPAC get space
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
243 sta -$01,x and wipe out option character
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
244 cmpb #'0
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
245 lblt ChkDash start dash option processing again
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
246 lbra GetDash possibly another option following?
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
247
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
248 BadOpt puls x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
249 lbra ShowHelp
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
250
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
251 CopyToW ldx <srcfname get ptr to next file to process
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
252 * In case the source file name has a / in it (i.e. /dd/x/y/fname),
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
253 * we go past the file and then back up to either the first / we
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
254 * encounter, or a space (be sure we don't go past parmptr)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
255 lda ,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
256 cmpa #C$CR carriage return?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
257 lbeq ExitOk yep, no more files
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
258 lbsr SkipNSpc skip over filename
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
259 * X points to first char after file name (space, comma or CR)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
260 L038B cmpx <parmptr are we at start of command line?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
261 beq PlugIt2 if so, we can't go further back
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
262 lda ,-x get byte
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
263 cmpa #PDELIM path delimiter?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
264 beq PlugIt branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
265 cmpa #C$SPAC space?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
266 beq PlugIt branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
267 cmpa #C$COMA comma?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
268 beq PlugIt branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
269 bra L038B else get next char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
270 PlugIt leax 1,x go forward 1
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
271 PlugIt2 ldy <wfileptr get address past xxxx/ (specified by -w=)
823
357c62d55b8f Changes
boisy
parents: 812
diff changeset
272 lbsr StrCpy copy filename
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
273 std <wfilelen save file length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
274 lda #C$CR get CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
275 sta ,y and terminate
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
276 * ldx <wopt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
277 * stx <wfileptr
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
278 rts
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
279
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
280 * At this point options are processed, so we need to start copying files
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
281 CpyFiles tst <filecnt we should have at least one file on cmdline
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
282 lbeq ShowHelp if not, exit with error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
283 ldx <parmptr get our parameter pointer off stack
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
284 lbsr SkipSpcs skip any leading spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
285 tst <wopt -w specified?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
286 beq L03C5 branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
287 stx <srcfname else save start of parameter pointer as next file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
288 clr <single no single option with -w
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
289 L03BE bsr CopyToW copy file at <srcfname to -w buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
290 bra OpenSrc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
291 * This code handles single file copy (i.e. copy file1 file2)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
292 * or a single disk copy (i.e. copy -s abc)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
293 L03C5 lbsr GetSDFl else get source/destination files
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
294 bcc L03D4 branch if we got both ok
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
295 tst <single is this a single drive copy?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
296 lbne PListErr if not, user didn't specify enough files
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
297 lbcs Exit if error, exit
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
298 * test for right number of files
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
299 L03D4 lda <filecnt get total file count
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
300 cmpa #2 should be no more than two files
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
301 ble OpenSrc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
302 leax TooMany,pcr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
303 lbsr WrLine
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
304 lbra ExitOk
1645
cc5f6fa1da23 Fixed bug in copy where -v was on by default (should be off) and writemsb/writelsb
boisy
parents: 1590
diff changeset
305 OpenSrc
cc5f6fa1da23 Fixed bug in copy where -v was on by default (should be off) and writemsb/writelsb
boisy
parents: 1590
diff changeset
306 ldd #$0000
cc5f6fa1da23 Fixed bug in copy where -v was on by default (should be off) and writemsb/writelsb
boisy
parents: 1590
diff changeset
307 std <writemsb clear writemsb/lsb
cc5f6fa1da23 Fixed bug in copy where -v was on by default (should be off) and writemsb/writelsb
boisy
parents: 1590
diff changeset
308 std <writelsb
cc5f6fa1da23 Fixed bug in copy where -v was on by default (should be off) and writemsb/writelsb
boisy
parents: 1590
diff changeset
309 ldx <srcfname get file to open
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
310 pshs x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
311 lbsr StrLen get length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
312 std <lstfopln save length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
313 puls x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
314 lda #READ. read mode
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
315 ora <srcmode or in any additional modes (i.e. EXEC.)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
316 stx <lstfopen save pointer to last file open var
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
317 os9 I$Open open source file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
318 bcc L03FA branch if open ok
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
319 cmpx <srcfname did open go past pathlist?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
320 bne OpenFail branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
321 lbsr SkipNSpc else skip over failed filename
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
322 lbsr SkipSpcs and any trailing spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
323 OpenFail stx <srcfname save updated pathlist pointer (points to next file on cmd line)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
324 lbra ShutDown
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
325 L03FA sta <srcpath save source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
326 pshs a save path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
327 lbsr SkipSpcs destroy any leading spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
328 stx <srcfname and save pointer to next source filename
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
329 lbsr StrLen get length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
330 std <lstfopln save length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
331 puls a get path off stack
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
332 leax <fdbufcpy,u point to FD buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
333 ldy #FD.SEG number of bytes
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
334 ldb #SS.FD
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
335 os9 I$GetStt get file's file descriptor
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
336 bcs L041B branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
337 tst <single single drive copy?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
338 beq L041B branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
339 lda [<dstfptr,u] get first char of destination filename
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
340 ldb #E$BPNam prepare for possible error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
341 cmpa #PDELIM path has leading slash?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
342 lbne PListErr if not, show error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
343 L041B lda <srcpath get source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
344 leax <optbuf,u point to options buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
345 clrb was: ldb #SS.Opt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
346 os9 I$GetStt get path options
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
347 lbcs ShutDown branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
348 lda ,x get device type
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
349 sta <devtyp save
2469
abdd67f458dd Changed numeric constant to flags
boisy
parents: 1645
diff changeset
350 ldb #READ.+WRITE.+EXEC.+PREAD.
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
351 cmpa #DT.RBF rbf device?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
352 bne L0449 branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
353 pshs u,x save regs
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
354 lda <srcpath get source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
355 ldb #SS.Size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
356 os9 I$GetStt get size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
357 lbcs ShutDown
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
358 stx <srcflsiz save file size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
359 stu <srcflsiz+2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
360 puls u,x restore regs
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
361 ldb <PD.ATT-PD.OPT,x get source file's attributes
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
362 L0449 stb <srcattr save
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
363 lda #$01
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
364 lbsr SwapDsk check for single disk copy and prompt if necessary
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
365 L0450 ldx <dstfptr point to destination file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
366 pshs x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
367 lbsr StrLen get length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
368 std <lstfopln save length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
369 puls x
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
370 lda #UPDAT. update mode (in case we have to verify)
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
371 ldb <srcattr get source attributes
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
372 stx <lstfopen
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
373 os9 I$Create create file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
374 bcc L048B branch if create ok
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
375 tst <rewrite rewrite flag set?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
376 lbeq ShutDown branch if no
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
377 cmpb #E$CEF file already exists?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
378 lbne ShutDown branch if any other error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
379 L047A os9 I$Delete delete file first
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
380 lbcs ShutDown branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
381 bra L0450 else try opening again
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
382 L048B sta <dstpath save destination path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
383 tst <wopt w option specified?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
384 beq GetOpts branch iff not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
385 tst <quiet p option specified?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
386 bne GetOpts branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
387 pshs a else save dest path on stack
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
388 leax >Copying,pcr else print 'Copying...'
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
389 ldy #CopyingL
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
390 lbsr WritSOut write it to stdout
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
391 ldx <wfileptr get pointer to file being copied
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
392 ldy <wfilelen get file name length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
393 lbsr WritSOut print file name
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
394 leax >CopyTo,pcr print ' to '
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
395 ldy #CopyToL
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
396 lbsr WritSOut write it to stdout
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
397 ldx <dstfptr get pointer to file being copied
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
398 lbsr WrLine print file with CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
399 puls a restore dest path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
400 GetOpts leax <optbuf,u point to option buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
401 clrb was: ldb #SS.Opt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
402 os9 I$GetStt get options
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
403 lbcs ShutDown branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
404 ldb ,x get device type
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
405 cmpb #DT.RBF rbf?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
406 bne CopyLoop if not rbf device, don't get file size or fd seg
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
407 L04B4 lda <devtyp get device type
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
408 cmpa #DT.RBF rbf?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
409 bne CopyLoop branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
410 pshs u save our statics ptr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
411 lda <dstpath else get dest path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
412 ldb #SS.Size and setstat option
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
413 ldx <srcflsiz get file size of source
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
414 ldu <srcflsiz+2
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
415 os9 I$SetStt and set dest file to same size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
416 lbcs ShutDown branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
417 puls u restore U
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
418 lda <dstpath get dest path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
419 leax <fdbufcpy,u point to file desc. buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
420 ldy #FD.SEG get size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
421 ldb #SS.FD
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
422 os9 I$SetStt write src fd seg to dest file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
423 * Copy loop is here
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
424 CopyLoop ldx <rdbufptr get ptr to read buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
425 clra A = 0 = source prompt if needed
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
426 lbsr SwapDsk check for single disk copy and prompt if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
427 lda <srcpath get source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
428 ldy <bufsiz get buffer size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
429 os9 I$Read read it!
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
430 bcs L0558 branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
431 lda #$01 A = 1 = dest prompt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
432 lbsr SwapDsk check for single disk copy and prompt if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
433 lda <dstpath get dest path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
434 os9 I$Write write it out!
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
435 lbcs ShutDown branch if error
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
436 tst <vopt verify on?
1645
cc5f6fa1da23 Fixed bug in copy where -v was on by default (should be off) and writemsb/writelsb
boisy
parents: 1590
diff changeset
437 beq chkeof
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
438 lbsr DoVerify
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
439 chkeof lda <srcpath get source path
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
440 ldb #SS.EOF
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
441 os9 I$GetStt are we at end of file?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
442 bcc CopyLoop branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
443 cmpb #E$EOF end of file error?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
444 beq L0561 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
445 L0558 cmpb #E$EOF end of file rror?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
446 bne ShutDown branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
447 lda #$01 prompt destination flag
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
448 lbsr SwapDsk check for single drive copy and prompt if necessary
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
449 L0561 lda <dstpath get destination path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
450 os9 I$Close close that file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
451 bcs ShutDown branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
452 clr <dstpath else clear dest path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
453 lda <srcpath get source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
454 os9 I$Close close it
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
455 bcs ShutDown branch if error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
456 clr <srcpath clear src path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
457 tst <wopt -w specified
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
458 lbeq ExitOk branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
459 lbra L03BE
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
460
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
461 * Entry: X = ptr to data to write, Y = length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
462 WritSOut lda #$01 standard out
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
463 os9 I$Write write it
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
464 rts
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
465
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
466 PListErr leax >PLIncmp,pcr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
467 bsr WrLine
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
468 bra ExitOk
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
469
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
470 ShutDown pshs b
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
471 lda <srcpath get source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
472 beq L05AA branch if none
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
473 os9 I$Close close it
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
474 L05AA lda <dstpath get dest path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
475 beq L05B1 branch if none
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
476 os9 I$Close close it
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
477 L05B1 clr <srcpath clear source path
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
478 clr <dstpath and destination
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
479 leax >CantCpy,pcr else show can't copy error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
480 ldy #CantCpyL
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
481 bsr WritSOut write out
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
482 ldx <lstfopen show filename that failed
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
483 ldy <lstfopln get length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
484 bsr WritSOut
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
485 leax >SpcDsh,pcr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
486 ldy #SpcDshL
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
487 bsr WritSOut write out
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
488 puls b
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
489 PrintErr os9 F$PErr print error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
490 tst <wopt -w used?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
491 beq ExitOk branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
492 tst <abortflg abort flag set?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
493 bne ExitOk branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
494 AskAgain leax >Cont,pcr point to continue prompt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
495 ldy #ContL get length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
496 bsr WritSOut write
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
497 clra ADDED +BGP+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
498 ldx <rdbufptr get pointer at readbuf
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
499 ldy #$0002 2 bytes
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
500 os9 I$ReadLn read form stdin
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
501 lda ,x get byte at X
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
502 anda #$5F
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
503 cmpa #'Y user wants to continue?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
504 lbeq L03BE branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
505 cmpa #'N no?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
506 beq ExitOk branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
507 bra AskAgain else ask again
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
508
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
509 ShowHelp equ *
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
510 IFNE DOHELP
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
511 leax >HlpMsg,pcr point to help message
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
512 ldy #HlpMsgL get length
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
513 lda #$02 std error
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
514 os9 I$WritLn write it
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
515 ENDC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
516 ExitOk clrb clear carry
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
517 Exit os9 F$Exit and exit
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
518
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
519 * Write line passed in X
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
520 WrLine ldy #$00A0
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
521 WrNBytes lda #$01
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
522 os9 I$WritLn
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
523 rts
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
524
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
525 * Prompt User for Source or Destination Disk
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
526 SwapDsk tst <single single disk copy?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
527 beq NoSwap branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
528 pshs y,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
529 L0626 pshs a
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
530 tsta
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
531 bne L0635
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
532 leax >SrcPmpt,pcr point to source prompt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
533 ldy #SrcPmptL get size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
534 bra L063D write it and get input
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
535 L0635 leax >DstPmpt,pcr point to dest prompt
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
536 ldy #DstPmptL get size
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
537 L063D bsr WrNBytes write it
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
538 leax ,-s point to stack for temp buffer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
539 ldy #$0001 one byte
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
540 clra from std in
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
541 os9 I$Read read byte from user
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
542 lda ,s+ get char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
543 eora #'C
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
544 anda #$DF
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
545 beq L0657 branch if C
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
546 bsr L065E
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
547 puls a
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
548 bne L0626
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
549 L0657 bsr L065E
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
550 puls a
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
551 puls y,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
552 NoSwap rts
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
553 L065E pshs y,x,a
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
554 lda #$01
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
555 leax >CrRtn,pcr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
556 ldy #80
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
557 os9 I$WritLn
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
558 puls pc,y,x,a
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
559
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
560 * StrLen
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
561 *
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
562 * Entry:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
563 * X = ptr to string (space, comma or CR terminated)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
564 * Exit:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
565 * D = length of string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
566 * X = ptr to byte after string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
567 StrLen pshs u
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
568 ldu #$0000
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
569 StrLenLp lda ,x+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
570 cmpa #C$SPAC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
571 beq StrLenEx
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
572 cmpa #C$COMA
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
573 beq StrLenEx
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
574 cmpa #C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
575 beq StrLenEx
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
576 leau 1,u
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
577 bra StrLenLp
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
578 StrLenEx tfr u,d
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
579 puls u,pc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
580
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
581 * StrCpy
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
582 *
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
583 * Entry:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
584 * X = ptr to src string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
585 * Y = ptr to dest string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
586 * Exit:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
587 * D = number of bytes copied
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
588 * X = ptr to byte after original string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
589 * X = ptr to byte after copied string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
590 StrCpy pshs u
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
591 ldu #$0000
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
592 CopyFnLp lda ,x+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
593 cmpa #C$SPAC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
594 beq CopyFnEx
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
595 cmpa #C$COMA
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
596 beq CopyFnEx
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
597 cmpa #C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
598 beq CopyFnEx
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
599 sta ,y+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
600 leau 1,u
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
601 bra CopyFnLp
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
602 CopyFnEx tfr u,d
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
603 puls u,pc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
604
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
605 * Skip over spaces and commas
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
606 *
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
607 * Entry:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
608 * X = ptr to string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
609 * Exit:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
610 * X = ptr to first non-whitespace char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
611 * A = non-whitespace char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
612 SkipSpcs lda ,x+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
613 cmpa #C$SPAC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
614 beq SkipSpcs
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
615 cmpa #C$COMA
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
616 beq SkipSpcs
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
617 leax -1,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
618 rts
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
619
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
620 * Skip over non-spaces and non-commas
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
621 *
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
622 * Entry:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
623 * X = ptr to string
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
624 * Exit:
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
625 * X = ptr to first non-whitespace char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
626 * A = non-whitespace char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
627 SkipNSpc lda ,x+
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
628 cmpa #C$SPAC
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
629 beq EatOut
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
630 cmpa #C$COMA
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
631 beq EatOut
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
632 cmpa #C$CR
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
633 bne SkipNSpc
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
634 EatOut leax -1,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
635 rts
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
636
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
637 * Get source file in <srcfname and destination file in <dstfptr
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
638 GetSDFl leay <srcfname,u point X to next file pointer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
639 bsr SrchFile skip white spaces, look for name on cmd line
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
640 bcs L067D branch if end
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
641 inc <srccnt else increment souce count
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
642 leay <dstfptr,u point Y to destination file
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
643 bsr SkipSpcs destroy any leading spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
644 bsr SrchFile skip white spaces, look for name on cmd line
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
645 L067D rts
662
1810b051d07e copy, display and makdir are now improved versions with enhanced
boisy
parents: 200
diff changeset
646
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
647 * Starting at X, parse for a filename, skipping leading white spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
648 SrchFile lda ,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
649 cmpa #C$CR CR?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
650 beq L06A2 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
651 stx ,y else store X at Y
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
652 SkipFile bsr SkipNSpc skip non-spaces
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
653 ParseOk clrb clear B
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
654 rts return
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
655 L06A2 tst <srccnt any file specified?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
656 bne L06AA branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
657 BadPName ldb #E$BPNam else no source was specified
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
658 coma
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
659 rts
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
660
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
661 L06AA ldx <srcfname get pointer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
662 L06AC lda ,x+ get char
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
663 cmpa #C$SPAC space?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
664 beq L06C4 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
665 cmpa #C$COMA comma?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
666 beq L06C4 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
667 cmpa #C$CR carriage return?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
668 beq L06C4 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
669 cmpa #PDELIM pathlist delimiter?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
670 bne L06AC branch if not
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
671 clr <srccnt else clear file count
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
672 stx ,y and store
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
673 bra L06AC continue parsing
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
674 L06C4 tst <srccnt file count 0?
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
675 beq L06D2 branch if so
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
676 tst <srcmode source mode? (exec or data dir)
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
677 beq BadPName branch if data
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
678 ldx <srcfname else get pointer
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
679 stx ,y save
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
680 bra ParseOk branch
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
681 L06D2 lda -$02,x
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
682 cmpa #PDELIM
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
683 beq BadPName
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
684 bra ParseOk
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
685
1590
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
686 DoVerify
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
687 pshs u,y save registers
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
688 ldx <writemsb get 2 msb's of last write
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
689 ldu <writelsb get 2 lsb's of last write
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
690 lda <dstpath get out path number
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
691 os9 I$Seek
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
692 lbcs Exit exit on error
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
693 ldu 2,s get original u back
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
694 leau copybuff,u point to buffer start
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
695 ldd ,s get bytes written
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
696 addd <writelsb add on to current 2 lsb positions
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
697 std <writelsb save them
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
698 ldd ,s get bytes written
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
699 bcc vfy000 skip if no carry
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
700 leax 1,x bump up 2 msb's
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
701 stx <writemsb and save them
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
702
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
703 vfy000 ldy #$0100 chars to read for verify
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
704 std ,s save it
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
705 tsta did we write more than 255 bytes ?
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
706 bne vfy010 yes...only read 256
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
707 tfr d,y else xfer amount we did write
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
708
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
709 vfy010 ldx 2,s get u register
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
710 leax vfybuff,x point to start of verify buffer
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
711 lda <dstpath get output path number
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
712 os9 I$Read read a block in
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
713 lbcs Exit exit on error
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
714
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
715 vfy020 lda ,u+ get char from in buffer
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
716 cmpa ,x+ get char from out buffer
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
717 bne snderr1 not equal...send write verfiy msg
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
718 leay -1,y decrement read count
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
719 bne vfy020 if more..loop back
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
720 ldd ,s get write count back
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
721 subd #$0100 subtract verify buffer size
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
722 bhi vfy000 if more left...loop back
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
723 puls u,y,pc else restore registers and return
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
724
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
725 snderr1 leax errmsg1,pcr address of 'write verify failed' msg
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
726 lbsr WrLine send it
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
727 comb set carry
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
728 ldb #$01 set error
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
729 lbra Exit exit
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
730
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
731 errmsg1 fcb C$BELL
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
732 fcc /Error - write verification failed./
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
733 fcb C$CR
67569fc4c41b Copy now has -v (verify) option added back in
boisy
parents: 1531
diff changeset
734
802
3a308921e135 New version of copy with OSK like features
boisy
parents: 662
diff changeset
735 emod
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
736 eom equ *
15
0912ac5dc2ff Added initial and dates to some source files
boisy
parents: 0
diff changeset
737 end