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