Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/dsave.asm @ 1531:20841f236e32
'use rbfdefs' moved to upper defsfile
author | boisy |
---|---|
date | Fri, 16 Apr 2004 23:38:19 +0000 |
parents | 9859ddd89ff8 |
children | 40322608e006 |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
951 | 2 * dsave - Multi-file copy utility |
0 | 3 * |
4 * $Id$ | |
5 * | |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
962
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:
962
diff
changeset
|
7 * Comment |
0 | 8 * ------------------------------------------------------------------ |
1325
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
962
diff
changeset
|
9 * 1 2003/01/11 Boisy G. Pitre |
84ea83668304
Redid comments, reset all rev nibbles that weren't explictly set to 0
boisy
parents:
962
diff
changeset
|
10 * Rewrote in assembly language. |
1449
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
11 * |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
12 * 1r1 2003/12/11 Boisy G. Pitre |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
13 * Fixed -b option so that it prepends device name in front of os9boot |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
14 * filename. Also fixed -b= option to work as well. |
0 | 15 |
16 nam dsave | |
951 | 17 ttl Multi-file copy utility |
0 | 18 |
19 ifp1 | |
951 | 20 use defsfile |
0 | 21 endc |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
113
diff
changeset
|
22 |
951 | 23 * Here are some tweakable options |
24 DOHELP set 0 1 = include help info | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
25 INDENTSZ set 2 number of spaces to indent when -i is used |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
26 STACKSZ set 1024 estimated stack size in bytes |
951 | 27 PARMSZ set 256 estimated parameter size in bytes |
28 | |
29 * Module header definitions | |
0 | 30 tylg set Prgrm+Objct |
31 atrv set ReEnt+rev | |
1449
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
32 rev set $01 |
951 | 33 edition set 1 |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
113
diff
changeset
|
34 |
0 | 35 mod eom,name,tylg,atrv,start,size |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
113
diff
changeset
|
36 |
951 | 37 * Your utility's static storage vars go here |
924 | 38 org 0 |
951 | 39 * These vars are used by the base template and shouldn't be removed |
40 parmptr rmb 2 pointer to our command line params | |
41 bufptr rmb 2 pointer to user expandable buffer | |
42 bufsiz rmb 2 size of user expandable buffer | |
43 * These vars are used for this example, it will probably change for you | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
44 dirlevel rmb 1 current directory level (0 = top) |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
45 *doexec rmb 1 execute flag |
951 | 46 errcode rmb 1 error code storage |
47 plistcnt rmb 1 command line pathlist count | |
48 doboot rmb 1 | |
49 indent rmb 1 | |
50 onelevel rmb 1 | |
51 nomakdir rmb 1 | |
52 rewrite rmb 1 | |
53 cpymemsz rmb 1 | |
54 doverify rmb 1 | |
55 dstpath rmb 2 pointer to second (optional) pathlist on cmd line | |
56 lineptr rmb 2 | |
57 sopt rmb 1 | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
58 ddbt rmb 3 copy of source disk's DD.BT from LSN0 |
951 | 59 * vars for pwd integrated code |
60 fildes rmb 1 | |
61 srcptr rmb 2 | |
62 dotdotfd rmb 3 LSN of .. | |
63 dotfd rmb 3 LSN of . | |
64 ddcopy rmb 3 | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
65 bbuff rmb 64 -b= buffer |
951 | 66 dentry rmb DIR.SZ*2 |
67 srcpath rmb 128 | |
68 buffend rmb 1 | |
69 pathext rmb 256 extended part of source pathlist | |
70 devname rmb 32 | |
71 cleartop equ . everything up to here gets cleared at start | |
72 direntbf rmb DIR.SZ | |
73 * Next is a user adjustable buffer with # modifier on command line. | |
74 * Some utilities won't need this flexibility, some will. | |
75 * Currently set up to be larger for Level 2 than Level 1 | |
76 * Note: this buffer must come just before the stack | |
77 linebuff rmb 256 | |
78 IFGT Level-1 | |
79 bigbuff rmb 8*1024 8K default buffer for Level 2 | |
80 ELSE | |
81 bigbuff rmb 512 512 byte default buffer for Level 1 | |
82 ENDC | |
83 * Finally the stack for any PSHS/PULS/BSR/LBSRs that we might do | |
84 rmb STACKSZ+PARMSZ | |
0 | 85 size equ . |
200
e9ce43cc215e
Made major changes to headers for consistency and identification
boisy
parents:
113
diff
changeset
|
86 |
951 | 87 * The utility name and edition goes here |
88 name fcs /dsave/ | |
89 fcb edition | |
90 | |
91 * Place constant strings here | |
92 IFNE DOHELP | |
93 HlpMsg fcb C$LF | |
94 fcb C$CR | |
95 HlpMsgL equ *-HlpMsg | |
96 ENDC | |
97 | |
98 UnkOpt fcc /unknown option: / | |
99 UnkOptL equ *-UnkOpt | |
100 | |
101 ShlEko fcc "t" | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
102 CR fcb C$CR |
951 | 103 |
104 Chd fcc "chd" | |
105 fcb C$CR | |
106 | |
107 MakDir fcc "makdir" | |
108 fcb C$CR | |
109 | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
110 Cmp fcc "cmp" |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
111 fcb C$CR |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
112 |
951 | 113 TMode fcc "tmode" |
114 fcb C$CR | |
115 TPause fcc ".1 pause" | |
116 fcb C$CR | |
117 TNoPause fcc ".1 -pause" | |
118 fcb C$CR | |
119 | |
120 Load fcc "load" | |
121 fcb C$CR | |
122 | |
123 Unlink fcc "unlink" | |
124 fcb C$CR | |
125 | |
126 Copy fcc "copy" | |
127 fcb C$CR | |
128 | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
129 OS9Gen fcc "os9gen" |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
130 fcb C$CR |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
131 |
955 | 132 OS9Boot fcs "OS9Boot" |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
133 |
951 | 134 DotDot fcc "." |
135 Dot fcc "." | |
136 fcb C$CR | |
137 | |
138 * Here's how registers are set when this process is forked: | |
139 * | |
140 * +-----------------+ <-- Y (highest address) | |
141 * ! Parameter ! | |
142 * ! Area ! | |
143 * +-----------------+ <-- X, SP | |
144 * ! Data Area ! | |
145 * +-----------------+ | |
146 * ! Direct Page ! | |
147 * +-----------------+ <-- U, DP (lowest address) | |
148 * | |
149 * D = parameter area size | |
150 * PC = module entry point abs. address | |
151 * CC = F=0, I=0, others undefined | |
152 | |
153 * The start of the program is here. | |
154 * Before any command line processing is done, we clear out | |
155 * our static memory from U to cleartop, then determine the | |
156 * size of our data area (minus the stack). | |
157 start pshs u,x save registers for later | |
158 leax cleartop,u point to end of area to zero out | |
159 IFNE H6309 | |
160 subr u,x subtract U from X | |
161 tfr x,w and put X in W | |
162 clr ,-s put a zero on the stack | |
163 tfm s,u+ and use TFM to clear starting at U | |
164 leas 1,s clean up the stack | |
165 ELSE | |
166 pshs x save end pointer on stack | |
167 clrnxt clr ,u+ clear out | |
168 cmpu ,s done? | |
169 bne clrnxt branch if not | |
170 leas 2,s else clear stack | |
171 ENDC | |
172 puls x,u and restore our earlier saved registers | |
173 leay bigbuff,u point Y to copy buffer offset in U | |
174 stx <parmptr save parameter pointer | |
175 sty <bufptr save pointer to buffer | |
176 tfr s,d place top of stack in D | |
177 IFNE H6309 | |
178 subr y,d | |
179 ELSE | |
180 pshs y save Y on stack | |
181 subd ,s++ get size of space between copybuf and X | |
182 ENDC | |
183 subd #STACKSZ+PARMSZ subtract out our stack/param size | |
184 std <bufsiz size of our buffer | |
185 | |
186 * At this point we have determined our buffer space and saved pointers | |
187 * for later use. Now we will parse the command line for options that | |
188 * begin with a dash. | |
189 * Note that X will NOT point to a space, but to either a CR (if no | |
190 * parameters were passed) or the first non-space character of the | |
191 * parameter. | |
192 * Here we merely grab the byte at X into A and test for end of line, | |
193 * exiting if so. Utilities that don't require arguments should | |
194 * comment out the following three lines. | |
195 lda ,x get first char | |
196 cmpa #C$CR CR? | |
197 lbeq ShowHelp if so, no parameters... show help and exit | |
198 GetChar lda ,x+ get next character on cmd line | |
199 cmpa #C$CR CR? | |
200 lbeq DoDSave if so, do whatever this utility does | |
201 cmpa #'- is it an option? | |
202 beq GetDash if so, process it | |
203 inc <plistcnt else must be a non-option argument (file) | |
204 lbsr SkipNSpc move past the argument | |
205 ChkDash lbsr SkipSpcs and any following spaces | |
206 bra GetChar start processing again | |
207 GetDash lda #C$SPAC get a space char | |
208 sta -1,x and wipe out the dash from the cmd line | |
209 GetDash2 ldd ,x+ load option char and char following | |
210 ora #$20 make lowercase | |
211 IsItB cmpa #'b is it this option? | |
212 bne IsItE branch if not | |
213 sta <doboot | |
1449
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
214 pshs x save for later |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
215 cmpb #'= = follows? |
955 | 216 beq DoEqual |
217 * -b alone, copy default bootfile name to bbuff | |
1449
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
218 * first, get device name |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
219 lda #DIR.+READ. |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
220 leax dot,pcr |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
221 os9 I$Open |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
222 lbcs Exit |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
223 leax >bbuff,u |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
224 ldb #PDELIM |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
225 stb ,x+ |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
226 ldb #SS.DevNm |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
227 os9 I$GetStt |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
228 lbcs Exit |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
229 os9 I$Close |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
230 os9 F$PrsNam |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
231 lbcs Exit |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
232 lda -1,y |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
233 anda #$7F wipe out hi bit |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
234 sta -1,y |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
235 lda #PDELIM |
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
236 sta ,y+ |
955 | 237 leax OS9Boot,pcr |
238 lbsr StrCpy | |
239 lda #C$CR | |
240 sta ,y | |
241 bra IsItBEx | |
1449
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
242 DoEqual leax 1,x move X past '=' |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
243 leay bbuff,u point to buffer |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
244 lbsr ParmCpy copy parameter from X to Y |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
245 lda #C$CR |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
246 sta ,y |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
247 lda #C$SPAC |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
248 IsItBLp sta ,-x |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
249 cmpx ,s |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
250 bne IsItBLp |
1449
9859ddd89ff8
Fixed bugs in -b option of dsave, modified ChangeLogs
boisy
parents:
1325
diff
changeset
|
251 clrb so FixCmdLn will not look for more opts |
955 | 252 IsItBEx puls x |
951 | 253 bra FixCmdLn |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
254 IsItE equ * |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
255 * cmpa #'e is it this option? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
256 * bne IsItI branch if not |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
257 * sta <doexec |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
258 * bra FixCmdLn |
951 | 259 IsItI cmpa #'i is it this option? |
260 bne IsItL branch if not | |
261 sta <indent | |
262 bra FixCmdLn | |
263 IsItL cmpa #'l is it this option? | |
264 bne IsItM branch if not | |
265 sta <onelevel | |
266 bra FixCmdLn | |
267 IsItM cmpa #'m is it this option? | |
268 bne IsItR branch if not | |
269 sta <nomakdir | |
270 bra FixCmdLn | |
271 IsItR cmpa #'r is it this option? | |
272 bne IsItS branch if not | |
273 sta <rewrite | |
274 bra FixCmdLn | |
275 IsItS cmpa #'s is it this option? | |
276 bne IsItV branch if not | |
277 * add code to parse memsize | |
278 pshs x | |
279 lbsr ASC2Byte | |
280 stb <sopt | |
281 lda #C$SPAC | |
282 SpcNext sta ,-x erase everything after -s | |
283 cmpx ,s | |
284 bne SpcNext | |
285 puls x | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
286 clrb |
951 | 287 bra FixCmdLn |
288 IsItV cmpa #'v is it this option? | |
289 bne BadOpt branch if not | |
290 sta <doverify | |
291 FixCmdLn lda #C$SPAC get space | |
292 sta -$01,x and wipe out option character | |
293 cmpb #'0 | |
294 lblt ChkDash start dash option processing again | |
295 lbra GetDash possibly another option following? | |
296 | |
297 * We branch here if we encounter an unknown option character | |
298 * A = bad option character | |
299 BadOpt leax UnkOpt,pcr | |
300 ldy #UnkOptL | |
301 ldb #C$CR | |
302 pshs d save bad option and CR on stack | |
303 lda #$02 stderr | |
304 os9 I$Write | |
305 leax ,s point X at option char on stack | |
306 os9 I$WritLn print option and CR | |
307 puls d clean up stack | |
308 lbra ShowHelp | |
309 | |
310 * At this point options are processed. | |
311 * We load X with our parameter pointer and go down the command line | |
312 * looking at each file to process (options have been wiped out with | |
313 * spaces) | |
314 * | |
315 * Note, the following two instructions may not be needed, depending on | |
316 * if your utility requires a non-option on the command line. | |
317 DoDSave dec <plistcnt we should have only one path on cmdline | |
318 lbne ShowHelp if not, exit with error | |
319 ldx <parmptr get our parameter pointer off stack | |
320 lbsr SkipSpcs skip any leading spaces | |
321 stx <dstpath save dest path | |
322 lbsr SkipNSpc | |
323 lda #C$CR | |
324 sta ,x+ | |
325 | |
326 * Here we have src and possibly destination pathlist. Now we can | |
327 * start processing the dsave | |
328 leax linebuff,u | |
329 stx <lineptr reset line buffer pointer | |
330 | |
331 * Get entire pathlist to working directory | |
332 lbsr pwd | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
333 * Open source device as raw and obtain 24 bit LSN to bootfile |
955 | 334 * ldd #$400D @ + CR |
335 * pshs d save on stack | |
336 * leax ,s point X to stack | |
337 * lda #READ. read mode | |
338 * os9 I$Open open | |
339 * puls x clean stack | |
340 * lbcs Exit branch if error | |
341 * pshs a save path | |
342 * ldx #0000 | |
343 * tfr u,y | |
344 * ldu #DD.BT | |
345 * os9 I$Seek seek to DD.BT in LSN0 | |
346 * tfr y,u | |
347 * lbcs Exit | |
348 * leax ddbt,u point to buffer | |
349 * ldy #3 read 3 bytes at DD.BT | |
350 * os9 I$Read | |
351 * lbcs Exit exit of error | |
352 * puls a get path on stack | |
353 * os9 I$Close and close it | |
951 | 354 |
355 * Do dsave "pre" commands | |
356 lbsr DoEcho | |
357 ldx <dstpath point to source path | |
358 lbsr DoChd chd to it | |
359 lbsr DoPauseOff | |
360 lbsr DoLoadCopy | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
361 tst <doverify |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
362 beq PreRecurse |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
363 lbsr DoLoadCmp |
951 | 364 |
365 * Steps in processing files: | |
366 * 0. Open path to '.' | |
367 * 1. Read next directory entry | |
368 * 2. if directory encountered: | |
369 * a. chd entry | |
370 * b. bsr step 0 | |
371 * c. chd .. | |
372 * 3. if eof, goto step 6 | |
373 * 4. copy file to dest | |
374 * 5. goto 1 | |
375 * 6. Close path to source dir | |
376 | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
377 PreRecurse |
951 | 378 leay buffend,u |
379 bsr CopyDir | |
380 | |
381 * Do dsave "post" commands | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
382 tst <doverify |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
383 beq PostRecurse |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
384 lbsr DoUnlinkCmp |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
385 PostRecurse |
951 | 386 lbsr DoUnlinkCopy |
387 lbsr DoPauseOn | |
388 | |
389 lbra ExitOk | |
390 | |
391 CopyDir ldx <srcptr | |
392 lda #DIR.+READ. permissions as DIR. | |
393 os9 I$Open open directory | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
394 lbcs CopyRts branch if error |
951 | 395 ldb #PDELIM |
396 stb ,y+ | |
397 pshs y | |
398 pshs a save path to . | |
399 pshs x,u save regs | |
400 ldx #$0000 | |
401 ldu #DIR.SZ*2 seek past two dir entries | |
402 os9 I$Seek skip over . and .. entries of this dir | |
403 puls x,u get saved regs | |
404 bcs Copy2Ex branch if error | |
405 FileLoop lda ,s get path to . on stack | |
406 ldy #DIR.SZ get size of directory entry | |
407 leax direntbf,u point to directory entry buffer | |
408 os9 I$Read read directory entry | |
409 bcs Copy2Ex branch if error | |
410 tst ,x first byte at x... is it zero? | |
411 beq FileLoop yep, empty dir entry | |
412 ldy 1,s get Y on stack | |
413 lbsr StrCpy | |
414 lda #C$CR | |
415 sta ,y | |
416 ldx <srcptr | |
417 lda #DIR.+READ. open as directory | |
418 os9 I$Open open it | |
419 bcs ItsAFile if error, it's not a dir | |
420 os9 I$Close close it | |
421 * Here, we know that the file we just opened and closed was a directory | |
422 ItsADir | |
423 tst <onelevel do we ignore dirs? | |
424 bne FileLoop branch if so | |
425 pshs y | |
426 ldx 3,s | |
427 lbsr DoMakDir makdir it | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
428 bcc ItsADir2 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
429 os9 F$PErr |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
430 ItsADir2 ldx 3,s |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
431 lbsr DoChd |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
432 bcs FileLoop if error, ignore dir |
951 | 433 inc <dirlevel |
434 puls y | |
435 bsr CopyDir | |
436 leax DotDot,pcr | |
437 lbsr DoChd | |
438 dec <dirlevel | |
439 bra FileLoop | |
440 | |
441 * Here, we know that the file we just opened and closed was NOT a directory | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
442 ItsAFile tst <dirlevel are we at root level? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
443 bne ItsAFile2 no, don't even do os9boot test |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
444 ldx 1,s else get ptr to current filename |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
445 lbsr BootCmp is it os9boot? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
446 bcs ItsAFile2 no, copy away! |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
447 tst <doboot -b option specified? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
448 beq FileLoop nope, ignore bootfile |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
449 |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
450 * Here we have a file named OS9Boot in the top level directory |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
451 * We must os9gen the sucker |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
452 lbsr BuildOS9Gen |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
453 bra FileLoop |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
454 |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
455 ItsAFile2 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
456 ldx 1,s |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
457 lbsr BuildCopy |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
458 tst <doverify verify on? |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
459 beq FileLoop branch if not |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
460 ldx 1,s |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
461 lbsr BuildCmp |
951 | 462 bra FileLoop |
463 Copy2Ex puls a get path to . | |
464 os9 I$Close close path | |
465 CopyEx leas 2,s | |
466 CopyRts rts | |
467 | |
468 ShowHelp equ * | |
469 IFNE DOHELP | |
470 leax >HlpMsg,pcr point to help message | |
471 ldy #HlpMsgL get length | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
472 lda #INDENTSZ std error |
951 | 473 os9 I$WritLn write it |
474 ENDC | |
475 ExitOk clrb clear carry | |
476 Exit os9 F$Exit and exit | |
477 | |
478 * This routine counts the number of non-whitespace characters | |
479 * starting at X | |
480 * | |
481 * Entry: | |
482 * X = ptr to string (space, comma or CR terminated) | |
483 * Exit: | |
484 * Y = length of string | |
485 * X = ptr to byte after string | |
486 StrLen pshs a | |
487 ldy #$0000 | |
488 StrLenLp lda ,x+ | |
489 cmpa #C$SPAC | |
490 beq StrLenEx | |
491 cmpa #C$CR | |
492 beq StrLenEx | |
493 leay 1,y | |
494 bra StrLenLp | |
495 StrLenEx puls a,pc | |
496 | |
497 * This routine copies a string of text from X to Y until | |
498 * a CR or hi bit char is encountered | |
499 * | |
500 * Entry: | |
501 * X = ptr to src string | |
502 * Y = ptr to dest string | |
503 * Exit: | |
504 * D = number of bytes copied | |
505 * X = ptr to char past src string | |
506 * Y = ptr to char past dest string | |
507 StrCpy pshs u | |
508 ldu #$0000 | |
509 CopyFnLp lda ,x+ | |
510 tfr a,b | |
511 anda #$7F | |
512 cmpa #C$CR | |
513 ble CopyFnEx | |
514 sta ,y+ | |
515 leau 1,u | |
516 tstb | |
517 bpl CopyFnLp | |
518 CopyFnEx tfr u,d | |
519 puls u,pc | |
520 | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
521 * Works like StrCpy, but stops if a space is encountered |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
522 ParmCpy pshs u |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
523 ldu #$0000 |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
524 ParmFnLp lda ,x+ |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
525 tfr a,b |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
526 anda #$7F |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
527 cmpa #C$SPAC |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
528 ble ParmFnEx |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
529 sta ,y+ |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
530 leau 1,u |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
531 tstb |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
532 bpl ParmFnLp |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
533 ParmFnEx tfr u,d |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
534 puls u,pc |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
535 |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
536 * Compare two filenames to see if they match |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
537 * X = filename to compare against OS9boot |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
538 BootCmp pshs y,x |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
539 lbsr StrLen get length of passed filename |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
540 puls x get pointer to passed filename |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
541 tfr y,d |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
542 leay OS9Boot,pcr |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
543 os9 F$CmpNam |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
544 puls y,pc |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
545 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
546 MakeUp cmpa #'a |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
547 blt MakeUpEx |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
548 cmpa #'z |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
549 bgt MakeUpEx |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
550 anda #$DF make uppercase |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
551 MakeUpEx rts |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
552 |
951 | 553 StrHCpy pshs u |
554 ldu #$0000 | |
555 HCpyFnLp lda ,x+ | |
556 beq HCpyFnEx | |
557 tfr a,b | |
558 anda #$7F strip out possible hi bit | |
559 sta ,y+ | |
560 leau 1,u | |
561 tstb test copy of byte in B | |
562 bpl HCpyFnLp if hi bit not set, keep going | |
563 * clr ,y+ add null byte at end | |
564 HCpyFnEx tfr u,d | |
565 puls u,pc | |
566 | |
567 * This routine skip over spaces | |
568 * | |
569 * Entry: | |
570 * X = ptr to data to parse | |
571 * Exit: | |
572 * X = ptr to first non-whitespace char | |
573 * A = non-whitespace char | |
574 SkipSpcs lda ,x+ | |
575 cmpa #C$SPAC | |
576 beq SkipSpcs | |
577 leax -1,x | |
578 rts | |
579 | |
580 * This routine skips over everything but spaces, commas and CRs | |
581 * | |
582 * Entry: | |
583 * X = ptr to data to parse | |
584 * Exit: | |
585 * X = ptr to first whitespace char | |
586 * A = whitespace char | |
587 SkipNSpc lda ,x+ | |
588 cmpa #C$SPAC | |
589 beq EatOut | |
590 cmpa #C$CR | |
591 bne SkipNSpc | |
592 EatOut leax -1,x | |
593 rts | |
594 | |
595 | |
596 * Entry: X = directory to make | |
597 DoMakDir | |
598 tst <nomakdir do we do the makdir? | |
599 bne Ret branch if not | |
600 pshs x | |
601 leax MakDir,pcr | |
602 bsr CopyCmd | |
603 ldx ,s | |
604 bsr CopyParm | |
605 bsr WriteIt | |
606 puls x | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
607 * tst <doexec are we executing? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
608 * beq Ret if not, just return |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
609 * lda #DIR.+PREAD.+PEXEC.+EXEC.+UPDAT. |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
610 * os9 I$MakDir |
951 | 611 rts |
612 | |
613 * Entry: X = path to chd to | |
614 DoChd | |
615 pshs x | |
616 leax Chd,pcr | |
617 bsr CopyCmd | |
618 ldx ,s | |
619 bsr CopyParm | |
620 bsr WriteIt | |
621 puls x | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
622 * tst <doexec are we executing? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
623 * beq Ret if not, just return |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
624 * lda #DIR.+READ. |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
625 * os9 I$ChgDir |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
626 * bcc Ret |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
627 * os9 F$PErr |
951 | 628 Ret rts |
629 | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
630 WriteIt ldy #1024 |
951 | 631 lda #1 |
632 os9 I$WritLn | |
633 Rts rts | |
634 | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
635 DoEcho equ * |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
636 * tst <doexec are we executing? |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
637 * bne Rts if so, ignore this shell command |
951 | 638 leax ShlEko,pcr else point to shell echo command |
639 bra WriteIt | |
640 | |
641 * Copy command into linebuff and put space after it | |
642 * Entry: X = pointer to command to copy to linebuff | |
643 CopyCmd leay linebuff,u and point Y to line buffer | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
644 * Do level indention if specified |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
645 tst <indent |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
646 beq CopyCmd3 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
647 lda <dirlevel |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
648 beq CopyCmd3 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
649 ldb #$02 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
650 mul |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
651 lda #C$SPAC |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
652 CopyCmd2 sta ,y+ |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
653 decb |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
654 bne CopyCmd2 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
655 CopyCmd3 lbsr StrCpy copy command |
951 | 656 lda #C$SPAC get space |
657 sta ,y+ and store it after command in buff | |
658 rts | |
659 | |
660 DoPauseOn | |
661 leax TMode,pcr | |
662 bsr CopyCmd | |
663 leax TPause,pcr get pause command | |
664 bsr CopyParm | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
665 bra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
666 * bra ExecCmd |
951 | 667 |
668 * Copy parameters into linebuff and put CR after it, then write it out to stdout | |
669 CopyParm lbsr StrCpy copy it | |
670 lda #C$CR | |
671 sta ,y+ and store CR after command in buff | |
672 leax linebuff,u | |
673 CPRts rts | |
674 | |
675 * Entry: X = command to execute, with parameters | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
676 *ExecCmd tst <doexec |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
677 * beq CPRts |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
678 * lbsr SkipSpcs skip any leading spaces at X |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
679 * tfr x,y transfer command ptr to Y temporarily |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
680 * lbsr SkipNSpc skip command |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
681 * clr ,x+ clear white space char and move X |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
682 * pshs u save our statics |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
683 * tfr x,u move paramter pointer to Y |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
684 * tfr y,x move command ptr from Y back to X |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
685 * ldy #256 |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
686 * clra |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
687 * os9 F$Fork |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
688 * os9 F$Wait |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
689 * bcc ExecRTS |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
690 * os9 F$PErr |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
691 *ExecRTS puls u,pc |
951 | 692 |
693 DoPauseOff | |
694 leax TMode,pcr | |
695 bsr CopyCmd | |
696 leax TNoPause,pcr | |
697 bsr CopyParm | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
698 lbra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
699 * bra ExecCmd |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
700 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
701 DoLoadCmp |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
702 leax Load,pcr point to load command |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
703 bsr CopyCmd copy it to buffer |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
704 leax Cmp,pcr point to copy command |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
705 bsr CopyParm copy it to buffer |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
706 lbra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
707 * bra ExecCmd |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
708 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
709 DoUnlinkCmp |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
710 leax Unlink,pcr |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
711 lbsr CopyCmd |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
712 leax Cmp,pcr |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
713 bsr CopyParm |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
714 lbra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
715 * bra ExecCmd |
951 | 716 |
717 DoLoadCopy | |
718 leax Load,pcr point to load command | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
719 lbsr CopyCmd copy it to buffer |
951 | 720 leax Copy,pcr point to copy command |
721 bsr CopyParm copy it to buffer | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
722 lbra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
723 * bra ExecCmd |
951 | 724 |
725 DoUnlinkCopy | |
726 leax Unlink,pcr | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
727 lbsr CopyCmd |
951 | 728 leax Copy,pcr |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
729 lbsr CopyParm |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
730 lbra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
731 * bra ExecCmd |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
732 |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
733 BuildOS9Gen |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
734 pshs x |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
735 leax OS9Gen,pcr |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
736 lbsr CopyCmd |
955 | 737 ldx <dstpath |
738 lbsr StrCpy copy to buffer | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
739 * write file name, then CR |
955 | 740 lda #C$CR get space |
741 sta ,y+ and store it after command in buff | |
742 leax linebuff,u | |
743 lbsr WriteIt | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
744 leax bbuff,u |
951 | 745 lbsr WriteIt |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
746 leax CR,pc |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
747 lbsr WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
748 puls x,pc |
951 | 749 |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
750 BuildCmp pshs x |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
751 leax Cmp,pcr |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
752 lbsr CopyCmd |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
753 bra BuildCopy3 |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
754 |
951 | 755 BuildCopy |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
756 pshs x |
951 | 757 leax Copy,pcr |
758 lbsr CopyCmd | |
962 | 759 ldb <sopt -s option specified? |
951 | 760 beq BuildCopy2 |
761 lda #'# | |
762 sta ,y+ | |
763 lbsr Byte2ASC | |
764 ldd #$4B20 K'space' | |
765 std ,y++ | |
962 | 766 BuildCopy2 |
767 tst <rewrite | |
768 beq BuildCopy3 | |
769 ldd #$2D72 -r | |
770 std ,y++ | |
771 lda #C$SPAC | |
772 sta ,y+ | |
951 | 773 BuildCopy3 |
774 ldx <srcptr get source path from statics | |
775 lbsr StrCpy copy to buffer | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
776 lda #C$SPAC get space |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
777 sta ,y+ and store it after command in buff |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
778 puls x |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
779 lbsr StrCpy |
951 | 780 lda #C$CR get space |
781 sta ,y+ and store it after command in buff | |
782 leax linebuff,u | |
954
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
783 lbra WriteIt |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
784 * lbsr ExecCmd |
9a075092f6ce
-b now working closer to original dsave, but BuildOS9Gen routine still
boisy
parents:
953
diff
changeset
|
785 * rts |
951 | 786 |
787 * Code to get current working directory | |
788 pwd leax >buffend,u point X to buffer | |
789 * lda #PDELIM get path delimiter | |
790 * sta ,x store at start of buffer | |
791 stx <srcptr store buffer pointer | |
792 leax >dot,pcr point to '.' | |
793 bsr open open directory | |
794 sta <fildes save path | |
795 lbsr rdtwo read '.' and '..' entries | |
796 ldd <dotdotfd get 24 bit LSN of .. | |
797 std <ddcopy | |
798 lda <dotdotfd+2 | |
799 sta <ddcopy+2 and save copy | |
800 L0052 bsr AtRoot are we at root? | |
801 beq L0079 branch if so | |
802 leax >dotdot,pcr else point to '..' | |
803 bsr chdir change directory | |
804 lda <fildes get path to previous dir | |
805 os9 I$Close close it | |
806 lbcs Exit branch if error | |
807 leax >dot,pcr point X to new current dir | |
808 bsr open open it | |
809 bsr rdtwo read . and .. entires of this dir | |
810 bsr FindMtch search for match | |
811 bsr L00E2 | |
812 ldd <dotdotfd | |
813 std <ddcopy | |
814 lda <dotdotfd+2 | |
815 sta <ddcopy+2 | |
816 bra L0052 | |
817 L0079 lbsr GetDevNm get device name | |
818 lda <fildes get path | |
819 os9 I$Close close | |
820 rts | |
821 | |
822 chdir lda #DIR.+READ. | |
823 os9 I$ChgDir | |
824 rts | |
825 | |
826 open lda #DIR.+READ. | |
827 os9 I$Open | |
828 rts | |
829 | |
830 * Read directory entry | |
831 read32 lda <fildes | |
832 leax dentry,u | |
833 ldy #DIR.SZ | |
834 os9 I$Read | |
835 rts | |
836 | |
837 FindMtch lda <fildes get path to current dir | |
838 bsr read32 read entry | |
839 lbcs pwdrts branch if error | |
840 leax dentry,u point to entry buffer | |
841 leax <DIR.FD,x point X to FD LSN | |
842 leay ddcopy,u point Y to copy of LSN | |
843 bsr attop compare the two | |
844 bne FindMtch keep reading until we find match | |
845 rts | |
846 | |
847 * Compare 3 bytes at X and Y | |
848 attop ldd ,x++ | |
849 cmpd ,y++ | |
850 bne L00C5 | |
851 lda ,x | |
852 cmpa ,y | |
853 L00C5 rts | |
854 | |
855 AtRoot leax dotdotfd,u point X at .. entry | |
856 leay dotfd,u point Y at . entry | |
857 bsr attop check if we're at the top | |
858 pwdrts rts | |
859 | |
860 rdtwo bsr read32 * read "." from directory | |
861 ldd <dentry+DIR.FD | |
862 std <dotfd | |
863 lda <dentry+DIR.FD+2 | |
864 sta <dotfd+2 | |
865 bsr read32 * read ".." from directory | |
866 ldd <dentry+DIR.FD | |
867 std <dotdotfd | |
868 lda <dentry+DIR.FD+2 | |
869 sta <dotdotfd+2 | |
870 rts | |
871 | |
872 * Get name from directory entry | |
873 L00E2 leax dentry,u | |
874 prsnam os9 F$PrsNam | |
875 lbcs pwdrts | |
876 ldx <srcptr | |
877 L00EB lda ,-y | |
878 anda #$7F mask hi bit | |
879 sta ,-x save | |
880 decb | |
881 bne L00EB | |
882 lda #PDELIM | |
883 sta ,-x | |
884 stx <srcptr | |
885 rts | |
886 | |
887 GetDevNm lda <fildes | |
888 ldb #SS.DevNm | |
889 leax >devname,u | |
890 os9 I$GetStt | |
891 bsr prsnam | |
892 rts | |
893 | |
894 | |
895 * Entry: X = ptr to ASCII number | |
896 * Exit: B = byte value of ASCII number | |
897 ASC2Byte clrb clear B | |
898 ASC2BLp lda ,x+ get byte from X | |
899 cmpa #'0 | |
900 blt ASC2BEx | |
901 suba #'0 make 8 bit integer | |
902 cmpa #$09 compare against 9 | |
903 bhi ASC2BEx branch if greater | |
904 pshs a else save A | |
905 lda #10 multiply by 10 | |
906 mul do it | |
907 addb ,s+ add on stack | |
953
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
908 bcc ASC2BLp if overflow clear, do it again |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
909 ASC2BEx |
c8489e2f382d
Virtually 100% working EXCEPT for -b option. also need to support -b=xxx
boisy
parents:
951
diff
changeset
|
910 * leax -1,x load byte |
951 | 911 rts return |
912 | |
913 * Entry: Y = address to store number | |
914 * B = number to convert | |
915 Byte2ASC lda #$2F start A out just below $30 (0) | |
916 Hundreds inca inc it | |
917 subb #100 subtract 100 | |
918 bcc Hundreds if result >= 0, continue | |
919 cmpa #'0 zero? | |
920 beq Tens if so, don't add to buffer | |
921 sta ,y+ else save at U and inc. | |
922 Tens lda #$3A start A out just above $39 (9) | |
923 TensLoop deca dec it | |
924 addb #10 add 10 | |
925 bcc TensLoop if carry clear, continue | |
926 sta ,y+ save 10's digit | |
927 addb #'0 | |
928 stb ,y+ and 1's digit | |
929 rts | |
930 | |
0 | 931 emod |
932 eom equ * | |
951 | 933 end |