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