Mercurial > hg > Members > kono > nitros9-code
annotate level1/cmds/shellplus.asm @ 2954:43588191b624
rules.mak: Generate assembly listings if LISTDIR is defined
This is useful for debugging.
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sat, 08 Feb 2014 02:12:13 +0100 (2014-02-08) |
parents | 5c6b71612ce4 |
children |
rev | line source |
---|---|
714 | 1 ******************************************************************** |
1505 | 2 * Shellplus - Enhanced shell for NitrOS-9 |
714 | 3 * |
4 * Modified by L. Curtis Boyle from original 2.2 disassembly | |
5 * | |
6 * $Id$ | |
7 * | |
1255 | 8 * Edt/Rev YYYY/MM/DD Modified by |
9 * Comment | |
714 | 10 * ------------------------------------------------------------------ |
1255 | 11 * 21 ????/??/?? |
12 * Original Tandy/Microware version. | |
13 * | |
14 * 22/2 ????/??/?? | |
15 * History and numerous features added. | |
2358
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
16 * |
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
17 * 23 2010/01/19 Boisy G. Pitre |
2372 | 18 * Added code to honor S$HUP signal and exit when received to support |
2358
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
19 * networking. |
714 | 20 |
21 nam Shell | |
1505 | 22 ttl Enhanced shell for NitrOS-9 |
714 | 23 |
24 * Disassembled 93/04/15 14:58:18 by Disasm v1.6 (C) 1988 by RML | |
25 * Signals: Signals 2 & 3 are assigned new keys to handle forward/backward | |
26 * command history. Signal $B (11) is the signal sent out on a key being ready | |
27 * for normal command processing | |
28 | |
29 ifp1 | |
30 use defsfile | |
31 endc | |
32 | |
33 tylg set Prgrm+Objct | |
34 atrv set ReEnt+rev | |
2358
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
35 rev set $00 |
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
36 edition set 23 |
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
37 |
714 | 38 mod eom,name,tylg,atrv,start,size |
39 | |
40 u0000 rmb 1 Path # for standard input | |
41 u0001 rmb 1 Path # for standard output | |
42 u0002 rmb 1 Path # for standard error | |
43 u0003 rmb 1 # of 256 byte pages of data mem for frked module | |
44 u0004 rmb 2 Temp ptr (current parse ptr, mem module ptr,etc) | |
45 u0006 rmb 2 Size of current group | |
46 u0008 rmb 2 Pointer to start of current group (past '(') | |
47 u000A rmb 2 | |
48 u000C rmb 1 Current char. being processed in command parser | |
49 u000D rmb 1 # of command groups [ '()' groupings ] | |
50 u000E rmb 1 unprocessed signal # (0=none waiting) | |
51 u000F rmb 1 ??? Flag of some sort | |
52 u0010 rmb 2 ??? (ptr to some module name) | |
53 u0012 rmb 1 Current working DIR path # | |
54 u0013 rmb 1 Flag to kill parent process (1=Kill parent) | |
55 u0014 rmb 1 Flag: If set, a result must not be 0 ??? | |
56 u0015 rmb 1 | |
57 u0016 rmb 1 | |
58 u0017 rmb 1 | |
59 u0018 rmb 1 Immortal shell (0=NO) | |
60 * A clearing routine only does u0000 to u0018 | |
61 u0019 rmb 1 | |
62 u001A rmb 2 | |
63 u001C rmb 1 Shell logging on flag (0=OFF) | |
64 u001D rmb 1 Shell prompting (0=ON) | |
65 u001E rmb 1 Echo input (0=OFF) | |
66 u001F rmb 1 Variable expansion (0=ON) | |
67 u0020 rmb 1 Kill shell on error (0=OFF) | |
68 u0021 rmb 1 Process # to set priority on | |
69 u0022 rmb 1 Priority to set (0=don't change) (ours or fork) | |
70 u0023 rmb 2 | |
71 u0025 rmb 2 End of data mem ptr (top of stack) | |
72 u0027 rmb 1 | |
73 u0028 rmb 1 | |
74 u0029 rmb 1 | |
75 u002A rmb 2 | |
76 u002C rmb 2 | |
77 u002E rmb 1 | |
78 u002F rmb 1 | |
79 u0030 rmb 1 | |
80 u0031 rmb 1 | |
81 u0032 rmb 2 | |
82 u0034 rmb 3 | |
83 u0037 rmb 1 Flag: 0=Data dir .PWD invalid, 1=valid | |
84 u0038 rmb 1 Flag: 0=Exec dir .PXD invalid, 1=valid | |
85 u0039 rmb 1 | |
86 u003A rmb 1 | |
87 u003B rmb 2 | |
88 u003D rmb 1 | |
89 u003E rmb 2 | |
90 u0040 rmb 2 Ptr to start of filename (vs. pathname) ('/') | |
91 * Shell prompt flag | |
92 u0042 rmb 1 Current working dir path already done flag | |
93 u0043 rmb 1 | |
94 u0044 rmb 1 | |
95 u0045 rmb 1 ??? <>0 means looking for GOTO label? | |
96 u0046 rmb 1 Flag: 1=GOTO label found? | |
97 u0047 rmb 1 Error code from ReadLn or signal | |
98 u0048 rmb 2 Ptr to 1st char after redirection symbols | |
99 u004A rmb 2 Ptr to text message | |
100 u004C rmb 2 Size of text message | |
101 u004E rmb 1 | |
102 u004F rmb 1 0=no pathname in parm line, else IS pathname | |
103 u0050 rmb 2 | |
104 u0052 rmb 2 Current expanded buffer size (max=2048) | |
105 u0054 rmb 2 Ptr to current char in wildcard filename we are | |
106 * checking | |
107 u0056 rmb 2 Ptr to current pos in expanded buffer | |
108 u0058 rmb 2 Pointer to end of GOTO label name | |
109 u005A rmb 2 User ID # from F$ID call | |
110 u005C rmb 1 | |
111 u005D rmb 1 | |
112 u005E rmb 1 Device type: 0=SCF (keyboard),1=RBF (Scriptfile) | |
113 u005F rmb 1 | |
114 u0060 rmb 1 Data module linked flag: 1= Yes | |
115 u0061 rmb 2 Ptr to data module name | |
116 u0063 rmb 2 Ptr to intercept routines data mem | |
117 u0065 rmb 2 Execution address of linked module | |
118 u0067 rmb 2 Start address of module | |
119 u0069 rmb 2 | |
120 u006B rmb 1 Flag: 0=No module to unlink, <>0 module to unlink | |
121 u006C rmb 1 | |
122 u006D rmb 1 Start of device name buffer (start with '/') | |
123 u006E rmb 71 Actual device name | |
124 u00B5 rmb 20 Start of another device name buffer ('/') | |
125 u00C9 rmb 13 | |
126 u00D6 rmb 13 Standard module header info (M$ID-M$Mem) | |
127 u00E3 rmb 5 Module name string (reserves 64 chars) | |
128 u00E8 rmb 3 | |
129 u00EB rmb 4 | |
130 u00EF rmb 10 Temp buffer (many uses) | |
131 u00F9 rmb 6 | |
132 u00FF rmb 37 Place to point SP when CHAINing | |
133 u0124 rmb 81 Temporary buffer (used for several things) | |
134 u0175 rmb 119 Part of temp buffer for ReadLn (200 chars total) | |
135 u01EC rmb 2 Least sig. 2 digits of process # (ASCII format) | |
136 u01EE rmb 1 | |
137 u01EF rmb 2 Holding area for 2 digit ASCII conversions | |
138 * Shell prompt parsing flags | |
139 u01F1 rmb 1 Process ID # already done flag | |
140 u01F2 rmb 1 Standard output device name already done flag | |
141 u01F3 rmb 1 Quoting on flag in shell prompt string parsing | |
142 u01F4 rmb 1 Date already done flag | |
143 u01F5 rmb 1 Time already done flag | |
144 u01F6 rmb 1 Date OR time already done flag | |
145 u01F7 rmb 2 Size of expanded shell prompt | |
146 u01F9 rmb 25 Current shell prompt string | |
147 u0212 rmb 1 Lead in Line feed for expanded shell prompt | |
148 u0213 rmb 199 Expanded shell prompt | |
149 u02DA rmb 6 Date/time packet | |
150 u02E0 rmb 8 Date string | |
151 u02E8 rmb 1 Space separating date & time (for shell init) | |
152 u02E9 rmb 9 Time string (and CR) | |
153 u02F2 rmb 131 | |
154 u0375 rmb 131 | |
155 u03F8 rmb 29 | |
156 u0415 rmb 2 | |
157 u0417 rmb 1 | |
158 u0418 rmb 400 Intercept routines memory area (not used) | |
159 u05A8 rmb 810 Shell variables (user?) | |
160 u08D2 rmb 810 Shell variables (shell sub?) | |
161 u0BFC rmb 80 | |
162 u0C4C rmb 81 Copy of GOTO label name | |
163 u0C9D rmb 32 DIR Entry buffer | |
164 u0CBD rmb 32 Shell logging filename (append mode '+') | |
165 u0CDD rmb 400 PATH=Buffer (each entry CR terminated) | |
166 u0E6D rmb 2048 Fully expanded filenames buffer (for wildcards) | |
167 * Actually,this next block appears to be generic buffers for various functions | |
168 u166D rmb 80 Process descriptor copies go here (512 bytes) | |
169 u16BD rmb 1 | |
170 u16BE rmb 80 | |
171 u170E rmb 238 | |
172 u17FC rmb 10 | |
173 u1806 rmb 2 ??? Ptr to end of shell history buffers | |
174 u1808 rmb 2 Ptr to where next history entry will go | |
175 u180A rmb 2 Ptr to start of shell history buffers | |
176 u180C rmb 1 # of lines in history buffer (1-(u180C)) | |
177 u180D rmb 1 Current line # in history buffer | |
178 u180E rmb 1 Original keyboard terminate char | |
179 u180F rmb 1 Original keyboard interrupt char | |
180 u1810 rmb 1 | |
181 u1811 rmb 1 Original end of line NUL count | |
182 u1812 rmb 1 Flag to indicate if we have to restore PD.OPT | |
183 u1813 rmb 2 | |
184 u1815 rmb 808 Shell history copies start here | |
185 u1B3D rmb 963 Local stack space, etc. | |
186 size equ . | |
187 name equ * | |
188 L000D fcs /Shell/ | |
2358
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
189 fcb edition |
714 | 190 L0013 fcb Prgrm+PCode |
191 fcs 'PascalS' | |
192 fcb Sbrtn+CblCode | |
193 fcs 'RunC' | |
194 fcb Sbrtn+ICode | |
195 L0021 fcs 'RunB' | |
196 fcb $00,$00,$00,$00,$00,$00,$00,$00,$00 | |
197 L002E fcb C$LF | |
198 fcc 'Shell+ v2.2a ' | |
199 L003C fcb $00 | |
200 L003D fcc '{@|#}$: ' | |
201 L0055 fcc '+++START+++' | |
202 fcb C$CR | |
203 L0061 fcc '+++END+++' | |
204 fcb C$CR | |
205 * Intercept routine | |
206 L006B stb <u000E Save signal code & return | |
2372 | 207 * +++ BGP added for Hang Up |
208 * +++ Note we are exiting even if shell is immortal! | |
209 cmpb #S$HUP | |
2358
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
210 lbeq exit |
2360 | 211 * +++ |
714 | 212 rti |
213 | |
214 start leas -5,s Make 5 byte buffer on stack | |
215 pshs y,x,d Save Top/bottom of param area, and size of area | |
216 leax >u1815,u Pointer to start of history buffer area | |
217 stx >u1808,u Save ptr to where next history entry goes | |
218 stx >u180A,u Save ptr to start of history buffers | |
219 leax >$0328,x Setup up another pointer (end of history area?) | |
220 stx >u1806,u Save it | |
221 clr >u1812,u Clear flag that we have to restore PD.OPT | |
222 clr >u180D,u Current line # of history buffer=0 | |
223 clr >u180C,u # lines in history buffer=0 | |
224 ldx 2,s Get back top of data area ptr | |
225 ldb #$FF 255 bytes to clear | |
226 lbsr L0412 Go clear direct page | |
227 sts <u0025 Save current stack ptr | |
228 stu <u0027 Save Data mem ptr (0) | |
229 leax >u0418,u Point to intercept routines memory area | |
230 stx <u0063 Save a copy of it | |
231 leax <L006B,pc Point to intercept routine | |
232 os9 F$Icpt Setup the intercept routine | |
233 lbsr L16A6 Get user #, and make 2 digit ASCII ver. @ 1EC | |
234 lbsr L1674 Make shell logging pathname @ CBD | |
235 leax <L003D,pc Point to default shell prompt string | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
236 lbsr CmdPEq Go create shell prompt string & prompt itself |
714 | 237 leax >u05A8,u Point to start of shell variables |
238 ldd #C$CR*256+20 Carriage return (blank entries) & all 20 of them | |
239 L009C sta ,x Mark shell variable as blank | |
240 leax <81,x Point to next entry (81 bytes/entry) | |
241 decb Do until all 20 are done (user & shell sub) | |
242 bne L009C | |
243 sta >u0CDD,u Init 1st 2 entries of PATH= buffer to CR's | |
244 sta >u0CDD+1,u | |
245 puls x,d Get parameter ptr & parameter size | |
246 std <u0006 Save size of parameter area | |
247 beq L00BF If no parameters, skip ahead | |
248 lbsr L041B Pre-Parse parameters passed to this shell | |
249 lbcs L01FA Error, go handle it | |
250 tst <u000C Any char being processed in parser? | |
251 lbne L01F9 Yes, skip ahead | |
252 L00BF lbsr L0225 Release any keyboard/mouse signals & get PD.OPT | |
253 inc <u006C ??? Set flag | |
254 lds ,s++ Since parameters parsed, point SP to top of mem | |
255 sts <u0025 Save end of data mem ptr (top of stack) | |
256 stu <u0027 Save start of data mem ptr | |
257 L00CC leax >L002E,pc Point to Shellplus v2.2 message | |
258 tst <u001D Shell prompting turned on? | |
259 bne L00EA No, skip ahead | |
260 ldy #$000E Length of message | |
261 lda #$01 Standard out | |
262 os9 I$Write Write it | |
263 lbcs L0200 If error writing, terminate Shellplus | |
264 bsr L00FB Go create date & time strings | |
265 lbsr L021B Write out date & time | |
266 lbcs L0200 If error writing, terminate Shellplus | |
267 L00EA clra | |
268 sta <u005C | |
269 leax >L0055,pc Point to '+++START+++' for shell logging | |
270 lbsr L07E7 Go deal with logging if necessary | |
271 tst <u001D Shell prompting turn on? | |
272 bne L0120 No, skip ahead | |
273 bra L010D Yes, do something else first | |
274 | |
275 L00FB clr >u01F6,u Clear date or time done flag | |
276 lbsr L0B3B Create current date & time strings | |
277 lda #C$SPAC Put in a space to separate date & time | |
278 sta >u02E8,u | |
279 leax >u02E0,u Point to start of date buffer | |
280 rts | |
281 | |
282 * Shell just booted goes here | |
283 L010D lbsr L09F7 Update expanded shell prompt if needed | |
284 leax >u0212,u Point to expanded shell prompt | |
285 ldy >u01F7,u Get size of expanded shell prompt | |
286 L0119 tst <u001D Shell prompting on? | |
287 bne L0120 No, continue on | |
288 lbsr L021F Print shell prompt to standard error | |
289 * Shell already booted goes here | |
290 L0120 clra | |
291 leax >u0124,u Point to an input line of some sort | |
292 tst <u006B Any module linked? | |
293 beq L015B No, continue on | |
294 ldy <u0065 Yes, get Execution address of linked module | |
295 cmpy <u0069 ??? | |
296 lbhs L01F0 | |
297 ldb #200 LDW #200/PSHS X/TFM Y+,X+ | |
298 pshs x Copy temporary buffer to [<u0065] | |
299 L0137 lda ,y+ | |
300 sta ,x+ | |
301 decb | |
302 beq L014E Whole buffer copied, skip ahead | |
303 cmpy <u0069 But don't go past here | |
304 bhs L0147 | |
305 cmpa #C$CR Also, stop on carriage return | |
306 bne L0137 | |
307 L0147 sty <u0065 Save new start address | |
308 puls x Restore ptr to u0124 | |
309 bra L01B9 Skip ahead | |
310 | |
311 L014E lda ,y+ | |
312 cmpy <u0069 | |
313 bhs L0147 | |
314 cmpa #C$CR | |
315 bne L014E | |
316 bra L0147 | |
317 | |
318 L015B tst <u005E We reading from script file? | |
319 bne L017F Yes, skip ahead | |
320 ldd #SS.Relea Std input path/release keyboard+mouse signals | |
321 os9 I$SetStt Release any keyboard signals | |
322 lbsr L18DB Go modify signals 2&3 to use up/down arrows, | |
323 * set up to re-enable Kybd signals | |
324 L016A clr <u000E Clear out last signal received | |
325 os9 I$SetStt Re-set up SS.SSig | |
326 * NOTE: This BRA L0177 is required for type-ahead to work | |
327 bra L0177 Go check for history-related signals | |
328 | |
329 * DOESN'T SEEM TO GET BACK TO HERE WHEN ABORT BUG APPEARS | |
330 L0171 ldx #$0000 Sleep until signal is received | |
331 os9 F$Sleep | |
332 L0177 lbra L191C Go check for history signals (PD.QUT & PD.INT) | |
333 * Signal received is not PD.QUT or PD.INT goes here | |
334 L017B cmpb #$0B Key pressed signal? | |
335 bne L0171 No, ignore signal & go to sleep again | |
336 * Keyboard input received signal goes here | |
337 L017F leax >u0124,u Point to temp buffer to hold line | |
338 clra Std Input | |
339 ldy #200 Maximum 200 char. input | |
340 lbra L193E Go read the rest of line as ReadLn | |
341 | |
342 * Comes here after line or signal received & processed | |
343 * NOTE: IF LINE RECEIVED, PD.QUT & PD.INT ARE BACK TO NORMAL VALUES | |
344 L018B bcc L01B9 If no errors, skip ahead | |
345 cmpb #E$EOF <ESC> key in ReadLn? | |
346 beq L01F0 Yes, skip ahead | |
347 | |
348 L0191 lds <u0025 Get top of stack ptr | |
349 ldu <u0027 Get back ptr to DP | |
350 stb <u0047 Save error code | |
351 tst <u0046 GOTO label active? | |
352 bne L01A4 Yes, go print error message | |
353 tst <u0018 Is this shell immortal? | |
354 bne L01A4 Yes, go print error message | |
355 tst <u0020 Kill shell on error? | |
356 bne L01FA Yes, go do that | |
357 | |
358 L01A4 os9 F$PErr Print the error message | |
359 tst <u0046 GOTO label active? | |
360 lbeq L010D No, go print shell prompt/process next line | |
361 clr <u0046 Clear GOTO label flag | |
362 leax >u0C4C,u Point to copy of GOTO label name | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
363 lbsr CmdGOTO Go process GOTO line |
714 | 364 lbra L010D Go print shell prompt/process next line |
365 | |
366 * No error received on line | |
367 L01B9 cmpy #$0001 Just 1 char read (just a CR)? | |
368 bhi L01CE No, go parse parameters | |
369 lbsr L09F7 Go update date/time & expanded shell prompt | |
370 leax >u0213,u Point to expanded shell prompt | |
371 ldy >u01F7,u Get size of expanded shell prompt | |
372 lbra L0119 Go print shell prompt & get next line from user | |
373 | |
374 * No errors-got input line, and there is something in it | |
375 L01CE lbsr L041B Go parse parameters? | |
376 pshs cc Save flags | |
377 tst <u0045 | |
378 bne L01D9 | |
379 clr <u0047 Clear error/signal code from ReadLn | |
380 L01D9 puls cc Restore flags | |
381 lbcc L010D If no error from parse, do prompts & read again | |
382 tstb If a 0 error, do prompts & read again | |
383 lbeq L010D | |
384 tst <u0045 ??? Do we care about errors? | |
385 bne L0191 No, go handle error | |
386 stb <u0047 Save error/signal code | |
387 bra L0191 Go handle error | |
388 | |
389 L01EC fcc 'eof' | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
390 fcb C$CR |
714 | 391 |
392 * <ESC> received | |
393 L01F0 tst <u001D Shell prompting on? | |
394 L01F2 bne L01F9 No, skip printing 'eof' to screen | |
395 leax <L01EC,pc Point to 'eof' string | |
396 bsr L021B Write it out to std error | |
397 L01F9 clrb No error flag | |
398 * Possible shell error - Process | |
399 L01FA lda <u0018 Is this shell immortal? | |
400 lbne L0BDA Yes, go close or dupe paths | |
401 * Shell not immortal, exit routine in here | |
402 L0200 pshs u,b,cc Preserve regs | |
403 tst <u006B Shellsub module to unlink? | |
404 beq L020B No, skip ahead | |
405 ldu <u0067 Yes, get ptr to module | |
406 os9 F$UnLink Unlink it | |
407 L020B puls u,b,cc Restore U, error # & flags | |
408 * EX with no module name (or non-existant one) go here | |
409 L020D pshs b,cc Save error # & flags | |
410 leax >L0061,pc Point to '+++END+++' string | |
411 lbsr L07E7 Close log file if one is open, restore ID # | |
412 puls b,cc Restore error # & flags | |
2358
79c544b33a09
Made to honor S$Peer signal (sent when peer disconnects)
boisy
parents:
1505
diff
changeset
|
413 exit os9 F$Exit Terminate shellplus |
714 | 414 |
415 L021B ldy #80 Write up to 80 chars or CR | |
416 L021F lda #$02 Std error path | |
417 os9 I$WritLn Write message out & return | |
418 rts | |
419 | |
420 L0225 pshs y,x,d Preserve regs | |
421 ldd #SS.Relea Std In & Release keyboard & mouse signals | |
422 os9 I$SetStt | |
423 bcc L0233 No error, continue | |
424 lda #$01 Couldn't release keyboard/mouse signals flag | |
425 bra L0241 | |
426 | |
427 L0233 leax >u0124,u Point to buffer for current path options | |
428 clra | |
429 clrb CHANGE TO CLRB | |
430 os9 I$GetStt Get std input path options | |
431 lda >u0124,u Get Device type (0 (SCF) usually) | |
432 | |
433 L0241 sta <u005E Save device type (1=SS.Relea failed) | |
434 puls pc,y,x,d Restore regs & return | |
435 | |
436 * R= command (redirect specific paths) | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
437 CmdREq lda ,x Get char from input line |
714 | 438 cmpa #'< Is it input path? |
439 beq L0251 Yes, skip ahead | |
440 cmpa #'> Is it an output/error path? | |
441 lbne L0BCF No, print 'WHAT?' | |
442 L0251 pshs x Preserve ptr to 1st redirection symbol | |
443 leay >L03CF,pc Point to modifier symbol table | |
444 lbsr L092A Go to command line parser | |
445 lbcs L0BCF Error, print 'WHAT?' | |
446 ldd ,y Get table offset | |
447 jsr d,y Call appropriate subroutine | |
448 stx <u0048 Save ptr to source after redirection symbols | |
449 puls x Restore ptr to redirection symbols | |
450 lbcs L0B96 If error in subroutine, close paths & return | |
451 | |
452 L026A lda ,x+ Get 1st char again | |
453 cmpa #'< Input path? | |
454 beq L026A Yes, skip to next | |
455 cmpa #'> Output or Error path? | |
456 beq L026A Yes, skip to next | |
457 cmpa #'- Overwrite old file? | |
458 beq L026A Yes, skip to next | |
459 cmpa #'+ Append to old file? | |
460 beq L026A Yes, skip to next | |
461 leax -1,x Point to non-redirect char | |
462 bsr L02A3 Make name buffer, release signals,parse modifiers | |
463 clrb Start path # 0 | |
464 L0281 pshs b Save on stack | |
465 lda b,u Get special path # | |
466 beq L028A None, skip ahead | |
467 os9 I$Close Close the path | |
468 L028A puls b Get path # back | |
469 clr b,u Clear out entry | |
470 incb Next path # | |
471 cmpb #$03 Done the 3 standard paths yet? | |
472 blo L0281 No, keep doing until all done | |
473 ldx <u0048 Get ptr to redirected dev/file name & return | |
474 rts | |
475 * Z= command (immortal shell setting, but kill parent process) | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
476 CmdZEq inc <u0013 Flag we want to kill parent |
714 | 477 * I= command (immortal shell setting) |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
478 CmdIEq lbsr L0CD2 |
714 | 479 lbcs L0B96 |
480 bsr L02A3 | |
481 bra L02D4 | |
482 | |
483 * Create device name buffer @ u006D, Write NUL to std out, parse special | |
484 * chars: # @ @+hibit $ ( ), Release any keyboard/mouse signals | |
485 L02A3 pshs x Prsrve ptr to file/dev name we're redirecting to | |
486 ldb #SS.DevNm Get device name call code | |
487 leax <u006D,u Point to buffer for path names | |
488 lda #'/ Preload '/' for device names | |
489 sta ,x+ | |
490 clra Standard input path | |
491 os9 I$GetStt Get the current device name | |
492 puls x Get back ptr to file/dev name for redirection | |
493 lbcs L0B96 Error on GetStt, shut down paths & exit | |
494 ldy #$0001 One char to write | |
495 pshs x Prsrve ptr to file/dev name we're redirecting to | |
496 leax >L003C,pc Point to a NUL | |
497 lda #1 Std out | |
498 os9 I$Write Write the NUL out | |
499 puls x Restore Devname ptr | |
500 lbcs L0B96 Error on Write, shut down paths & exit | |
501 lbsr L0A04 Do normal parsing - includes #,@,$e0,$,(,) | |
502 lbsr L0225 Release signals | |
503 rts | |
504 | |
505 L02D4 inc <u0018 Set 'immortal shell' flag | |
506 inc <u0019 ??? (flag used by L0B96 routine) | |
507 lbsr L0B96 | |
508 clr <u0019 | |
509 tst <u0013 Do we want to kill the parent process? | |
510 beq L02FC | |
1505 | 511 IFEQ Level-1 |
512 ldx <D.Proc | |
513 ELSE | |
714 | 514 os9 F$ID Get our process ID # into A |
515 pshs x Preserve X | |
516 leax >u166D,u Point to process descriptor buffer | |
517 os9 F$GPrDsc Get our process descriptor | |
1505 | 518 ENDC |
714 | 519 lda P$PID,x Get our parents process # |
1505 | 520 IFGT Level-1 |
714 | 521 puls x Restore X |
1505 | 522 ENDC |
714 | 523 beq L02A3 If parent's process # is 0 (system), skip back |
524 clrb S$Kill signal code | |
525 os9 F$Send Send it to parent | |
526 lbcs L0191 If error sending signal, go to error routine | |
527 L02FC clrb No error | |
528 stb <u0013 Clear 'kill parent' flag | |
529 rts | |
530 | |
531 * Command list | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
532 CmdList fdb L0B87-* |
714 | 533 fcs '*' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
534 fdb CmdW-* |
714 | 535 fcs 'W' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
536 fdb CmdCHD-* |
714 | 537 fcs 'CHD' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
538 fdb CmdCHX-* |
714 | 539 fcs 'CHX' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
540 fdb CmdCLS-* |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
541 fcs 'CLS' |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
542 fdb CmdCHD-* |
714 | 543 fcs 'CD' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
544 fdb CmdCHX-* |
714 | 545 fcs 'CX' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
546 fdb CmdEX-* |
714 | 547 fcs 'EX' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
548 fdb CmdKill-* |
714 | 549 fcs 'KILL' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
550 fdb CmdX-* |
714 | 551 fcs 'X' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
552 fdb CmdNX-* |
714 | 553 fcs '-X' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
554 fdb CmdPEq-* |
714 | 555 fcs 'P=' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
556 fdb CmdP-* |
714 | 557 fcs 'P' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
558 fdb CmdNP-* |
714 | 559 fcs '-P' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
560 fdb CmdT-* |
714 | 561 fcs 'T' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
562 fdb CmdNT-* |
714 | 563 fcs '-T' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
564 fdb CmdSETPR-* |
714 | 565 fcs 'SETPR' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
566 fdb CmdIEq-* |
714 | 567 fcs 'I=' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
568 fdb CmdREq-* |
714 | 569 fcs 'R=' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
570 fdb CmdZEq-* |
714 | 571 fcs 'Z=' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
572 fdb CmdSEMI-* |
714 | 573 fcs ';' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
574 fdb CmdPWD-* |
714 | 575 fcs '.PWD' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
576 fdb CmdPXD-* |
714 | 577 fcs '.PXD' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
578 fdb CmdMEq-* |
714 | 579 fcs 'M=' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
580 fdb CmdVAR-* |
714 | 581 fcs 'VAR.' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
582 fdb CmdV-* |
714 | 583 fcs 'V' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
584 fdb CmdNV-* |
714 | 585 fcs '-V' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
586 fdb CmdPATHEq-* |
714 | 587 fcs 'PATH=' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
588 fdb CmdPAUSE-* |
714 | 589 fcs 'PAUSE' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
590 fdb CmdINC-* |
714 | 591 fcs 'INC.' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
592 fdb CmdDEC-* |
714 | 593 fcs 'DEC.' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
594 fdb CmdIF-* |
714 | 595 fcs 'IF' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
596 fdb CmdTHEN-* |
714 | 597 fcs 'THEN' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
598 fdb CmdELSE-* |
714 | 599 fcs 'ELSE' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
600 fdb CmdTHEN-* |
714 | 601 fcs 'FI' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
602 fdb CmdTHEN-* |
714 | 603 fcs 'ENDIF' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
604 fdb CmdCLRIF-* |
714 | 605 fcs 'CLRIF' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
606 fdb CmdGOTO-* |
714 | 607 L03AC fcs 'GOTO' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
608 fdb CmdONERR-* |
714 | 609 fcs 'ONERR' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
610 fdb CmdL-* |
714 | 611 fcs 'L' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
612 fdb CmdNL-* |
714 | 613 fcs '-L' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
614 fdb CmdSTARTUP-* |
714 | 615 fcs 'S.T.A.R.T.U.P' |
616 fdb $0000 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
617 L03CF fdb CmdPIPE-* |
714 | 618 fcs '!' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
619 fdb CmdPIPE-* |
714 | 620 fcs '|' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
621 fdb CmdSEMIC-* |
714 | 622 fcs ';' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
623 fdb CmdAmp-* |
714 | 624 fcs '&' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
625 fdb CmdCR-* |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
626 fcb $80+C$CR |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
627 L03DE fdb CmdIOE-* |
714 | 628 fcs '<>>>' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
629 fdb CmdIE-* |
714 | 630 fcs '<>>' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
631 fdb CmdIO-* |
714 | 632 fcs '<>' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
633 fdb CmdOE-* |
714 | 634 fcs '>>>' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
635 fdb CmdErr-* |
714 | 636 fcs '>>' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
637 fdb CmdIn-* |
714 | 638 fcs '<' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
639 fdb CmdOut-* |
714 | 640 fcs '>' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
641 fdb CmdMem-* |
714 | 642 fcs '#' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
643 fdb CmdCaret-* |
714 | 644 fcs '^' |
645 fdb $0000 End of table marker | |
646 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
647 L0404 fcb C$CR |
714 | 648 fcc '()' |
649 fcb $ff | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
650 L0408 fcb C$CR |
714 | 651 fcc '!#&;<>^|' |
652 fcb $ff | |
653 | |
654 * Subroutine: Clears B bytes of memory to NUL's starting @ U | |
655 L0412 pshs u Clear memory | |
656 L0414 clr ,u+ | |
657 decb | |
658 L0417 bne L0414 | |
659 L0419 puls pc,u | |
660 | |
661 * Pre-Parse parameters passed to this shell. Will copy from parm area to | |
662 * buffer area at u0166D, checking for raw mode access allowability if needed | |
663 * Will also | |
664 * Entry: X=ptr to parm area | |
665 L041B ldb #$18 # of bytes to clear in DP | |
666 L041D bsr L0412 Go clear from <u0000 to <u0018 (immortal off) | |
667 tst <u006C ??? (If shell is initing, it's 0) | |
668 lbeq L04CE Shell just initializing, skip ahead | |
669 leay >u17FC,u Point to end of buffer marker | |
670 pshs y Save ptr on stack | |
671 leay >u166D,u Point to buffer for process descriptor | |
672 L042F bsr L0486 Copy next char (check for '@', possibly eat) | |
673 cmpa #C$CR CR? | |
674 beq L04A8 Yes, force CR into ,y & process line from start | |
675 cmpy ,s At end of buffer? | |
676 beq L04A8 Yes, force CR, process line from start | |
677 tst <u001F Variable expansion on? | |
678 bne L042F No, check next char | |
679 cmpa #'% Is it a '%' (shell variable)? | |
680 bne L042F No, do next character | |
681 leay -1,y Back up destination ptr to where '%' is | |
682 pshs x Save current position in parms | |
683 lda ,x Get 1st char of shell variable nam | |
684 cmpa #'* Shell variable for last error code received? | |
685 beq L049D Yes,replace shell var with contents of shell var | |
686 leax >u05A8,u Point to user shell variable contents table | |
687 cmpa #'% 2nd '%'= shellsub variable | |
688 bne L0460 No, just user, go process | |
689 puls x Get back parm ptr | |
690 leax 1,x Skip over 2nd '%' | |
691 lda ,x Get shellsub variable # | |
692 pshs x Save parm ptr | |
693 leax >u08D2,u Point to shellsub variable contents table | |
694 * Entry: A=ASCII 0-9 for either shell or shellsub variable # | |
695 L0460 cmpa #'9 ASCII numeric? | |
696 bhi L0470 No, skip ahead | |
697 cmpa #'0 | |
698 blo L0470 | |
699 suba #$30 Yes, bump down to binary equivalent | |
700 ldb #81 Point to proper variable entry within var table | |
701 mul | |
702 leax d,x | |
703 incb ??? Used in TSTB below | |
704 L0470 bsr L0486 Copy char from var table to pre-parse buffer | |
705 cmpy 2,s Hit end of pre-parse buffer? | |
706 beq L04A6 Yes, force CR at end of it, do full parse | |
707 cmpa #C$CR End of variable? | |
708 bne L0470 No, keep copying characters | |
709 leay -1,y Knock ptr back one (to where CR is) | |
710 puls x Get current parm ptr back | |
711 tstb ??? flag to skip a byte in parm or not | |
712 beq L042F Don't skip | |
713 L0482 leax 1,x Skip to next byte in parm line | |
714 bra L042F Continue pre-parse | |
715 | |
716 * Copy char from parm area to command line buffer - if '@', eat if user is | |
717 * not super-user (#0) | |
718 * Entry: X=ptr to current pos. in original parm buffer | |
719 * Y=ptr to current pos. in new, pre-parsed buffer | |
720 L0486 lda ,x+ Get char from parms | |
721 cmpa #'@ Raw mode request? | |
722 bne L049A Skip ahead if not (SHOULD BE BNE) | |
723 L048C pshs y,a Preserve regs | |
724 os9 F$ID Get user ID # | |
725 cmpy #$0000 Is it 0 (superuser)? (should be leay ,y) | |
726 puls y,a Restore regs | |
727 beq L049A Yes, allow char thru | |
728 rts Otherwise eat it | |
729 | |
730 L049A sta ,y+ Save char & return | |
731 rts | |
732 | |
733 * Shell variable '%* (for last error code) requested | |
734 * Put contents of shell var. into pre-parsed command line buffer | |
735 L049D puls x Get back parm ptr | |
736 lbsr L168A Put error code into preparse buffer | |
737 leay 3,y Skip over error code space we just added | |
738 bra L0482 Skip over shell varname, continue preparse | |
739 | |
740 L04A6 leas 2,s Eat stack | |
741 L04A8 lda #C$CR Force CR as last char in buffer | |
742 sta ,y | |
743 puls y | |
744 leax >u166D,u Point to start of pre-parse buffer again | |
745 L04B2 bra L04CE Start real parse | |
746 | |
747 L04B4 fcb C$LF | |
748 fcc 'Expanded line too long' | |
749 fcb C$CR | |
750 L04CC fcc '.' | |
751 L04CD fcb C$CR | |
752 | |
753 * Parse command line buffer - already pre-parsed (user 0 RAW mode checks & | |
754 * shell/shellsub variable expansion is already done) | |
755 * Entry: X=Ptr to pre-parsed command line buffer | |
756 L04CE lda ,x Get 1st char from parameter area | |
757 cmpa #'* Is it a comment? | |
758 beq L04DE Yes, skip ahead | |
759 cmpa #': Is it a wildcard on/off? | |
760 bne L04DA No, skip ahead | |
761 leax 1,x Bump ptr past it | |
762 L04DA cmpa #': Is it a wildcard off? | |
763 * FOLLOWING LINE: BEQ means wildcarding default off, BNE = on | |
764 beq L04F0 No, go process wildcarding | |
765 * No wildcard processing | |
766 L04DE leay >u0E6D,u Point Y to expanded buffer | |
767 lbsr L1320 Copy param area to buffer area until 1st CR | |
768 leax >u0E6D,u Point X to expanded (wildcard) buffer | |
769 ldy #$0800 Max. size of expanded buffer (2048 bytes) | |
770 lbra L079B Process line without wildcards | |
771 | |
772 * Wild carding processor | |
773 * Entry: X=ptr to current position in pre-parsed parm line | |
774 * 1st, set up error msg for if buffer gets full | |
775 L04F0 leay >L04B4,pc Point to 'Expanded line too long' | |
776 sty <u004A Save it | |
777 ldy #$0018 Get size of text | |
778 sty <u004C Save it too | |
779 leay >L04CD,pc Point to CR | |
780 sty <u0048 Save ptr | |
781 sts <u0050 Save stack ptr | |
782 leay >u0E6D,u Point to fully expanded buffer (2k max) | |
783 sty <u0056 Save it | |
784 clra | |
785 clrb | |
786 sta <u0012 No current working DIR path | |
787 sta <u004F Flag no pathname in parm area | |
788 std <u0052 Expanded buffer size=0 bytes | |
789 bra L0520 Enter main loop for wildcards | |
790 | |
791 L051D lbsr L06FB Special shell chars handling | |
792 L0520 lbsr L0746 Check for special chars (wildcard or shell) | |
793 bcc L051D Special shell char process | |
794 * Wildcard char found | |
795 pshs x Save current pre-parsed parm ptr | |
796 bsr L0549 Check from that point for '/' or special char | |
797 ldx ,s Get previous parm ptr back | |
798 bcc L0557 No '/' found, open current dir '.' | |
799 * Found '/' (part of path) - keep looking for last '/' for filename (not | |
800 * pathname) portion | |
801 L052D bsr L0549 Check for special char or '/' again | |
802 bcc L0535 No '/', skip ahead | |
803 stx <u0040 Save latest ptr to '/' in parm line found so far | |
804 bra L052D See if any more sub-paths | |
805 | |
806 * Found one or more '/' path dividers in current parm line. | |
807 * Entry: <u0040 - contains the last '/' found | |
808 L0535 inc <u004F Flag that their IS a pathname from parm line | |
809 L0538 ldx <u0040 Get last level of path ptr | |
810 puls y Get original parm ptr | |
811 sty <u0040 Save it | |
812 pshs x Save filename ptr on stack | |
813 lda #C$SPAC Save space over '/' after pathname | |
814 sta -1,x (before filename) | |
815 tfr y,x Move original parm ptr to X | |
816 bra L055E Open dir path | |
817 | |
818 * Parse from current position in pre-parsed parm line until shell special | |
819 * char, or '/' found (path) | |
820 * Entry: X=ptr to current pos in pre-parsed parm line | |
821 * Exit: Carry clear if special shell char found | |
822 * Carry set if '/' found | |
823 * X=ptr to found char+1 | |
824 L0549 clrb | |
825 lda ,x+ Get next char | |
826 lbsr L05D3 See if shell special char | |
827 beq L0556 Yes, return | |
828 cmpa #'/ No, is it a slash (path start)? | |
829 bne L0549 No, Keep checking for / or special char | |
830 comb | |
831 L0556 rts | |
832 | |
833 * No '/' found in parm line at all | |
834 L0557 clr <u004F Flag no pathname from parm line | |
835 leax >L04CC,pc Point to '.' | |
836 * Entry: X=ptr to pathname to directory | |
837 * 0-1,s = Ptr to filename spec we are looking for in this directory | |
838 L055E lda #DIR.+READ. Open directory in READ mode | |
839 os9 I$Open | |
840 lbcs L0776 Error, skip ahead | |
841 sta <u0012 Save current DIR path | |
842 puls x Get back ptr to filename (not pathname) | |
843 lbsr L0746 Check for special shell char or wildcard | |
844 lbcc L06E3 Special shell char found, ?????? | |
845 L0572 lda ,x+ Get next char from filename | |
846 cmpa #C$CR End of user specified filename (CR)? | |
847 lbeq L0789 Yes, close DIR and proceed | |
848 cmpa #', Comma? | |
849 beq L0572 Yes, skip it | |
850 cmpa #C$SPAC Space? | |
851 beq L0572 Yes, skip it | |
852 leax -1,x Other char, point to it. | |
853 stx <u0054 Save ptr to it | |
854 lda <u0012 Get DIR path # | |
855 pshs u Preserve u | |
856 ldx #$0000 Skip '.' and '..' dir entries | |
857 ldu #$0040 | |
858 os9 I$Seek | |
859 lbcs L0776 Error, skip ahead | |
860 puls u Restore u | |
861 L0599 leax >u0C9D,u Point to dir entry buffer | |
862 pshs x Save ptr | |
863 lda <u0012 Get Current dir path # | |
864 ldy #$0020 Read 1 file entry | |
865 os9 I$Read | |
866 lbcs L06BD Error, skip ahead | |
867 puls y Restore pointer to dir filename buffer | |
868 lda ,y Get 1st char of entry | |
869 tsta Is it a deleted file? | |
870 beq L0599 Yes, skip it | |
871 ldx <u0054 Get ptr to current char in expanded filename bfr | |
872 bsr L05EF Check wildcard spec against this filename | |
873 bcs L0599 No match, skip to next file in DIR | |
874 tst <u004F Was a pathname specified? | |
875 beq L05CA No, skip ahead | |
876 ldx <u0040 Yes,get ptr to end of pathname/start of filename | |
877 lbsr L06FB Check for wildcard stuff there | |
878 ldx <u0056 Get current pos in expanded buffer | |
879 lda #'/ Save '/' there (to separate path & filename) | |
880 sta -1,x | |
881 L05CA leax >u0C9D,u Point to start of matched DIR entry filename | |
882 lbsr L06FB Copy filename over, handling quoted chars, etc. | |
883 bra L0599 On to next DIR entry | |
884 | |
885 * Check if shell 'special' char. (except wildcards & shell var) | |
886 * non-wildcard char in current byte of pre-parsed parm buffer | |
887 * Entry: X=ptr to next char in parms buffer | |
888 * A=current char in parms buffer | |
889 * Exit: BEQ if shell special char found, BNE if just regular char | |
890 * A=char we were checking | |
891 L05D3 pshs x Save parms buffer ptr | |
892 cmpa #'( Group start char? | |
893 beq L05ED Yes, skip ahead | |
894 cmpa #') Group end char? | |
895 beq L05ED Yes, skip ahead | |
896 cmpa #C$SPAC Space? | |
897 beq L05ED Yes, skip ahead | |
898 cmpa #', Comma? | |
899 beq L05ED Yes, skip ahead | |
900 leax >L0408,pc Table of other special chars | |
901 L05E9 cmpa ,x+ Found match or end of table? | |
902 bhi L05E9 No, keep checking (or fall through if not found) | |
903 L05ED puls pc,x Exit with BEQ/BNE flag set | |
904 | |
905 * IF wildcards were detected in preparsing, filename compares happen here | |
906 * Entry: X=ptr to current char in user's pre-parse parm line | |
907 * Y=ptr to start of current DIR entry filename | |
908 * Exit: Carry set if no match | |
909 * Carry clear if match | |
910 L05EF ldd ,x+ Get 2 chars (NOTE: PTR UP BY ONLY 1!) | |
911 L05F1 cmpa #'* 1st char a * (multi-char wildcard)? | |
912 beq L064C Yes, go handle it | |
913 cmpa #'? Question mark (single char wildcard)? | |
914 beq L0638 Yes, go handle it | |
915 cmpa #'[ Start of ranged wildcard? | |
916 lbeq L068B Yes, go handle it | |
917 bsr L05D3 Not wildcard, check for special shell chars | |
918 beq L062B It is a special shell char, skip ahead | |
919 bsr L0631 Just regular char, force uppercase | |
920 pshs a Save char | |
921 bsr L062D Force uppercase on DIR filename char | |
922 eora ,s+ Same char as last parm char? | |
923 bne L062B No, exit with carry set | |
924 L060D lda ,y+ Re-get char from DIR filename | |
925 bpl L05EF Not on last char yet, check next char from parm | |
926 ldd ,x At end of DIR filename, grab 2 chars from parm | |
927 bsr L05D3 Check 1st char against special shell chars | |
928 beq L0621 Found one, skip ahead | |
929 cmpa #'* Multi-char wildcard char? | |
930 bne L062B No, no match, exit with carry set | |
931 tfr b,a 1st char from parm is '*', check 2nd char for | |
932 bsr L05D3 special shell chars | |
933 bne L062B None found, no match, exit with carry set | |
934 L0621 lda -1,y Special char, get last char from DIR filename | |
935 L0623 anda #$7F Strip 'end of filename' bit flag | |
936 ldb #C$SPAC Space char | |
937 std -1,y Save 'fixed' last char & space | |
938 clrb Flag match | |
939 rts | |
940 | |
941 L062B comb Flag no match | |
942 rts | |
943 | |
944 * Force char to uppercase | |
945 L062D lda ,y Get char | |
946 anda #$7F Strip hi-bit | |
947 L0631 cmpa #'A Need to force uppercase? | |
948 blo L0637 No, exit | |
949 anda #$DF Yes, force to uppercase | |
950 L0637 rts | |
951 | |
952 * '?' single char wildcard found | |
953 L0638 cmpb #'* Is next char a multi-char wildcard? | |
954 beq L060D Yes, process as if just '*' | |
955 cmpb #', 2nd char '-' or greater? | |
956 bhi L060D Yes, process normally | |
957 lda ,y+ Get next char from DIR filename | |
958 bpl L062B Not end of filename, Flag no match | |
959 bra L0623 Save hibit stripped char & space, flag match | |
960 | |
961 L0646 lda ,y+ Get next char from DIR filename | |
962 bpl L0646 Hunt for end of DIR filename | |
963 bra L0623 Found it, fix hibit and add space to DIR entry | |
964 | |
965 * '*' multi-char wildcard found | |
966 L064C lda ,x+ Get next char after '*' from parm buffer | |
967 bsr L05D3 Check for shell special char | |
968 beq L0646 Found one, check if end of DIR filename | |
969 cmpa #'? Single char wildcard next? | |
970 beq L067F Yes, Process | |
971 cmpa #'[ Start of Ranged wildcard next? | |
972 beq L067F Yes, process | |
973 bsr L0631 Force char to uppercase | |
974 pshs a Save it | |
975 L065E bsr L062D Get next char from DIR filename, force uppercase | |
976 eora ,s+ Same char? | |
977 beq L066E Yes, possible resync after '*' | |
978 L0664 leas -1,s Make room on stack | |
979 lda ,y+ Re-get un-modified char from DIR filename | |
980 bpl L065E Not end of filename, try next char | |
981 leas 1,s Found end of filename, eat temp stack | |
982 bra L062B Flag no match | |
983 * Above loop @ L0664/L065E uses sneaky stack stuff | |
984 | |
985 * Found possible resync char match after '*' | |
986 L066E leas -1,s Make room on stack | |
987 pshs y,x Preserve both DIR & parm ptrs | |
988 bsr L060D Attempt normal matching using this resync | |
989 puls y,x Restore ptrs | |
990 leas 1,s Eat temp stack | |
991 bcs L0664 No, resync did not work, look for next resync | |
992 rts worked, exit with carry clear | |
993 | |
994 L067B lda ,y+ Get next char in DIR | |
995 bmi L062B Last char, flag no match | |
996 * '?' found after '*' in parm buffer | |
997 L067F pshs y,x Preserve both DIR and parm buffer ptrs | |
998 ldd -1,x Get previous & current parm chars | |
999 lbsr L05F1 Do normal sub-parsing from here | |
1000 puls y,x Restore ptrs | |
1001 bcs L067B No match, go to next char in DIR and attemp resync | |
1002 rts Matched, exit with match | |
1003 | |
1004 * Ranged wildcard here | |
1005 * Entry: X=ptr to 1st char in parm buffer AFTER '[' | |
1006 L068B ldd ,x+ Get 1st 2 chars of range sub-string from parm bfr | |
1007 bsr L0631 Force uppercase on 1st char | |
1008 exg b,a Force uppercase on 2nd char | |
1009 bsr L0631 | |
1010 exg b,a | |
1011 cmpa #'] Is 1st char a close range check char? | |
1012 beq L062B Yes, flag no match for '[]' | |
1013 cmpa #'- Range separator char? | |
1014 beq L06A7 Yes, need to get end of range | |
1015 * Special case for [x] - acts as if just normal char (no range or wildcard) | |
1016 sta <u00EF No, save start of range char | |
1017 bsr L062D Get char from DIR filename, force uppercase | |
1018 eora <u00EF Match only range char? | |
1019 beq L06B4 Yes, skip to next char now | |
1020 * Special case for [xyz] - one of these chars must match | |
1021 bra L068B No, see if more single chars to try matching | |
1022 | |
1023 * Actual range - need to get end of range char | |
1024 * Entry: B=high char of range | |
1025 * <u00EF - current char (within range) we are checking against | |
1026 L06A7 inc <u00EF Bump up start char's ascii value | |
1027 cmpb <u00EF Hit end of range yet? | |
1028 beq L068B Yes, try next char | |
1029 lbsr L062D Force char in A to uppercase | |
1030 eora <u00EF equal to current range check char? | |
1031 bne L06A7 No, try next char in range | |
1032 L06B4 ldd ,x+ Get next 2 chars from pathname | |
1033 cmpa #'] End of range? | |
1034 bne L06B4 No, check next char | |
1035 lbra L060D End of range specifier, process normally | |
1036 | |
1037 * Error reading from current DIR | |
1038 L06BD cmpb #E$EOF End of file error? | |
1039 lbne L0776 No, fatal error, leave | |
1040 ldx <u0054 Get ptr to current char in wildcard filename | |
1041 lda -1,x Get last char processed | |
1042 bsr L0714 Add it to new expanded buffer | |
1043 L06C9 lda ,x+ Get next char, inc ptr | |
1044 stx <u0054 Save updated pointer | |
1045 cmpa #C$CR CR? | |
1046 lbeq L0789 Yes, append CR to expanded buffer, we are done | |
1047 lbsr L05D3 See if special shell char | |
1048 bne L06C9 Just regular char, go to next one | |
1049 pshs x Save current ptr to wildcard filename | |
1050 ldx <u0056 Get current ptr in expanded buffer | |
1051 sta -1,x Save that char overtop last char written | |
1052 puls x Get wildcard ptr back | |
1053 bra L06EA Close dir path, go back into loop | |
1054 | |
1055 * If special shell char found right after OPEN of DIR path | |
1056 * Entry: X=ptr to filename (not pathname) - but with special char | |
1057 L06E3 bsr L06FB Process special shell char copying | |
1058 bsr L072F Close DIR path | |
1059 lbra L051D More processing | |
1060 | |
1061 L06EA bsr L072F Close DIR path | |
1062 lbra L0520 Go back to main wildcard processing loop | |
1063 | |
1064 * This chunk (6EF-6F9) is for copying '\x' when x is NOT a wildcard char | |
1065 L06EF lda ,x+ Get quoted char | |
1066 bsr L0739 Check if it is [, * or ? | |
1067 beq L06F9 Yes, add that char to expanded buffer by itself | |
1068 leax -2,x No, bump ptr back to '\' | |
1069 lda ,x+ Get '\' char | |
1070 L06F9 bsr L0714 Append that to output buffer | |
1071 * Special shell chars found goes here | |
1072 * This part copies filename from [,x] to expanded buffer, handling quoted | |
1073 * wildcard chars, and ending on CR or special shell char | |
1074 L06FB lda ,x+ Get char | |
1075 cmpa #'\ Backslash (for quoted char)? | |
1076 beq L06EF Yes, go get quoted char | |
1077 cmpa #C$CR Is it the end of the filename? | |
1078 beq L0789 Yes, append CR to expanded line, we are done | |
1079 bsr L073D Is it '?' or '*' | |
1080 beq L0714 Yes, add that char to expanded buffer | |
1081 lbsr L05D3 Check if shell special char | |
1082 beq L0714 Yes, add to expanded buffer, return from there | |
1083 bsr L0714 No, add to expanded buffer, stay in this loop | |
1084 bra L06FB | |
1085 | |
1086 * Add char to expanded line buffer | |
1087 * Entry: A=char to append to expanded line buffer | |
1088 * <u0056=Current position in expanded line buffer | |
1089 * <u0052=Current size of expanded line buffer | |
1090 * Exit: <u0056 & <u0052 updated | |
1091 L0714 pshs x,a Preserve regs | |
1092 ldx <u0056 Get current pos in expanded buffer | |
1093 sta ,x+ Save char | |
1094 stx <u0056 Save updated expanded buffer ptr | |
1095 ldd <u0052 Get expanded buffer size | |
1096 addd #$0001 Increase by 1 | |
1097 cmpd #2048 Is it full yet? | |
1098 bhi L0773 Yes, exit with expanded line too long error | |
1099 std <u0052 No, save new size | |
1100 puls pc,x,a Restore regs & return | |
1101 | |
1102 * Close DIR path | |
1103 L072F lda <u0012 Get DIR path # | |
1104 beq L0738 If none, exit | |
1105 os9 I$Close Close the path | |
1106 clr <u0012 Clear DIR path # to none | |
1107 L0738 rts | |
1108 | |
1109 * Wildcard checks | |
1110 * Entry: A=char to check | |
1111 * Exit: BEQ if any of the 3 wildcard chars, or BNE if not | |
1112 L0739 cmpa #'[ Range wildcard? | |
1113 beq L0745 | |
1114 L073D cmpa #'? Single char wildcard? | |
1115 beq L0745 | |
1116 cmpa #'* Multi-char wildcard? | |
1117 beq L0745 | |
1118 L0745 rts | |
1119 | |
1120 * Parse for next wildcard or special shell char in pre-parsed parm line | |
1121 * Entry: X=current pos in pre-parse parm line | |
1122 * Exit: X=Same as entry | |
1123 * IF WILDCARD CHAR FOUND: | |
1124 * B=# chars to next wildcard/special char | |
1125 * A=special char found | |
1126 * Carry bit set | |
1127 * IF SPECIAL SHELL CHAR FOUND | |
1128 * B=0 | |
1129 * Carry bit clear | |
1130 * A=special char found: CR ( ) , space ! # & ; < > ^ | | |
1131 L0746 pshs x Save current parm ptr | |
1132 bra L0752 Parse for wildcard or special shell chars | |
1133 | |
1134 L074A lda ,x+ Get char from parms | |
1135 bsr L0739 Do wildcard char check | |
1136 beq L0752 If wildcard char, skip over it & continue | |
1137 leax -1,x not wildcard char, bump back to char after \ | |
1138 L0752 lda ,x+ Get char from parms | |
1139 cmpa #'\ Wildcard quote char (do not expand next)? | |
1140 beq L074A Yes, handle it | |
1141 lbsr L05D3 No, check for other special shell chars | |
1142 beq L0770 Found one, skip ahead | |
1143 bsr L0739 Check for wildcard char | |
1144 bne L0752 None, skip to next char | |
1145 * One of the 3 wildcard chars found, process | |
1146 pshs a Save char | |
1147 tfr x,d Move parm ptr to D | |
1148 subd 1,s Calc distance since last wildcard/special char | |
1149 subd #$0001 -1 | |
1150 puls a B=distance between wild/special chars | |
1151 orcc #Carry Set Carry Flag | |
1152 puls pc,x Exit with original parm ptr in X | |
1153 | |
1154 * Exit with B=0, Carry clear and A=special char found (which ends current | |
1155 * 'chunk' being checked... can included CR) | |
1156 L0770 clrb Clear carry, exit | |
1157 puls pc,x | |
1158 | |
1159 * Expanded buffer full error | |
1160 L0773 comb | |
1161 ldb #E$BufSiz | |
1162 L0776 pshs b,cc Preserve error code | |
1163 bsr L072F Close DIR path (if we had one) | |
1164 ldx <u004A Print text message (usually error msg) | |
1165 ldy <u004C | |
1166 lda #$02 | |
1167 os9 I$WritLn | |
1168 puls b,cc | |
1169 lbra L0191 Exit with error | |
1170 | |
1171 L0789 lda #C$CR Append CR to expanded filenames buffer | |
1172 bsr L0714 | |
1173 ldy <u0052 Get expanded buffer size | |
1174 leax >u0E6D,u Point to start of expanded buffer | |
1175 bsr L072F Close DIR path | |
1176 lds <u0050 Get back original stack ptr | |
1177 * At this point, expanded buffer is complete and ready to go (either through | |
1178 * wildcard routine, or by simply copying the original parm buffer from user) | |
1179 | |
1180 * Main entry point for non-wildcard filename search/match | |
1181 * Entry: X=Ptr to start of expanded buffer | |
1182 L079B tst <u001E Echo required? | |
1183 beq L07A2 No, skip ahead | |
1184 lbsr L021F Print out user entered parm line to std err | |
1185 L07A2 tst <u0043 2=FALSE,0=TRUE, 1=??? (check current IF status, | |
1186 beq L07B0 if any. If TRUE flag set, skip ahead) | |
1187 lbsr L0F69 Do checks for IF type statements | |
1188 tsta Find match? | |
1189 lbpl L0F1D Yes, process IF type statement | |
1190 L07AE clrb No error & return | |
1191 rts | |
1192 | |
1193 * If current IF type statement has result TRUE | |
1194 L07B0 tst <u0045 ??? (Are we looking for a label for GOTO?) | |
1195 beq L07E3 No, skip ahead | |
1196 lda ,x+ Get char from buffer | |
1197 cmpa #'* Comment line? | |
1198 bne L07AE No, exit without error | |
1199 lbsr L091F Yes, get ptr to first non-space char into X | |
1200 leay >u0124,u Point to temp buffer | |
1201 lbsr L100B Copy label from X to Y | |
1202 lda ,x Get 1st char of label | |
1203 cmpa #'\ '*\'? (Which means cancel impending GOTO) | |
1204 beq L07DB Yes, cancel GOTO | |
1205 leax >u0BFC,u No, point to 80 byte buffer (GOTO label holder?) | |
1206 clra default char to check against=NUL | |
1207 L07CF cmpa #C$CR End of label? | |
1208 beq L07DB Yes, cancel GOTO search | |
1209 lda ,x+ Get next char from buffer | |
1210 cmpa ,y+ Is it the label we are looking for? | |
1211 beq L07CF Keep checking till done | |
1212 bra L07AE No match, clear carry & return | |
1213 | |
1214 * Cancelling GOTO search | |
1215 L07DB clr <u0045 Flag we are NOT looking for label for GOTO | |
1216 clrb | |
1217 leas 2,s Eat stack | |
1218 lbra L010D Reprint shell prompt, process from scratch | |
1219 | |
1220 L07E3 bsr L07E7 | |
1221 bra L083A | |
1222 | |
1223 L07E7 pshs x | |
1224 tst <u006C | |
1225 beq L0832 | |
1226 tst <u005C | |
1227 bne L07F5 | |
1228 tst <u001C | |
1229 beq L0832 | |
1230 L07F5 lda ,x | |
1231 cmpa #'* | |
1232 beq L0832 | |
1505 | 1233 IFGT Level-1 |
714 | 1234 ldy #$0000 Force temporarily to super-user |
1235 os9 F$SUser | |
1505 | 1236 ENDC |
714 | 1237 leax >u0CBD,u |
1238 ldd #$0203 | |
1239 lbsr L0C79 | |
1240 bcs L0832 | |
1241 lbsr L00FB | |
1242 lda #$20 | |
1243 sta <$11,x | |
1244 ldy #$0012 | |
1245 lda <u0012 | |
1246 os9 I$Write | |
1247 bcs L082D | |
1248 ldx ,s | |
1249 ldy #$0800 | |
1250 lda <u0012 | |
1251 os9 I$WritLn | |
1252 L082D lda <u0012 | |
1253 os9 I$Close | |
1505 | 1254 L0832 |
1255 IFGT Level-1 | |
1256 ldy <u005A Get original user # back | |
714 | 1257 os9 F$SUser Change user # to original |
1505 | 1258 ENDC |
714 | 1259 puls pc,x |
1260 | |
1261 * Parse input line | |
1262 * Entry : X=Ptr to current char in line buffer | |
1263 L083A clra | |
1264 sta <u0022 Flag we don't change priority for forked process | |
1265 sta <u0003 Clear out # pages of data mem for forked process | |
1266 sta <u000E Clear out signal code | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1267 leay >CmdList,pc Point to main command list |
714 | 1268 lbsr L08D1 Parse keywords from list |
1269 bcs L08A0 Keyword found but generated error, done line | |
1270 cmpa #C$CR Is 1st non-keyword char a carriage return? | |
1271 beq L08A0 Yes, done line | |
1272 sta <u000C Save non-keyword char | |
1273 cmpa #'( Is it a 'start command group' char? | |
1274 bne L087B No, try next | |
1275 leay >L000D,pc Point to 'Shell' | |
1276 sty <u0004 Save pointer to program to fork? | |
1277 leax 1,x Bump ptr past '(' | |
1278 stx <u0008 Save updated ptr | |
1279 L0860 inc <u000D Bump up # of command groups | |
1280 L0862 leay >L0404,pc Point to command group symbols to parse | |
1281 lbsr L08E9 Hunt down EOL, or '(' or ')' (skip quoted text) | |
1282 cmpa #'( Another group start? | |
1283 beq L0860 Yes, bump up # of command groups & continue | |
1284 cmpa #') Group end? | |
1285 bne L0898 No, skip ahead (to print WHAT?) | |
1286 dec <u000D Bump down # of command groups | |
1287 bne L0862 Still more groups, continue parsing for them | |
1288 lda #C$CR Append CR at end of command line | |
1289 sta -1,x | |
1290 bra L087F Check for modifiers | |
1291 | |
1292 L087B bsr L08A3 Check for valid path, do '<>', '#', '^' if needed | |
1293 bcs L08A0 No valid path found, skip ahead | |
1294 * Found valid pathname | |
1295 L087F leay >L0408,pc Point to modifiers table | |
1296 bsr L08E9 Go parse for them | |
1297 tfr x,d Move ')' ptr to D for SUB | |
1298 subd <u0008 Calculate size from 1st '(' to ')' | |
1299 std <u0006 Save size of group (could also be pathname-modifier) | |
1300 leax -1,x | |
1301 leay >L03CF,pc Point to modifier branch table | |
1302 bsr L08D1 Go execute modifier routine | |
1303 bcs L08A0 If error in modifier routine, exit | |
1304 ldy <u0004 Get ptr to first char we started at | |
1305 L0898 lbne L0BCF Not proper, print 'WHAT?' | |
1306 cmpa #C$CR Last char a carriage return? | |
1307 bne L083A No, start parsing again at current position | |
1308 L08A0 lbra L0B96 Done processing line, continue | |
1309 | |
1310 * Entry: X=Ptr to text to check for valid device name (including '.' & '..') | |
1311 * Exit: Carry set if not a valid device name | |
1312 * Carry clear if there was | |
1313 * <u0004 = Ptr to first char where we started at | |
1314 * <u0008 = Ptr to end of redirection/mem size/priority setting chars (if found) | |
1315 L08A3 stx <u0004 Save ptr to current char in input line | |
1316 bsr L08B6 Check for valid device name | |
1317 bcs L08B5 None found, return | |
1318 * Found valid device name | |
1319 L08A9 bsr L08B6 Eat rest of valid pathlist | |
1320 bcc L08A9 Keep going until we are done pathlist | |
1321 leay >L03DE,pc Point to Command list starting at '<>>>' | |
1322 bsr L08D1 Call any redirection, mem size or priority routines | |
1323 stx <u0008 Save ptr to where we are now (end of current set) | |
1324 L08B5 rts | |
1325 | |
1326 L08B6 os9 F$PrsNam Valid OS9 device name? | |
1327 bcc L08C7 Yes, point X to it & return | |
1328 lda ,x+ Not valid, get first char | |
1329 cmpa #'. Is it a period? | |
1330 bne L08CB No, bad path name | |
1331 cmpa ,x+ Is it a double period? | |
1332 beq L08C9 Yes, leave src ptr pointing to name after '..' | |
1333 leay -1,x If single, bump ptr to name after '.' | |
1334 L08C7 leax ,y Point X to pathname in source | |
1335 L08C9 clra No error & return | |
1336 rts | |
1337 | |
1338 L08CB comb Error flag | |
1339 leax -1,x Bump source ptr back | |
1340 ldb #E$BPNam Bad Path Name error & return | |
1341 rts | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1342 * Entry: Y=ptr to command list (CmdList) |
714 | 1343 L08D1 bsr L0907 Go find 1st non-space char |
1344 pshs y Save command list ptr | |
1345 bsr L092A Parse for keyword or special char | |
1346 bcs L08E2 If no keyword found, skip ahead | |
1347 ldd ,y Keyword found, get offset | |
1348 jsr d,y Go execute routine for command found | |
1349 puls y Restore command list ptr | |
1350 bcc L08D1 No error, continue parsing for keywords | |
1351 rts Subroutine had error, return with it | |
1352 L08E2 clra No error | |
1353 lda ,x Get character (not in command list) | |
1354 puls pc,y Restore command list ptr & return | |
1355 | |
1356 * Start searching at beginning of current command list | |
1357 * For looking for single character modifiers | |
1358 L08E7 puls y | |
1359 L08E9 pshs y Preserve command list ptr | |
1360 lda ,x+ Get next char from command line | |
1361 L08ED tst ,y Check current char in command list | |
1362 bmi L08E7 If done list, start over at beginning | |
1363 cmpa #'" Is it quotes? | |
1364 bne L0901 No, skip ahead | |
1365 L08F5 lda ,x+ Get next char from command line | |
1366 cmpa #C$CR EOL? | |
1367 beq L0905 Yes, exit with A being CR | |
1368 cmpa #'" Is it another set of quotes? | |
1369 bne L08F5 No, keep looking for it (or EOL) | |
1370 lda ,x+ Get char after 2nd quotes | |
1371 L0901 cmpa ,y+ Is it the current command char we are checking? | |
1372 bne L08ED No, try next | |
1373 L0905 puls pc,y Yes, exit with A containing it | |
1374 | |
1375 * Entry: Y=ptr to command list | |
1376 L0907 pshs x Preserve X | |
1377 lda ,x+ Get char from line entered by user | |
1378 cmpa #C$SPAC Is it a space? | |
1379 beq L091D Yes, skip ahead | |
1380 cmpa #', Is it a comma? | |
1381 beq L091D Yes, skip ahead | |
1382 leax >L0408,pc Point to single character modifiers | |
1383 L0917 cmpa ,x+ Found a match? | |
1384 bhi L0917 No, try next until list is done | |
1385 puls pc,x Found it, restore X to point to it & return | |
1386 | |
1387 L091D leas 2,s Eat X off the stack | |
1388 L091F lda #C$SPAC Get space character | |
1389 L0921 cmpa ,x+ Keep searching until non-space char is found | |
1390 beq L0921 | |
1391 leax -1,x Point to 1st non-space char | |
1392 * ; (1st pass) comes here | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1393 CmdSEMI andcc #^Carry No carry & return |
714 | 1394 rts |
1395 * Command line parser | |
1396 L092A pshs y,x Preserve command table ptr & input line ptr | |
1397 leay 2,y Skip first offset | |
1398 L092E ldx ,s Get input line ptr | |
1399 L0930 lda ,x+ Get char from input line | |
1400 lbsr L0F0C Convert char to uppercase if lowercases | |
1401 eora ,y+ Check for a match | |
1402 lsla | |
1403 bne L0951 No match, skip to next keyword in table | |
1404 bcc L0930 Keep checking until end of keyword (high bit set) | |
1405 lda -$01,y Get command table char again | |
1406 cmpa #'|+$80 '|' (with high bit set)? | |
1407 beq L094E Yes, exit with carry clear | |
1408 cmpa #'^+$80 '^' (with high bit set)? | |
1409 beq L094E Yes, exit with carry clear | |
1410 cmpa #'A+$80 Any of the other special modifiers with high bit? | |
1411 blo L094E Yes, exit with carry clear | |
1412 bsr L0907 Eat spaces until first non-space char | |
1413 bcs L0951 If special char (!|#,etc.), skip ahead | |
1414 L094E clra | |
1415 puls pc,y,d | |
1416 | |
1417 L0951 leay -1,y Bump search ptr back | |
1418 L0953 lda ,y+ Get char again | |
1419 bpl L0953 Keep getting them until end of keyword | |
1420 sty 2,s Save ptr to next offset on stack | |
1421 ldd ,y++ Get offset | |
1422 bne L092E If not at end of table, keep searching | |
1423 comb End of table, command not found error | |
1424 puls pc,y,x | |
1425 | |
1426 L0961 fcc 'startup' | |
1427 fcb C$CR | |
1428 | |
1429 * Create child shell to run 'startup' file | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1430 CmdSTARTUP |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1431 pshs u,y,x Preserve regs |
714 | 1432 leax L000D,pc Point to 'shell' (module name) |
1433 leau L0961,pc Point to 'startup' (parameter for 'shell') | |
1434 ldy #$0008 Size of 'startup<CR>' | |
1505 | 1435 IFGT Level-1 |
714 | 1436 ldd #$111F Program+Objct / 7.5K data area |
1505 | 1437 ELSE |
1438 ldd #$1102 Program+Objct / 512 byte data area | |
1439 ENDC | |
714 | 1440 os9 F$Fork Fork a shell to run the startup file |
1441 bcs L0983 Couldn't fork, exit | |
1442 os9 F$Wait Wait until 'startup' is done | |
1443 L0983 puls u,y,x Restore regs | |
1444 clrb No error & return | |
1445 rts | |
1446 | |
1447 * EX command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1448 CmdEX lbsr L08A3 Go check for valid device name (module) |
714 | 1449 bcs L09AB If none, exit |
1450 clra Std in path | |
1451 bsr L09B0 Go close it | |
1452 bsr L09AF Go close Std out | |
1453 bsr L09AF Go close Std Err | |
1454 lbsr L0B87 Go find the end of the input line | |
1455 leax 1,x Bump ptr to 1 past CR | |
1456 tfr x,d Move ptr to D | |
1457 subd <u0008 Calculate size of current command group | |
1458 std <u0006 Save it | |
1459 lbsr L130A Point to module to chain&get its parm size, etc. | |
1460 leas >u00FF,u Point stack to end of DP | |
1461 os9 F$Chain Chain to the new program | |
1462 lbra L01FA Couldn't, go here | |
1463 L09AB clrb No error | |
1464 lbra L020D Close logging file (if any) and exit ShellPlus | |
1465 | |
1466 L09AF inca Inc path # | |
1467 L09B0 pshs a Save path # | |
1468 lbra L0BBC close path if it is open | |
1469 * CHX & CX commands | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1470 CmdCHX clr <u0038 |
714 | 1471 lda #DIR.+EXEC. |
1472 os9 I$ChgDir | |
1473 rts | |
1474 * CHD & CD commands | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1475 CmdCHD lda #DIR.+READ. (bug fix, originally opened in UPDATE) |
714 | 1476 os9 I$ChgDir Change the directory |
1477 bcs L09CE Error, exit with it | |
1478 clr <u0037 Flag .pwd entry as invalid | |
1479 tst <u0042 WAS ,U | |
1480 beq L09CE | |
1481 bsr L0A04 Go update shell expanded prompt if needed | |
1482 L09CE rts | |
1483 * L command - Logging ON | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1484 CmdL lda #$01 |
714 | 1485 bra L09D4 |
1486 * -L command - Logging OFF | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1487 CmdNL clra |
714 | 1488 L09D4 sta <u001C |
1489 rts | |
1490 * P command - Prompting ON | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1491 CmdP clra |
714 | 1492 bra L09DC |
1493 * -P command - Prompting OFF | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1494 CmdNP lda #$01 |
714 | 1495 L09DC sta <u001D |
1496 rts | |
1497 * T command - Echo input ON | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1498 CmdT lda #$01 |
714 | 1499 bra L09E4 |
1500 * -T command - Echo input OFF | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1501 CmdNT clra |
714 | 1502 L09E4 sta <u001E |
1503 rts | |
1504 * V command - Turn variable expansion ON | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1505 CmdV clra |
714 | 1506 bra L09EC |
1507 * -V command - Turn variable expansion OFF | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1508 CmdNV lda #$01 |
714 | 1509 L09EC sta <u001F |
1510 rts | |
1511 * X command - Kill Shell when error occurs ON | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1512 CmdX lda #$01 |
714 | 1513 bra L09F4 |
1514 * -X command - Kill Shell when error occurs OFF | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1515 CmdNX clra |
714 | 1516 L09F4 sta <u0020 |
1517 rts | |
1518 | |
1519 L09F7 tst >u01F4,u Date already done? | |
1520 bne L0A04 Yes, skip ahead | |
1521 tst >u01F5,u Time already done? | |
1522 bne L0A04 Yes, skip ahead | |
1523 rts If neither, we don't need to change prompt? | |
1524 L0A04 pshs y,x Preserve regs | |
1525 bra L0A64 Go update shell expanded prompt if needed | |
1526 | |
1527 * Make shell prompt string the default one | |
1528 L0A08 puls y Restore Y | |
1529 pshs x Preserve X | |
1530 leax >L003D,pc Point to default prompt string | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1531 bsr CmdPEq Put that into working shell prompt string |
714 | 1532 puls pc,x Restore X & return |
1533 | |
1534 * P= (prompt set) command | |
1535 * Make shell prompt string (default or user-specified) | |
1536 * Entry: X=ptr to source of new shell prompt string | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1537 CmdPEq pshs y Preserve Y |
714 | 1538 leay >u01F9,u Point to working prompt text buffer |
1539 ldd #C$LF*256+22 Line feed & max count for prompt string+1 | |
1540 sta ,y+ Save LF as first char | |
1541 bsr L0A25 Go copy prompt string (& parse quotes) | |
1542 bra L0A5E Go see if we need to override with default | |
1543 | |
1544 L0A25 clr >u01F3,u Clear quotes in progress flag | |
1545 L0A29 lda ,x+ Get char from default shell prompt | |
1546 cmpa #'" Is it a quotes? | |
1547 bne L0A3F No, skip ahead | |
1548 leax 1,x Yes, bump ptr up 2 past quotes | |
1549 tst >u01F3,u We processing quotes already? | |
1550 bne L0A59 Yes, we are done then | |
1551 inc >u01F3,u Set processing quotes flag | |
1552 leax -1,x Set ptr back to char just after quotes | |
1553 bra L0A29 Check next char | |
1554 | |
1555 L0A3F cmpa #C$CR Carriage return? | |
1556 beq L0A59 Yes, we are done then | |
1557 cmpa #C$SPAC Space? | |
1558 beq L0A4B Yes, skip ahead | |
1559 cmpa #'; Semi-colon? | |
1560 bne L0A51 No, skip ahead | |
1561 * Semi-colon or space found | |
1562 L0A4B tst >u01F3,u We quoting at the moment? | |
1563 beq L0A59 No, we are done | |
1564 L0A51 tstb Char count down to 0? | |
1565 beq L0A29 Yes, continue parsing (but eating them) | |
1566 decb Dec max char counter | |
1567 sta ,y+ Save literal char into current copy | |
1568 bra L0A29 continue parsing | |
1569 | |
1570 L0A59 clr ,y Append NUL to indicate end of string | |
1571 leax -1,x Bump source ptr back to last char & return | |
1572 rts | |
1573 | |
1574 L0A5E cmpb #22 Did the user do a no-length prompt? | |
1575 beq L0A08 Yes, go override with default prompt | |
1576 pshs x Preserve ptr to last char of source prompt | |
1577 | |
1578 * Create expanded shell prompt from shell prompt string | |
1579 L0A64 leay >u01F9,u Point to shell prompt string | |
1580 leax >u0212,u Point to expanded prompt buffer | |
1581 pshs x Preserve it a moment | |
1582 clr >u01F2,u Output device name done already = OFF | |
1583 clr >u01F1,u Process ID # done already = OFF | |
1584 clr >u01F4,u Date done already = OFF | |
1585 clr >u01F5,u Time done already = OFF | |
1586 clr >u01F6,u Date OR time already done once = OFF | |
1587 clr >u0042,u Current working dir name done already = OFF | |
1588 L0A86 lda ,y+ Get char from shell prompt string | |
1589 lbeq L0B29 If end of string, exit | |
1590 cmpa #'# Process ID # wanted? | |
1591 bne L0AA2 No, try next | |
1592 * Process ID # | |
1593 tst >u01F1,u Done it already? | |
1594 bne L0A86 Yes, skip doing it again | |
1595 inc >u01F1,u No, flag it as being done now | |
1596 ldd >u01EC,u Get process # (01-99) | |
1597 std ,x++ Save in expanded prompt buffer | |
1598 bra L0A86 Continue parsing | |
1599 L0AA2 cmpa #'@ Standard output path device name wanted? | |
1600 beq L0AAA Yes, go do it | |
1601 cmpa #$E0 High bit version? | |
1602 bne L0AC7 No, try next | |
1603 * Standard output path device name | |
1604 L0AAA tst >u01F2,u Done it already? | |
1605 bne L0A86 Yes, skip doing it again | |
1606 ldd #$01*256+SS.DevNm Standard out/get device name | |
1607 os9 I$GetStt Get the device name | |
1608 bcs L0A86 Error, skip doing device name | |
1609 inc >u01F2,u Flag it as being done now | |
1610 L0ABD lda ,x+ Get char from device name | |
1611 bpl L0ABD Keep looking until last char (high bit set) | |
1612 anda #$7F Mask out high bit | |
1613 sta -1,x Save the normal char | |
1614 bra L0A86 Continue parsing | |
1615 L0AC7 cmpa #'$ Current working directory wanted? | |
1616 bne L0AF2 No, check next | |
1617 * Current working directory | |
1618 tst <u0042 Done it already? (WAS ,U) | |
1619 bne L0A86 Yes, skip doing it again | |
1620 inc <u0042 Flag it as being done now (WAS ,U) | |
1621 lda #$01 | |
1622 sta <u003D | |
1623 lbsr L176D Go figure out current working directory | |
1624 tstb | |
1625 bne L0AF2 | |
1626 pshs y Save prompt string ptr | |
1627 ldy <u002A Get pointer to current working directory | |
1628 * Copy string: Y=source string ptr, X=prompt buffer ptr | |
1629 L0AE4 lda ,y+ Get char | |
1630 sta ,x+ Save as part of shell prompt text | |
1631 cmpa #C$CR Was it the end? | |
1632 bne L0AE4 No, keep copying | |
1633 leax -1,x Bump ptr back CR | |
1634 puls y Restore source string ptr | |
1635 bra L0A86 Continue parsing | |
1636 | |
1637 L0AF2 cmpa #'( Current Date wanted? | |
1638 bne L0B0A No, check next | |
1639 * Current date | |
1640 tst >u01F4,u Done it already? | |
1641 bne L0A86 Yes, skip doing it again | |
1642 inc >u01F4,u Flag as being done now | |
1643 bsr L0B3B Go get date & time | |
1644 pshs y Save shell prompt string ptr | |
1645 leay >u02E0,u Point to date text | |
1646 bra L0AE4 Copy into expanded prompt | |
1647 L0B0A cmpa #') Current Time wanted? | |
1648 bne L0B24 No, just store the raw ASCII char | |
1649 * Current time | |
1650 tst >u01F5,u Done Time already? | |
1651 lbne L0A86 Yes, skip doing it again | |
1652 inc >u01F5,u Flag as being done now | |
1653 bsr L0B3B Go get date & time | |
1654 pshs y Save shell prompt string ptr | |
1655 leay >u02E9,u Point to time text | |
1656 bra L0AE4 Copy into expanded prompt | |
1657 | |
1658 L0B24 sta ,x+ Save raw character | |
1659 lbra L0A86 Continue parsing | |
1660 | |
1661 L0B29 sta ,x Save NUL to mark end of prompt | |
1662 tfr x,d Move End of prompt ptr to D for subtract | |
1663 subd ,s++ Subtract start of prompt ptr | |
1664 std >u01F7,u Save size of expanded shell prompt | |
1665 puls pc,y,x Restore regs & return | |
1666 | |
1667 * Separator table for date & time strings | |
1668 L0B35 fcc '//' | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1669 fcb C$CR |
714 | 1670 fcc '::' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1671 fcb C$CR |
714 | 1672 |
1673 * Get current date (2E0-2E8) & time (2E9-2EF) | |
1674 L0B3B pshs y,x Preserve shell prompt string & shell prompt ptrs | |
1675 tst >u01F6,u Have we already been here before? | |
1676 bne L0B75 Yes, both date & time strings already done | |
1677 inc >u01F6,u Flag we have been here now | |
1678 leax >u02DA,u Point to date/time packet buffer | |
1679 os9 F$Time Get the date/time packet | |
1680 leay >u02E0,u Point to where date string goes | |
1681 clrb Offset into separator table to first '/' | |
1682 L0B54 lda ,x+ Get byte from time packet | |
1683 bsr L0B77 Convert to ASCII | |
1684 pshs b Preserve offset into separator table | |
1685 ldd >u01EF,u Get ASCII version of byte | |
1686 std ,y++ Save into date/string buffers | |
1687 puls b Restore offset into separator table | |
1688 pshs y Preserve date/string buffer ptr | |
1689 leay >L0B35,pc Point to separator's table | |
1690 lda b,y Get current separator | |
1691 puls y Restore date/string buffer ptr | |
1692 sta ,y+ Save separator into date/string buffer | |
1693 incb Point to next separator | |
1694 cmpb #6 On last one? | |
1695 bne L0B54 No, continue converting | |
1696 L0B75 puls pc,y,x Restore prompt & buffer ptrs & return | |
1697 | |
1698 L0B77 pshs y,x,d Preserve regs | |
1699 leay >L0B80,pc Point to routine to copy ASCII digits | |
1700 lbra L16B9 Go convert byte to ASCII equivalent | |
1701 | |
1702 L0B80 ldd $04,s Copy 2 digit ASCII # to 1EF | |
1703 std >u01EF,u | |
1704 rts | |
1705 | |
1706 * Searches for CR in string pointed to by X | |
1707 * '*' Comment lines come here | |
1708 L0B87 lda #C$CR We want to find the CR | |
1709 L0B89 cmpa ,x+ Found it yet? | |
1710 bne L0B89 No, keep looking | |
1711 cmpa ,-x Set up flags & return | |
1712 rts | |
1713 | |
1714 L0B90 pshs d,cc Preserve regs | |
1715 lda #$01 Only do std in & out (not error) | |
1716 bra L0B9A | |
1717 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1718 * Any errors from any of the CmdList subroutines go here |
714 | 1719 * If child process had error/status code it goes here (u005D cleared,B=Status |
1720 * code) | |
1721 L0B96 pshs d,cc Preserve error code, flags & A | |
1722 lda #$02 # of paths to do | |
1723 L0B9A sta <u001A Save it | |
1724 clra Start at path 0 | |
1725 L0B9D bsr L0BA8 Go close (possibly dupe) paths | |
1726 inca Next path # | |
1727 cmpa <u001A Done up to last one yet? | |
1728 bls L0B9D No, do next one | |
1729 * POSSIBLY COULD BE PULS PC,D,CC | |
1730 ror ,s+ Eat CC but shift Carry bit into Carry | |
1731 puls pc,d Restore error code & A & return | |
1732 | |
1733 L0BA8 pshs a Save path # | |
1734 tst <u0019 | |
1735 bmi L0BC4 If high bit set, close path | |
1736 bne L0BBC If 0<u0019<128, get changed path # & close | |
1737 tst a,u Check 'real' path # from DP | |
1738 beq L0BC7 If 0, return | |
1739 os9 I$Close Otherwise, close current path # | |
1740 lda a,u Get 'real' path # | |
1741 os9 I$Dup Dupe it | |
1742 | |
1743 * Close path # on stack, if it is open | |
1744 L0BBC ldb ,s Get path # from stack | |
1745 lda b,u Get real path # from DP | |
1746 beq L0BC7 If none, exit | |
1747 clr b,u Clear out path # | |
1748 L0BC4 os9 I$Close Close the path | |
1749 L0BC7 puls pc,a Exit | |
1750 | |
1751 L0BC9 fcc 'WHAT?' | |
1752 fcb C$CR | |
1753 | |
1754 L0BCF bsr L0B96 Close 3 std paths (possibly dupe) | |
1755 leax <L0BC9,pc Point to 'WHAT?' | |
1756 lbsr L021B Write it out std err | |
1757 clrb | |
1758 coma | |
1759 rts | |
1760 | |
1761 L0BDA inc <u0019 ??? | |
1762 bsr L0B96 Do path closings (possibly dupings) | |
1763 lda #$FF Set flag to just close raw paths | |
1764 sta <u0019 | |
1765 bsr L0B90 Go close std in & std err | |
1766 leax <u006D,u Point to device name buffer | |
1767 lbsr L0CDB | |
1768 lbcs L0200 | |
1769 lda #$02 | |
1770 bsr L0BA8 | |
1771 lbsr L0CFF | |
1772 clr <u0019 | |
1773 lbra L00CC | |
1774 * < processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1775 CmdIn ldd #$0001 |
714 | 1776 orb <u000F |
1777 bra L0C1A | |
1778 * >> processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1779 CmdErr ldd #$020D |
714 | 1780 stb -$02,x |
1781 bra L0C0A | |
1782 * > processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1783 CmdOut lda #$01 |
714 | 1784 L0C0A ldb #$02 |
1785 bra L0C1A | |
1786 * if from z= or i=, A=0, B=3 | |
1787 L0C0E tst a,u Test duped path? | |
1788 bne L0BCF There is one, print 'WHAT' & close paths & return | |
1789 pshs d Save path # & B | |
1790 tst <u0019 | |
1791 bmi L0C34 | |
1792 bra L0C24 | |
1793 | |
1794 L0C1A tst a,u | |
1795 bne L0BCF | |
1796 pshs d | |
1797 ldb #C$CR | |
1798 stb -$01,x | |
1799 | |
1800 L0C24 os9 I$Dup Create duplicate of the standard path | |
1801 lbcs L0CBE Couldn't create dupe, | |
1802 ldb ,s | |
1803 sta b,u | |
1804 lda ,s | |
1805 os9 I$Close | |
1806 | |
1807 L0C34 lda 1,s Get B | |
1808 bmi L0C40 | |
1809 ldb ,s | |
1810 lbsr L0D05 | |
1811 tsta | |
1812 bpl L0C47 | |
1813 L0C40 anda #$0F | |
1814 os9 I$Dup | |
1815 bra L0CBE | |
1816 L0C47 ldb #$0B | |
1817 bita #$02 | |
1818 bne L0C7B | |
1819 pshs a | |
1820 ldd ,x | |
1821 andb #$5F | |
1822 cmpd #$2F57 Is it '/W' | |
1823 puls a | |
1824 bne L0C74 | |
1825 ora #$02 | |
1826 os9 I$Open | |
1827 bcs L0CBE | |
1828 pshs x | |
1829 leax >L003C,pc | |
1830 ldy #$0001 | |
1831 clra | |
1832 os9 I$Write | |
1833 puls x | |
1834 bra L0CBE | |
1835 L0C74 os9 I$Open | |
1836 bra L0CBE | |
1837 L0C79 pshs d | |
1838 L0C7B stb <u004E | |
1839 ldb ,x | |
1840 cmpb #$2B | |
1841 bne L0C96 | |
1842 leax $01,x | |
1843 os9 I$Open | |
1844 bcs L0CB1 | |
1845 pshs u,x | |
1846 ldb #SS.Size | |
1847 os9 I$GetStt | |
1848 os9 I$Seek | |
1849 bra L0CA8 | |
1850 L0C96 cmpb #'- | |
1851 bne L0CB9 | |
1852 leax 1,x | |
1853 os9 I$Open | |
1854 bcs L0CB1 Error opening | |
1855 pshs u,x | |
1856 ldx #$0000 | |
1857 tfr x,u | |
1858 L0CA8 ldb #SS.Size Init size of file to 0 bytes | |
1859 os9 I$SetStt | |
1860 puls u,x | |
1861 bra L0CBE | |
1862 L0CB1 cmpb #E$PNNF Error 216 (path name not found)? | |
1863 beq L0CB9 Yes, create the file | |
1864 orcc #Carry Otherwise, set error flag | |
1865 bra L0CBE | |
1866 L0CB9 ldb <u004E Get file attributes | |
1867 os9 I$Create | |
1868 | |
1869 L0CBE sta <u0012 Save path # (or one we tried to duplicate?) | |
1870 stb 1,s Save possible error code? | |
1871 lda #$00 DO NOT CHANGE-NEED TO PRESERVE CARRY | |
1872 sta <u000F | |
1873 puls pc,d Restore regs & return | |
1874 L0CC8 ldd #$0003 Std in & ??? | |
1875 lbra L0C0E | |
1876 * <>>> processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1877 CmdIOE lda #C$CR |
714 | 1878 sta -$04,x |
1879 * i= & z= both come here right off the bat | |
1880 L0CD2 bsr L0CDB | |
1881 bcc L0CFF | |
1882 L0CD6 rts | |
1883 * <> processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1884 CmdIO lda #C$CR |
714 | 1885 sta -$02,x |
1886 | |
1887 L0CDB bsr L0CC8 | |
1888 bcs L0CD6 | |
1889 ldd #$0180 | |
1890 lbra L0C0E | |
1891 * <>> processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1892 CmdIE lda #C$CR |
714 | 1893 sta -$03,x |
1894 bsr L0CC8 | |
1895 bcs L0CD6 | |
1896 ldd #$0280 | |
1897 lbra L0C0E | |
1898 * >>> processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1899 CmdOE lda #C$CR |
714 | 1900 sta -$03,x |
1901 ldd #$0102 | |
1902 lbsr L0C0E | |
1903 bcs L0CD6 | |
1904 L0CFF ldd #$0281 | |
1905 lbra L0C0E | |
1906 L0D05 pshs x,d | |
1907 ldd ,x++ | |
1908 cmpd #$2F30 | |
1909 bcs L0D2F | |
1910 cmpd #$2F32 | |
1911 bhi L0D2F | |
1912 pshs x,d | |
1913 lbsr L0907 | |
1914 puls x,d | |
1915 bcs L0D2F | |
1916 andb #$03 | |
1917 cmpb 1,s | |
1918 bne L0D31 | |
1919 ldb b,u | |
1920 L0D26 orb #$80 | |
1921 stb ,s | |
1922 puls d | |
1923 leas 2,s | |
1924 rts | |
1925 L0D2F puls pc,x,d | |
1926 | |
1927 L0D31 tst $01,s | |
1928 bne L0D26 | |
1929 pshs x | |
1930 tfr b,a | |
1931 leax >u00B5,u Point to buffer for device name | |
1932 ldb #'/ Put a slash in it | |
1933 stb ,x+ | |
1934 ldb #SS.DevNm Get the device name | |
1935 os9 I$GetStt | |
1936 bcs L0D4F Error, skip ahead | |
1937 leax -1,x Reset ptr to include '/' | |
1938 lda #UPDAT. | |
1939 os9 I$Open | |
1940 L0D4F puls x Restore ptr to beginning (including '/') | |
1941 leas 6,s Eat stack | |
1942 lbra L0CBE | |
1943 | |
1944 L0D56 fcc 'TRUE ' | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1945 L0D5B fcb C$CR |
714 | 1946 L0D5C fcc 'FALSE' |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1947 fcb C$CR |
714 | 1948 |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
1949 CmdIF lda ,x+ |
714 | 1950 cmpa #'[ |
1951 bne L0D6B | |
1952 lbsr L0E15 | |
1953 L0D6B cmpa #'- | |
1954 lbne L0E3E | |
1955 ldb ,x+ | |
1956 lbsr L0E15 | |
1957 leax -$01,x | |
1958 tfr b,a | |
1959 lbsr L0F0C Convert char to uppercase if lower | |
1960 cmpa #'Y | |
1961 bne L0DBB | |
1962 L0D81 pshs x Preserve X | |
1963 leax >u0124,u Point to buffer | |
1964 ldy #$0001 Read 1 byte from error path??? | |
1965 lda #$02 | |
1966 os9 I$Read | |
1967 lbcs L0F17 | |
1968 lda ,x Get the character read | |
1969 puls x | |
1970 lbsr L0F0C Convert char to uppercase if lower | |
1971 cmpa #'Y Unless char is Y or N, re-read it | |
1972 beq L0DA3 | |
1973 cmpa #'N | |
1974 bne L0D81 | |
1975 L0DA3 pshs a Preserve char on stack | |
1976 leax >L0D5B,pc Point to a Carriage return | |
1977 lda #$02 Print it to std out | |
1978 ldy #$0001 | |
1979 os9 I$WritLn | |
1980 puls a Restore char | |
1981 clrb | |
1982 cmpa #'Y | |
1983 beq L0DF8 Print 'true' if it is a Y | |
1984 bra L0DEE Print 'false' if it is a N | |
1985 | |
1986 L0DBB clrb | |
1987 cmpa #'F | |
1988 beq L0DE0 | |
1989 cmpa #'E | |
1990 bne L0DC8 | |
1991 orb #%00000100 | |
1992 bra L0DE0 | |
1993 | |
1994 L0DC8 cmpa #'R | |
1995 bne L0DD0 | |
1996 orb #%00000001 | |
1997 bra L0DE0 | |
1998 | |
1999 L0DD0 cmpa #'W | |
2000 bne L0DD8 | |
2001 orb #%00000010 | |
2002 bra L0DE0 | |
2003 | |
2004 L0DD8 cmpa #'D | |
2005 lbne L0F17 | |
2006 orb #%10000000 | |
2007 L0DE0 tfr b,a | |
2008 os9 I$Open | |
2009 bcs L0DEE | |
2010 os9 I$Close | |
2011 bra L0DF8 | |
2012 | |
2013 L0DEE lda #$02 | |
2014 sta <u0043 | |
2015 leax >L0D5C,pc Point to 'FALSE' | |
2016 bra L0DFE | |
2017 | |
2018 L0DF8 clr <u0043 | |
2019 leax >L0D56,pc Point to 'TRUE' | |
2020 L0DFE tst <u001E Command echo on? | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2021 beq CmdTHEN No, skip ahead |
714 | 2022 ldy #$0006 Print result of IF to std error |
2023 lda #$02 | |
2024 os9 I$WritLn | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2025 CmdTHEN leax >u0124,u |
714 | 2026 lda #C$CR |
2027 sta ,x | |
2028 clrb | |
2029 rts | |
2030 | |
2031 L0E15 lda ,x+ | |
2032 cmpa #C$SPAC | |
2033 beq L0E15 | |
2034 rts | |
2035 | |
2036 L0E1C cmpa #$3D | |
2037 bne L0E26 | |
2038 lda <u005F | |
2039 ora #$01 | |
2040 bra L0E38 | |
2041 | |
2042 L0E26 cmpa #'< | |
2043 bne L0E30 | |
2044 lda <u005F | |
2045 ora #$02 | |
2046 bra L0E38 | |
2047 | |
2048 L0E30 cmpa #'> | |
2049 bne L0E3C | |
2050 * X command - Kill Shell when error occurs ON | |
2051 lda <u005F | |
2052 ora #$04 | |
2053 L0E38 sta <u005F | |
2054 clra | |
2055 rts | |
2056 | |
2057 L0E3C coma | |
2058 rts | |
2059 | |
2060 L0E3E cmpa #'+ | |
2061 bne L0E46 | |
2062 inc <u0015 | |
2063 bra L0E48 | |
2064 | |
2065 L0E46 leax -1,x | |
2066 L0E48 clr <u005F | |
2067 pshs u | |
2068 leau >u0124,u | |
2069 ldb #180 Clear out 180 bytes @ u0124 | |
2070 lbsr L0412 | |
2071 puls u | |
2072 leay >u0124,u | |
2073 ldb #81 | |
2074 L0E5D lda ,x+ Copy buffer up to CR or 81 chars | |
2075 lbsr L0F0C Convert char to uppercase if lower | |
2076 sta ,y+ | |
2077 cmpa #C$CR | |
2078 lbeq L0F17 | |
2079 bsr L0E1C | |
2080 bcc L0E74 | |
2081 decb | |
2082 bne L0E5D | |
2083 lbra L0F17 | |
2084 | |
2085 L0E74 negb | |
2086 addb #81 | |
2087 stb <u0016 | |
2088 clra | |
2089 sta -$01,y | |
2090 lda ,x | |
2091 bsr L0E1C | |
2092 bcs L0E84 | |
2093 leax $01,x | |
2094 L0E84 leay >u0175,u | |
2095 ldb #81 | |
2096 L0E8A lda ,x+ | |
2097 bsr L0F0C Convert char to uppercase if lower | |
2098 sta ,y+ | |
2099 cmpa #C$CR | |
2100 beq L0E99 | |
2101 decb | |
2102 bne L0E8A | |
2103 bra L0F17 | |
2104 | |
2105 L0E99 negb | |
2106 addb #$51 | |
2107 stb <u0017 | |
2108 clra | |
2109 sta -$01,y | |
2110 tst <u0015 | |
2111 beq L0EE0 | |
2112 leax >u166D,u | |
2113 ldd #$30b4 Store 180 ASCII 0's into buffer | |
2114 L0EAD sta ,x+ | |
2115 decb | |
2116 bne L0EAD | |
2117 leax >u0124,u | |
2118 ldb <u0016 | |
2119 leax b,x | |
2120 leay >u16BD,u | |
2121 bsr L0ED8 | |
2122 leax >u0175,u | |
2123 ldb <u0017 | |
2124 leax b,x | |
2125 leay >u170E,u | |
2126 bsr L0ED8 | |
2127 leax >u166D,u | |
2128 leay >u16BE,u | |
2129 bra L0EE8 | |
2130 | |
2131 L0ED8 lda ,-x | |
2132 sta ,-y | |
2133 decb | |
2134 bne L0ED8 | |
2135 rts | |
2136 | |
2137 L0EE0 leax >u0124,u | |
2138 leay >u0175,u | |
2139 L0EE8 ldb #80 | |
2140 L0EEA lda ,x+ | |
2141 cmpa ,y+ | |
2142 blo L0EFB | |
2143 bhi L0F01 | |
2144 decb | |
2145 bne L0EEA | |
2146 lda <u005F | |
2147 bita #$01 | |
2148 bra L0F05 | |
2149 | |
2150 L0EFB lda <u005F | |
2151 bita #$02 | |
2152 bra L0F05 | |
2153 | |
2154 L0F01 lda <u005F | |
2155 bita #$04 | |
2156 L0F05 lbne L0DF8 | |
2157 lbra L0DEE | |
2158 | |
2159 * Convert char to uppercase if it is a letter | |
2160 L0F0C cmpa #'a Lower case letter? | |
2161 blo L0F16 No, return | |
2162 cmpa #'z Check high range | |
2163 bhi L0F16 No, return | |
2164 suba #$20 Yes, convert to uppercase | |
2165 L0F16 rts | |
2166 | |
2167 L0F17 comb | |
2168 ldb #$01 | |
2169 lbra L0191 | |
2170 | |
2171 L0F1D cmpa #$03 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2172 beq CmdCLRIF |
714 | 2173 cmpa #$02 |
2174 bne L0F2B | |
2175 dec <u0044 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2176 blt CmdCLRIF |
714 | 2177 bra L0F43 |
2178 | |
2179 L0F2B cmpa #$01 | |
2180 bne L0F3B | |
2181 lda <u0043 | |
2182 cmpa #$02 | |
2183 bne L0F43 | |
2184 tst <u0044 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2185 beq CmdCLRIF |
714 | 2186 bra L0F43 |
2187 | |
2188 L0F3B inc <u0044 | |
2189 bra L0F43 | |
2190 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2191 CmdCLRIF clr <u0043 |
714 | 2192 clr <u0044 |
2193 L0F43 clrb | |
2194 rts | |
2195 | |
2196 * Table: 7 bytes/entry: | |
2197 * 1st 5 bytes is name, high bit set & NUL padded | |
2198 * Byte 6 is # bytes actually used | |
2199 L0F45 fcs 'IF' | |
2200 fcb 0,0,0,2,0 | |
2201 fcs 'ELSE' | |
2202 fcb 0,4,1 | |
2203 fcs 'ENDIF' | |
2204 fcb 5,2 | |
2205 fcs 'FI' | |
2206 fcb 0,0,0,2,2 | |
2207 fcs 'CLRIF' | |
2208 fcb 5,3 | |
2209 fcb $ff | |
2210 | |
2211 L0F69 leay <L0F45,pc Point to conditionals table | |
2212 L0F6D ldb 5,y Get actual length of string we are checking | |
2213 os9 F$CmpNam Compare with string pointed to by X | |
2214 bcs L0F80 If they don't match, skip ahead | |
2215 lda 6,y Get conditional token(?) number | |
2216 ldb b,x Get char past end of matching string | |
2217 cmpb #C$CR Is it a CR? | |
2218 beq L0F8B Yes, return | |
2219 cmpb #C$SPAC Is it a space? | |
2220 beq L0F8B Yes, return | |
2221 L0F80 leay 7,y Point to next command in table | |
2222 lda ,y Get 1st char from this entry | |
2223 cmpa #$FF End of table marker? | |
2224 beq L0F8B Yes, return | |
2225 * NOTE: THIS INCA SEEMS TO BE USELESS, AS F$CMPNAM DOESN'T USE A | |
2226 inca No, ??? | |
2227 bra L0F6D Process this one | |
2228 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2229 CmdELSE lda #$01 |
714 | 2230 sta <u0043 |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2231 lbra CmdTHEN |
714 | 2232 |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2233 CmdONERR lbsr L0907 Go find 1st non-space char or single char modifier |
714 | 2234 bne L0F9B |
2235 clr <u0046 | |
2236 L0F8B rts | |
2237 | |
2238 L0F9B leay >L03AC,pc Point to 'GOTO' | |
2239 ldb #4 4 chars to compare | |
2240 os9 F$CmpNam Does it match? | |
2241 lbcs L0BCF No, print 'WHAT?' | |
2242 leax 4,x Yes, skip X past 'GOTO' | |
2243 lbsr L091F Go find 1st non-space char past 'GOTO' | |
2244 leay >u0C4C,u Point to some sort of buffer | |
2245 lda ,x Get char from GOTO label | |
2246 cmpa #'+ Is label after current pos. in script file? | |
2247 bne L0FBB No, skip ahead | |
2248 sta ,y+ Save '+' in buffer | |
2249 leax 1,x Bump up source ptr past '+' | |
2250 L0FBB bsr L100B Go copy label name into buffer | |
2251 inc <u0046 Set flag that a GOTO was found | |
2252 L0FBF lda ,x+ Get 1st char from user's label again | |
2253 leay >L0408,pc Point to single char modifiers table | |
2254 L0FC5 cmpa ,y+ Illegal modifier char in label name? | |
2255 bhi L0FC5 Not yet, check other modifiers | |
2256 blo L0FBF This char ok, check rest of label name | |
2257 leax -1,x Point to last char (terminator) of label name | |
2258 stx <u0058 Save it & return | |
2259 rts | |
2260 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2261 CmdGOTO lda ,x |
714 | 2262 cmpa #'+ |
2263 bne L0FDA | |
2264 leax 1,x | |
2265 bra L0FFB | |
2266 L0FDA tst <u006B | |
2267 beq L0FEA | |
2268 ldy <u0067 | |
2269 ldd $09,y | |
2270 leay d,y | |
2271 sty <u0065 | |
2272 bra L0FFB | |
2273 L0FEA pshs u,x | |
2274 clra | |
2275 ldx #$0000 Seek to beginning | |
2276 tfr x,u | |
2277 os9 I$Seek | |
2278 puls u,x | |
2279 lbcs L0191 | |
2280 L0FFB lbsr L091F | |
2281 leay >u0BFC,u | |
2282 bsr L100B | |
2283 lda #C$CR | |
2284 sta ,x | |
2285 inc <u0045 | |
2286 rts | |
2287 | |
2288 * Copy label from X to buffer @ Y, terminate at 1st illegal char with CR | |
2289 * Exit: X=ptr to start of label name from user's buffer | |
2290 * Y=ptr to start of buffer entry copy of label name | |
2291 L100B pshs y,x Preserve buffer & source ptrs | |
2292 ldb #79 (78 bytes to check) | |
2293 L100F decb Dec # chars left to check | |
2294 beq L1022 If done max, skip ahead | |
2295 lda ,x+ Get char for label | |
2296 sta ,y+ Save in buffer | |
2297 cmpa #'A Is it a letter or higher? | |
2298 bhs L100F Yes, continue copying | |
2299 cmpa #'0 Is it lower than a #? | |
2300 blo L1022 Yes, not allowed, force end of label name | |
2301 cmpa #'9 Is it a #? | |
2302 bls L100F Yes, that is fine | |
2303 L1022 lda #C$CR All others illegal, force CR in buffer copy | |
2304 sta -1,y Save it | |
2305 clrb No error | |
2306 puls pc,y,x Restore regs & return | |
2307 | |
2308 * M= command (???) | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2309 CmdMEq ldb #C$CR |
714 | 2310 stb -$01,x |
2311 tst <u006B | |
2312 bne L1057 | |
2313 tst <u006C | |
2314 bne L1057 | |
2315 lda #Data Data module type | |
2316 pshs u,y,x | |
2317 os9 F$Link | |
2318 bcs L1055 | |
2319 stu <u0067 Save start address of module | |
2320 sty <u0065 Save execution address of module | |
2321 ldd 2,u | |
2322 addd <u0067 | |
2323 subd #$0003 | |
2324 std <u0069 | |
2325 inc <u006B | |
2326 puls u,y,x | |
2327 leax -$01,x | |
2328 lbra L0907 | |
2329 | |
2330 L1055 puls u,y,x | |
2331 L1057 lbra L0BCF | |
2332 | |
2333 * VAR. command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2334 CmdVAR leay >u05A8,u |
714 | 2335 lda ,x+ |
2336 cmpa #'? | |
2337 beq L10C9 | |
2338 cmpa #'= | |
2339 beq L1096 | |
2340 cmpa #C$SPAC | |
2341 beq L1085 | |
2342 cmpa #'; | |
2343 beq L1085 | |
2344 cmpa #'9 | |
2345 bhi L1085 | |
2346 cmpa #'0 | |
2347 bcs L1085 | |
2348 suba #$30 | |
2349 ldb #$51 Multiply by 81 (size of each VAR entry) | |
2350 mul | |
2351 leay d,y | |
2352 lda ,x+ | |
2353 cmpa #'= | |
2354 beq L1096 | |
2355 L1085 leax -$01,x | |
2356 pshs x | |
2357 tfr y,x | |
2358 ldy #$0051 | |
2359 lda #$02 | |
2360 os9 I$ReadLn | |
2361 puls pc,x | |
2362 | |
2363 L1096 ldb #80 | |
2364 lbsr L0A25 | |
2365 lda #C$CR | |
2366 sta ,y | |
2367 rts | |
2368 | |
2369 L10A0 fcb C$LF | |
2370 fcc 'User Variables :' | |
2371 fcb C$CR | |
2372 | |
2373 L10B2 fcb C$LF | |
2374 fcc 'Shell Sub Variables :' | |
2375 fcb C$CR | |
2376 | |
2377 L10C9 pshs x | |
2378 clrb | |
2379 leax >L10A0,pc | |
2380 bsr L10DF | |
2381 leay >u08D2,u | |
2382 clrb | |
2383 leax >L10B2,pc | |
2384 bsr L10DF | |
2385 puls pc,x | |
2386 | |
2387 L10DF pshs y,b | |
2388 lbsr L021B | |
2389 puls y,b | |
2390 L10E6 pshs y,b | |
2391 lda #$51 | |
2392 mul | |
2393 leay d,y | |
2394 leax >u0124,u | |
2395 ldd #'V*256+'A | |
2396 std ,x++ | |
2397 ldd #'R*256+'. | |
2398 std ,x++ | |
2399 lda ,s | |
2400 L10FD adda #$30 | |
2401 ldb #'= | |
2402 std ,x++ | |
2403 L1103 lda ,y+ | |
2404 sta ,x+ | |
2405 cmpa #C$CR | |
2406 bne L1103 | |
2407 leax >u0124,u | |
2408 ldy #$0057 | |
2409 lda #$01 | |
2410 os9 I$WritLn | |
2411 puls y,b | |
2412 bcs L1122 | |
2413 incb | |
2414 cmpb #C$LF | |
2415 bcs L10E6 | |
2416 rts | |
2417 | |
2418 L1122 puls y | |
2419 puls pc,x | |
2420 | |
2421 * INC. command (increment shell variable by 1) | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2422 CmdINC bsr L1144 |
714 | 2423 lbcs L0191 |
2424 addd #$0001 | |
2425 bra L113A | |
2426 | |
2427 * DEC. command (decrement shell variable by 1) | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2428 CmdDEC bsr L1144 |
714 | 2429 lbcs L0191 |
2430 subd #$0001 | |
2431 L113A bsr L11A7 | |
2432 lda #C$CR | |
2433 sta $05,y | |
2434 ldx <u0048 | |
2435 clrb | |
2436 rts | |
2437 | |
2438 L1144 inc <u0014 | |
2439 leay >u05A8,u | |
2440 lda ,x+ | |
2441 stx <u0048 | |
2442 cmpa #'0 | |
2443 bcs L1161 | |
2444 cmpa #'9 | |
2445 bhi L1161 | |
2446 suba #$30 | |
2447 ldb #81 | |
2448 mul | |
2449 leay d,y | |
2450 tfr y,x | |
2451 bra L1166 | |
2452 | |
2453 L1161 leas 2,s | |
2454 lbra L0BCF | |
2455 | |
2456 L1166 pshs y | |
2457 leas -$05,s | |
2458 tfr s,y | |
2459 clr $03,y | |
2460 clr $04,y | |
2461 L1170 clr $02,y | |
2462 lda ,x+ | |
2463 suba #$30 | |
2464 cmpa #$09 | |
2465 bhi L1195 | |
2466 pshs a | |
2467 lda #10 | |
2468 ldb $03,y | |
2469 mul | |
2470 std ,y | |
2471 lda $04,y | |
2472 ldb #10 | |
2473 mul | |
2474 addd $01,y | |
2475 std $01,y | |
2476 clra | |
2477 puls b | |
2478 addd $01,y | |
2479 std $03,y | |
2480 bra L1170 | |
2481 | |
2482 L1195 ldd 3,y | |
2483 leas 5,s | |
2484 puls pc,y | |
2485 | |
2486 * 2 byte ASCII conversion table | |
2487 L119B fdb 10000 | |
2488 fdb 1000 | |
2489 fdb 100 | |
2490 fdb 10 | |
2491 fdb 1 | |
2492 fdb 0 | |
2493 | |
2494 L11A7 pshs y,x,d | |
2495 pshs b | |
2496 leax >L119B,pc | |
2497 L11AF pshs d | |
2498 ldb #'/ | |
2499 stb 2,s | |
2500 puls d | |
2501 L11B7 inc ,s | |
2502 subd ,x | |
2503 bcc L11B7 | |
2504 addd ,x++ | |
2505 pshs d | |
2506 ldb $02,s | |
2507 stb ,y+ | |
2508 lda $01,x | |
2509 puls d | |
2510 bne L11AF | |
2511 puls b | |
2512 puls pc,y,x,d | |
2513 | |
2514 * PAUSE command - may display text message, and then waits for key press or | |
2515 * mouse button | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2516 CmdPAUSE ldy #394 Write up to 394 chars of pause string |
714 | 2517 lda #$02 To standard error |
2518 os9 I$WritLn | |
2519 lbcs L0191 | |
2520 tfr y,d Tfr # chars written to D | |
2521 leax d,x Point X to next char after ones written | |
2522 leax -1,x Point to last char written | |
2523 pshs x Save ptr | |
2524 ldd #$02*256+SS.SSig Std Err/Send signal when key pressed | |
2525 ldx #$000A Signal $A is the one to send | |
2526 os9 I$SetStt | |
2527 lbcs L0191 Error, use main shell error handler | |
1505 | 2528 IFGT Level-1 |
714 | 2529 ldb #SS.MsSig Send signal on mouse button press |
2530 os9 I$SetStt | |
2531 lbcs L0191 | |
1505 | 2532 ENDC |
714 | 2533 ldx #$0000 Go to sleep until one of the 2 is received |
2534 os9 F$Sleep | |
2535 ldb #SS.Relea Signal gotten, release all signals | |
2536 os9 I$SetStt | |
2537 clrb No error & return | |
2538 puls pc,x | |
2539 | |
2540 * Parse PATH=, add paths to PATH buffer list | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2541 CmdPATHEq |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2542 pshs x Preserve ptr to string after 'PATH=' |
714 | 2543 lda ,x Get 1st char |
2544 cmpa #'? User requesting current paths? | |
2545 beq L1245 Yes, go do that | |
2546 pshs u Preserve U | |
2547 leau >u0CDD,u Point to PATH= buffer | |
2548 L1217 lda ,x+ Get char from user-requested path | |
2549 cmpa #C$SPAC Space? | |
2550 beq L1217 Yes, eat spaces until 1st real char found | |
2551 sta ,u+ No, save char | |
2552 L121F leay >L0408,pc Point to command modifier list | |
2553 L1223 cmpa ,y+ Match char? | |
2554 bhi L1223 No, our char is higher, check next modifier | |
2555 beq L1237 Found match, skip ahead | |
2556 lda ,x+ No modifier found, get next char | |
2557 sta ,u+ Save in PATH buffer | |
2558 cmpa #C$SPAC Was it a space? | |
2559 bne L121F No, check this char vs. modifier list | |
2560 lda #C$CR Yes, change to CR | |
2561 sta -1,u Save CR instead (terminate 1 path entry) | |
2562 bra L1217 Do whole list | |
2563 | |
2564 * NOTE: ANY modifier (not just CR, but ! # & ; < > ^ |) stops PATH=parsing | |
2565 L1237 leax -1,x Bump ptr back to last char from user | |
2566 stx 2,s Save ptr on stack over original X | |
2567 lda #C$CR Get CR | |
2568 sta -1,u Save CR as current path end | |
2569 sta ,u And 1 extra for parse routines | |
2570 puls u Get U back | |
2571 puls pc,x Restore new X & return | |
2572 | |
2573 L1245 leax >u0CDD,u Point to start of PATH=buffer | |
2574 L1249 ldy #400 Write up to 400 chars to standard out | |
2575 lda #$01 | |
2576 os9 I$WritLn Print text of one path | |
2577 lbcs L0191 Error, go process shell error | |
2578 tfr y,d Tfr # bytes written to D | |
2579 leax d,x Offset X to end of what was printed | |
2580 lda ,x Get char from there | |
2581 cmpa #C$CR CR (end of path list)? | |
2582 bne L1249 No, go write next path out | |
2583 puls x Restore ptr to next set of PATH= | |
2584 leax 1,x Bump ptr up by 1 & return | |
2585 rts | |
2586 | |
2587 * ^ (set priority on the fly) command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2588 CmdCaret ldb #C$CR Plop a CR onto the end |
714 | 2589 stb -$01,x |
2590 ldb <u0022 Any priority already set? | |
2591 lbne L0BCF Yes, print 'WHAT?' | |
2592 lbsr L16EB Go calculate binary priority into B | |
2593 stb <u0022 Save priority to fork module with | |
2594 lbra L0907 Continue processing for modifiers | |
2595 | |
2596 * # (set data memory size) command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2597 CmdMem ldb #C$CR |
714 | 2598 stb -1,x |
2599 ldb <u0003 Already have a data mem size set? | |
2600 lbne L0BCF Yes, print 'WHAT?' | |
2601 lbsr L16EB | |
2602 eora #'K | |
2603 anda #$DF Force uppercase | |
2604 bne L1294 No 'K', just save # of 256 byte pages | |
2605 leax 1,x | |
2606 lda #4 Multiply # of K by 4 to get # pages | |
2607 mul | |
2608 tsta | |
2609 lbne L0BCF Ended up too big, print 'WHAT?' | |
2610 L1294 stb <u0003 Save data mem size to use | |
2611 lbra L0907 Continue processing command line | |
2612 | |
2613 * Carriage return processing | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2614 CmdCR leax -1,x |
714 | 2615 lbsr L145D |
2616 bra L12A3 | |
2617 | |
2618 * ; (separator) command (also called by others) | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2619 CmdSEMIC lbsr L1459 |
714 | 2620 L12A3 bcs L12BA |
2621 lbsr L0B96 Go do the path stuff | |
2622 tst <u005D Is there a module that is unlinking? | |
2623 bne L12AE Yes | |
2624 bsr L12D2 Go wait for child process to die (A=process #) | |
2625 | |
2626 L12AE bcs L12BA If child exited with status/signal code,skip | |
2627 lbsr L0907 Go parse for modifiers | |
2628 cmpa #C$CR Was the next non-space/comma char a CR? | |
2629 bne L12B9 No, skip ahead | |
2630 leas 4,s Yes, eat stack | |
2631 L12B9 clrb No error | |
2632 | |
2633 * Child process had a signal/status code | |
2634 L12BA pshs cc Preserve error status | |
2635 clr <u005D ??? | |
2636 puls cc Restore carry | |
2637 lbra L0B96 ??? Go close some paths & return? | |
2638 | |
2639 * & (background operation) command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2640 CmdAmp lbsr L1459 |
714 | 2641 bcs L12BA |
2642 bsr L12BA | |
2643 ldb #$26 | |
2644 lbsr L16B3 | |
2645 bra L12AE | |
2646 | |
2647 * W command - Wait for a child to die | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
2648 CmdW clra Clear process ID # |
714 | 2649 * Entered here if commands are separated with ';' (or '()' groups) |
2650 L12D2 pshs a Save ID # of process? | |
2651 L12D4 os9 F$Wait Wait for child to die or until signal received | |
2652 tst <u000E Signal received (which would be in SHELL)? | |
2653 beq L12EC No, child was exited (or got signal), go process | |
2654 * Shell was interrupted by signal while Waiting | |
2655 ldb <u000E Get signal that we received | |
2656 cmpb #S$Abort Was it a PD.QUT (<CTRL>-<E>) (quit 'W'aiting?) | |
2657 bne L1304 No, skip ahead | |
2658 lda ,s Get process # | |
2659 beq L1304 None, exit | |
2660 os9 F$Send Send the signal to the child as well | |
2661 clr ,s Clear process # | |
2662 bra L12D4 Go Wait again (until child dies) | |
2663 | |
2664 * Child F$Exited or was aborted - eat should go here | |
2665 * Entry: A=ID # of deceased child | |
2666 * B=Exit (error) code from child | |
2667 L12EC lbcs L1308 If F$Wait exited with error, return with it | |
2668 cmpa ,s Same process # as one we were waiting for? | |
2669 beq L1304 Yes, exit | |
2670 tst ,s No, was there a specific process # we wanted? | |
2671 beq L12F9 No, skip ahead | |
2672 * Child died, but not the one we were waiting for | |
2673 tstb Was there an error status? | |
2674 beq L12D4 No, ignore dead child and wait for one we wanted | |
2675 * Child died with error on exit | |
2676 L12F9 pshs b Preserve child's exit status code | |
2677 bsr L12BA ??? Go close & re-dupe paths? | |
2678 ldb #'- Get a '-' (for a '-003' process finished msg) | |
2679 lbsr L16B3 Print that out | |
2680 puls b Get back exit status code | |
2681 | |
2682 L1304 tstb is there an Error/signal code? | |
2683 beq L1308 No, exit | |
2684 cmpb #S$Intrpt Yes, is it a keyboard interrupt signal? | |
2685 beq eatchar Yes, eat the key | |
2686 cmpb #S$Abort Keyboard abort signal? | |
2687 bne errexit No, exit with unknown error/signal code | |
2688 | |
2689 * At this point, child died from signal 2 or 3 (CTRL-C or CTRL-E). The corres- | |
2690 * ponding key is also sitting in this devices PD.BUF as the 1st char. We musts | |
2691 * 1) Disable keyboard signal & eat the key from the buffer | |
2692 * 2) Exit from here with Carry set & signal (2 or 3) in B | |
2693 eatchar pshs b,x,y Preserve signal code & regs used | |
2694 ldd #SS.Ready Std in, check for data ready on device | |
2695 os9 I$GetStt Check it | |
2696 bcs NotSCF No chars waiting on device, exit with signal | |
2697 lda <u0018 Is the shell immortal? | |
2698 beq NotSCF No, don't try to eat the char | |
2699 eat clra Standard in path | |
2700 leas -PD.OPT,s Make 32 byte buffer for OPT's | |
2701 leax ,s Point X to it | |
2702 clrb SS.Opt call | |
2703 os9 I$GetStt Get current path options | |
2704 lda ,x Get device type | |
2705 beq Eatkey SCF (not script file) so go eat key | |
2706 NoChar leas PD.OPT,s Eat temp buffer | |
2707 bra NotSCF Exit with signal code (script file got signal) | |
2708 | |
2709 * Have to eat key: Shut echo off 1st | |
2710 Eatkey clr 4,x PD.EKO flag off | |
2711 os9 I$SetStt Shut echo off | |
2712 ldd #SS.Relea Std In, Release keyboard/mouse signals | |
2713 os9 I$SetStt Shut signals off so we don't get stuck | |
2714 leax ,-s Make 1 byte buffer on stack | |
2715 ldy #1 1 byte to read | |
2716 os9 I$Read Eat the char | |
2717 leas 1,s eat buffer | |
2718 ldd #SS.SSig Std In, send signal on key ready | |
2719 ldx #$B Signal to send | |
2720 os9 I$SetStt Turn keyboard signal on again | |
2721 leax ,s Point to temp buffer again | |
2722 inc 4,x PD.EKO flag on | |
2723 clra Std In | |
2724 clrb Set Options | |
2725 os9 I$SetStt Turn echo back on | |
2726 leas PD.OPT,s Deallocate temp buffer | |
2727 ldb u180D,u Get current history line # | |
2728 cmpb #1 First one? | |
2729 bhi Previous No, B=previous one | |
2730 ldb u180C,u Was on first, so get last | |
2731 incb Adjust for dec | |
2732 Previous decb Point to previous one | |
2733 lbsr L19D3 Go get ptr to history | |
2734 lda ,y Get 1st char from previous line in history | |
2735 sta ,x Save char there | |
2736 ldd #SS.Fill Fill keyboard buffer call to Std In | |
2737 ldy #$8001 1 char long, don't append CR | |
2738 os9 I$SetStt Stick that key into the keyboard buffer | |
2739 NotSCF puls b,x,y Restore regs (and exit status byte in B) | |
2740 errexit coma Yes, set carry & exit | |
2741 L1308 puls pc,a | |
2742 | |
1505 | 2743 * Level 2: If data area <4.25K, force up to 7.5K |
714 | 2744 * Exit: A=Type/language |
2745 * X=Current source line parsing ptr (module name to chain) | |
2746 * Y=Size of parameter area | |
2747 * U=Ptr to parameter area | |
2748 * B=Size of data area | |
2749 L130A lda #Prgrm+Objct Module type/language | |
2750 ldb <u0003 Get # pages of data mem needed for forked module | |
1505 | 2751 IFGT Level-1 |
714 | 2752 cmpb #$11 Is it at least 17? |
2753 bhs L1316 Yes, skip ahead | |
2754 ldb #$1F Otherwise, force to 7.5K minimum | |
2755 stb <u0003 Save it | |
1505 | 2756 ENDC |
714 | 2757 L1316 andcc #^Carry Clear carry |
2758 ldx <u0004 Get mem module ptr | |
2759 ldy <u0006 Get size of current command group | |
2760 ldu <u0008 Get ptr to start of current command group | |
2761 rts | |
2762 | |
2763 * Copy string from X to Y until CR is hit | |
2764 L1320 lda ,x+ Get char | |
2765 sta ,y+ Save it | |
2766 cmpa #C$CR Carriage return? | |
2767 bne L1320 No, keep copying | |
2768 rts Done, return | |
2769 | |
2770 * Attempt load in module to execute (it's not in memory) | |
2771 * Entry: X=Ptr to module name | |
2772 L1329 lda #EXEC. 1st, attempt to get it from current Exec DIR | |
2773 os9 I$Open Attempt to open it | |
2774 bcc L1362 Found it, continue | |
2775 * Possible search thru PATH= settings | |
2776 inc <u000F ??? Set flag to indicate using PATH= | |
2777 leax >u0CDD,u Point to start of PATH= list | |
2778 L1336 clrb | |
2779 lda ,x Get 1st char from next PATH= line | |
2780 cmpa #C$CR End of list? | |
2781 lbeq L1564 Yes, ??? | |
2782 leay >u0124,u No, point to temp buffer | |
2783 bsr L1320 Copy path to temp buffer until CR | |
2784 pshs x Preserve ptr to next possible path | |
2785 lda #'/ Add slash since we want file from this path | |
2786 sta -1,y Save at end of path in temp buffer | |
2787 ldx <u0004 Get ptr to module/script name we are looking for | |
2788 bsr L1320 Copy it into temp buffer up to CR | |
2789 leax >u0124,u Point to start of full path list | |
2790 lda #READ. Attempt to open file | |
2791 os9 I$Open | |
2792 puls x Restore ptr to next possible path | |
2793 bcs L1336 Didn't find file there, try next path | |
2794 leax >u0124,u Point to full pathlist again | |
2795 stx <u0004 Replace ptr to module with full pathlist ptr | |
2796 L1362 leax >u00D6,u Point to buffer to hold beginning of file | |
2797 ldy #77 77 bytes to read | |
2798 os9 I$Read Read it in | |
2799 bcc L1373 No error, skip ahead | |
2800 cmpb #E$EOF Just EOF error? | |
2801 bne L13CE No, something more serious, skip ahead | |
2802 L1373 tst <u000F | |
2803 bne L137B | |
2804 ldb #$04 | |
2805 stb <u000F | |
2806 L137B pshs a Save path # a sec | |
2807 ldd M$ID,x Get possible module header bytes | |
2808 cmpd #M$ID12 Legit module header? | |
2809 puls a Restore path # | |
2810 beq L1396 OS9 module, skip ahead | |
2811 * Not module...possible shell script? | |
2812 os9 I$Close Not OS9 module, close file | |
2813 clrb | |
2814 dec <u000F Dec flag | |
2815 lbeq L1564 If 0, skip ahead | |
2816 inc <u000F If not, inc & skip ahead | |
2817 lbra L1564 | |
2818 | |
2819 * Seems to be OS9 module | |
2820 L1396 clr <u000F Clear flag | |
2821 ldy M$Name,x Get offset to module name | |
2822 leax >u00E3,u Point X to offset $E in module | |
2823 cmpy #$000D Does the name start at offset $D? | |
2824 beq L13C0 Yes, skip ahead | |
2825 pshs u Preserve U | |
2826 tfr y,u Move name offset to U | |
2827 ldx #$0000 MSW of file pos=0 | |
2828 os9 I$Seek Go seek to that spot in file | |
2829 puls u Restore U | |
2830 bcs L13CE Error seeking, go handle | |
2831 ldy #64 Go read up to 64 char filename | |
2832 leax >u00E3,u Point to spot to hold filename | |
2833 os9 I$Read Read it in | |
2834 bcs L13CE Error reading, go handle | |
2835 L13C0 pshs a Save path # | |
2836 os9 F$PrsNam Parse module name | |
2837 puls a Restore path # | |
2838 bcs L13CE | |
2839 cmpb #$40 | |
2840 bhi L1422 | |
2841 clrb | |
2842 L13CE pshs b,cc Preserve error status | |
2843 os9 I$Close Close file | |
2844 puls b,cc Restore error status | |
2845 lbcs L162B If error, exit with it (S/B L162C) | |
2846 leax >u00D6,u Point to buffer holding 77 bytes of file | |
2847 lda $06,x | |
2848 ldy $0B,x | |
2849 cmpa #$40 | |
2850 bne L1407 | |
2851 bsr L13EF | |
2852 lbcs L162B | |
2853 lbra L14AF | |
2854 L13EF leax >u00E3,u | |
1505 | 2855 IFGT Level-1 |
2856 os9 F$NMLink | |
2857 ELSE | |
2858 pshs u | |
2859 os9 F$Link | |
2860 puls u | |
2861 ENDC | |
714 | 2862 bcc L1400 |
2863 ldx <u0004 | |
1505 | 2864 IFGT Level-1 |
2865 os9 F$NMLoad | |
2866 ELSE | |
2867 pshs u | |
2868 os9 F$Load | |
2869 puls u | |
2870 ENDC | |
714 | 2871 bcc L1400 |
2872 rts | |
2873 L1400 leax >u00E3,u | |
2874 stx <u0004 | |
2875 rts | |
2876 L1407 cmpa #$51 | |
2877 bne L1413 | |
2878 bsr L13EF | |
2879 lbcs L162B | |
2880 bra L1427 | |
2881 L1413 cmpa #$11 | |
2882 lbne L14D7 | |
2883 leax >u00E3,u | |
2884 stx <u0010 | |
2885 lbra L15D7 | |
2886 L1422 lbsr L08CB | |
2887 bra L13CE | |
2888 | |
2889 * Call a shellsub module | |
2890 L1427 clra Type/language byte to wildcard:any will match | |
2891 ldx <u0004 Get ptr to module name | |
2892 pshs u Preserve U | |
2893 os9 F$Link Attempt to link it in | |
2894 puls u Restore U | |
2895 lbcs L162B If we couldn't link, Exit with error | |
2896 ldx <u0004 Get ptr to module name again | |
1505 | 2897 IFGT Level-1 |
714 | 2898 os9 F$UnLoad Unlink it |
1505 | 2899 ELSE |
2900 pshs a,b,x,y,u | |
2901 os9 F$Link | |
2902 os9 F$Unlink | |
2903 os9 F$Unlink | |
2904 puls a,b,x,y,u | |
2905 ENDC | |
714 | 2906 lbcs L162B If we couldn't unlink exit with error |
2907 ldx <u0008 Get ptr to current group (param ptr for shellsub) | |
2908 ldd <u0006 Get size of param area for shellsub | |
2909 leau >u08D2,u Point to shellsub variable area | |
2910 jsr ,y Execute shellsub module | |
2911 pshs b,a,cc Preserve error status & A | |
2912 clra | |
2913 clrb | |
2914 std <u0010 ? (originally pointing to E3 if type $11 module) | |
2915 ldx <u0004 Get shellsub module ptr | |
1505 | 2916 IFGT Level-1 |
714 | 2917 os9 F$UnLoad Unlink it |
1505 | 2918 ELSE |
2919 pshs a,b,x,y,u | |
2920 os9 F$Link | |
2921 os9 F$Unlink | |
2922 os9 F$Unlink | |
2923 puls a,b,x,y,u | |
2924 ENDC | |
714 | 2925 std <u0004 Clear shellsub module ptr |
2926 inc <u005D Set flag that we should wait for module to exit? | |
2927 puls pc,u,y,x,d,cc restore regs & return | |
2928 | |
2929 L1459 lda #C$CR | |
2930 sta -1,x | |
2931 L145D clr <u0060 | |
2932 pshs u,y,x | |
2933 ldx <u0004 Get ptr to name | |
2934 ldd ,x Get 2 chars of name | |
2935 andb #$5F Force 2nd one to uppercase | |
2936 cmpd #$2F57 Is it a /W? | |
2937 bne L1473 No, check for shellsub | |
2938 comb Yes, exit with bad mode error | |
2939 ldb #E$BMode | |
2940 lbra L162B | |
2941 | |
2942 L1473 clra Wildcard NMLink | |
1505 | 2943 IFGT Level-1 |
714 | 2944 os9 F$NMLink Link to module |
1505 | 2945 ELSE |
2946 pshs u | |
2947 os9 F$Link Link to module | |
2948 puls u | |
2949 ENDC | |
714 | 2950 lbcs L1329 Error, do something |
2951 cmpa #ShellSub+Objct ShellSub module? | |
2952 beq L1427 Yes, go set up for it | |
2953 ldx <u0004 Get ptr to name back | |
1505 | 2954 IFGT Level-1 |
714 | 2955 os9 F$UnLoad Drop the link count back down |
1505 | 2956 ELSE |
2957 pshs a,b,x,y,u | |
2958 os9 F$Link | |
2959 os9 F$Unlink | |
2960 os9 F$Unlink | |
2961 puls a,b,x,y,u | |
2962 ENDC | |
714 | 2963 pshs y Save data area size |
2964 ldx <u0004 Get ptr to module name again | |
2965 leay >L000D,pc Point to 'Shell' | |
2966 ldb #$05 Size of 'Shell' | |
2967 os9 F$CmpNam Is the module requested Shell? | |
2968 puls y Restore data area size | |
2969 bcs L14A3 Not shell, skip ahead | |
2970 ldb 5,x Get char right after 'shell' | |
2971 cmpb #C$CR Is 'shell' the only thing on the line? | |
2972 lbeq L158D Yes, skip ahead | |
2973 cmpb #C$SPAC Is it a space? | |
2974 lbeq L158D Yes, skip ahead | |
2975 * Not Shell or Shellsub module | |
2976 L14A3 cmpa #Prgrm+Objct ML program? | |
2977 lbeq L15D7 Yes, skip ahead | |
2978 cmpa #Data Is it a data module? | |
2979 bne L14D7 No, skip ahead | |
2980 inc <u0060 Set flag - data module | |
2981 L14AF inc <u0060 Bump it up | |
2982 ldx <u0004 Get ptr to module name | |
2983 os9 F$PrsNam Parse the name | |
2984 ldy <u0063 Get ptr to Intercept routines data mem ($418) | |
2985 leay $0A,y Bump up to $422 | |
2986 sty <u0008 Save ptr to start of current group | |
2987 sty <u0061 ??? Ptr to data modules name? | |
2988 ldx #60 Max size of group | |
2989 stx <u0006 Save it | |
2990 ldx <u0004 Get ptr to module name | |
2991 L14C8 lda ,x+ Copy it to buffer @ $422 | |
2992 sta ,y+ | |
2993 decb | |
2994 bne L14C8 | |
2995 lda #C$CR Append a CR to it | |
2996 sta ,y+ | |
2997 clrb | |
2998 lbra L1564 | |
2999 * Not 6809 object code or data module either | |
3000 L14D7 sty <u000A Save data area size | |
3001 leax >L0013,pc Point to alternate languages table | |
3002 L14DE tst ,x Is this entry active? | |
3003 lbeq L1629 No, exit with non-existing module error | |
3004 cmpa ,x+ Same module type as we want? | |
3005 beq L14EE Yes, skip ahead | |
3006 L14E8 tst ,x+ No, eat module name | |
3007 bpl L14E8 | |
3008 bra L14DE Try next module | |
3009 * Found run-time language match | |
3010 L14EE ldd <u0008 Get ptr to start of current command group | |
3011 subd <u0004 Calculate size of whole group | |
3012 addd <u0006 Don't include size of current group | |
3013 std <u0006 Save remainder size | |
3014 ldd <u0004 Get ptr to start of sub-module | |
3015 std <u0008 Save it | |
3016 pshs y,x Preserve data area size & primary module ptr | |
3017 leax >L0021,pc Point to 'RUNB' | |
3018 cmpx ,s Is that the run-time module we want? | |
3019 bne L1546 No, skip ahead | |
3020 * RUNB needed - have to () & quote/commas between params | |
3021 ldx <u0008 Yes, get sub-module ptr? | |
3022 leay >u0418,u Point to before sub-module | |
3023 bsr L154B Copy buffer up to next param (or end of line) | |
3024 beq L1535 If it was end of line, add CR & continue | |
3025 ldd ,x Get 2 param chars | |
3026 cmpd #$2822 Is it '("' (RUNB variables ahead?) | |
3027 beq L1546 Yes, skip ahead (we won't have to add them) | |
3028 lda #C$SPAC No, add ' ("' | |
3029 sta ,y+ | |
3030 ldd #$2822 | |
3031 std ,y++ | |
3032 L151F bsr L154B Copy buffer up to next param (or end of line) | |
3033 beq L152E If end of line, add '")' (close params) | |
3034 ldd #$222C Add '","' (Basic09 param separators | |
3035 std ,y++ | |
3036 lda #$22 2nd quote of above | |
3037 sta ,y+ | |
3038 bra L151F Keep doing for all parameters | |
3039 | |
3040 L152E ldd #$2229 Add '")' to end parameter list | |
3041 std ,y++ | |
3042 lda #C$CR Add CR | |
3043 L1535 sta ,y+ | |
3044 tfr y,d Move end of param ptr to D | |
3045 leay >u0418,u Point to start of param | |
3046 sty <u0008 Save as start ptr | |
3047 subd <u0008 Calculate param size | |
3048 std <u0006 Save it | |
3049 L1546 puls y,x Restore data area size & primary module ptr | |
3050 lbra L15D5 | |
3051 | |
3052 * Copy from X to Y until either a CR or a space char is hit | |
3053 * If it finds a space, it will eat them until the next non-space char is found | |
3054 L154B lda ,x+ Get char | |
3055 cmpa #C$SPAC Is it a space? | |
3056 * Was L155B | |
3057 beq L1559 yes, skip ahead | |
3058 cmpa #C$CR Is it the end of the line? | |
3059 beq L155F Yes, bump ptr back to CR & exit | |
3060 sta ,y+ Save the char | |
3061 bra L154B Keep doing it | |
3062 | |
3063 L1559 lda ,x+ Get char | |
3064 L155B cmpa #C$SPAC Is it another space? | |
3065 beq L1559 Yes, keep eating spaces | |
3066 L155F leax -$01,x Bump ptr back to either non-space or CR | |
3067 cmpa #C$CR Is it a CR? & return | |
3068 rts | |
3069 | |
3070 * THIS CMPB / LBEQ SEEMS TO BE USELESS, AS B IS ALWAYS CLEAR COMING INTO THIS | |
3071 * ROUTINE | |
3072 L1564 cmpb #E$BMode | |
3073 lbeq L162B | |
3074 ldx <u0006 Get size of current group | |
3075 leax 5,x Bump it up by 5??? | |
3076 stx <u0006 Save new size | |
3077 tst <u0060 Data module linked? | |
3078 bne L1592 Yes, skip ahead | |
3079 ldx <u0004 Get module name ptr | |
3080 ldu 4,s | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3081 lbsr CmdIn Set up paths |
714 | 3082 lbcs L162B If error, exit with it |
3083 bra L1592 Start up shell with '-P X PATH=(current)' | |
3084 | |
3085 * L1581 is for sub-shells (?), L1586 for normal shells | |
3086 L1581 fcc '-P X ' Prompting off/exit on error | |
3087 L1586 fcc 'PATH= ' For inheriting parent shell's paths | |
3088 fcb C$CR | |
3089 | |
3090 L158D leax <L1586,pc Point to 'path=' | |
3091 bra L1595 Skip ahead | |
3092 | |
3093 L1592 leax <L1581,pc Point to '-p x ' | |
3094 L1595 leay >u166D,u Point to about-to-be merged buffer | |
3095 lbsr L1320 Copy up until CR | |
3096 leay -1,y Point to CR | |
3097 leax >u0CDD,u Point to copy of current path= | |
3098 * Copy all paths to buffer, changing <CR> separated ones with Spaces | |
3099 L15A2 lda ,x Get char | |
3100 cmpa #C$CR CR? | |
3101 beq L15B1 Yes, don't copy this buffer | |
3102 lbsr L1320 Copy up until CR | |
3103 lda #C$SPAC Replace CR with Space | |
3104 sta -1,y | |
3105 bra L15A2 Continue copying CR marked blocks until done | |
3106 L15B1 lda #'; Replace final CR with ; (command separator) | |
3107 sta -1,y | |
3108 tst <u0060 | |
3109 beq L15BE | |
3110 ldd #'M*256+'= If flag set, append 'M=' | |
3111 std ,y++ | |
3112 L15BE ldx <u0008 Get ptr to start of current group | |
3113 lbsr L1320 Copy up until CR | |
3114 leax >u166D,u Point to merged buffer again | |
3115 stx <u0008 Make it the new current group start | |
3116 tfr y,d Move end buffer ptr to D | |
3117 pshs x Push merged buffer ptr for SUBD | |
3118 subd ,s++ Calculate size of merged buffer | |
3119 std <u0006 Save merged buffer size | |
3120 leax >L000D,pc Point to 'shell' | |
3121 | |
3122 L15D5 stx <u0004 Save ptr to module name to fork | |
3123 L15D7 ldx <u0004 Get ptr to module name to fork | |
3124 lda #Prgrm+Objct | |
1505 | 3125 IFGT Level-1 |
714 | 3126 os9 F$NMLink Get memory requirement stuff from it |
1505 | 3127 ELSE |
3128 pshs u | |
3129 os9 F$Link Get memory requirement stuff from it | |
3130 tfr u,y | |
3131 puls u | |
3132 ENDC | |
714 | 3133 bcc L15E5 Got it, continue |
1505 | 3134 IFGT Level-1 |
714 | 3135 os9 F$NMLoad Couldn't get, try loading it |
1505 | 3136 ELSE |
3137 pshs u | |
3138 os9 F$Load Couldn't get, try loading it | |
3139 tfr u,y | |
3140 puls u | |
3141 ENDC | |
714 | 3142 bcs L162B Still couldn't get, can't fork |
1505 | 3143 L15E5 |
3144 IFEQ Level-1 | |
3145 ldy M$Mem,y | |
3146 ENDC | |
3147 tst <u0003 Memory size specified? | |
714 | 3148 bne L15F2 Yes, skip ahead |
3149 tfr y,d No, tfr modules mem size to D | |
3150 addd <u000A ??? Add to something | |
3151 addd #$00FF Round up to nearest page | |
3152 sta <u0003 Save # of pages need for data mem | |
3153 L15F2 clr ,-s Clear byte on stack to store original priority | |
3154 ldb <u0022 Get priority we want to set new program at | |
3155 beq DnePrior 0=Use inherited priority, skip ahead | |
1505 | 3156 IFEQ Level-1 |
3157 ldx <D.Proc | |
3158 ELSE | |
714 | 3159 leax >u166D,u Point to place to hold Process descriptor |
3160 os9 F$ID Get our process # | |
3161 os9 F$GPrDsc Get our process descriptor | |
1505 | 3162 ENDC |
714 | 3163 ldb P$Prior,x Get our priority |
3164 stb ,s Save it | |
3165 ldb <u0022 Get priority for new process | |
3166 os9 F$SPrior Set our priority so child will inherit it | |
3167 DnePrior lbsr L130A Go setup Fork entry registers | |
3168 os9 F$Fork Create the new process | |
3169 pshs d,cc Preserve error (if any) & new process # | |
3170 ldb 3,s Get original priority back | |
3171 beq L1609 Priority didn't change, ignore it | |
3172 os9 F$ID Get our process # into A | |
3173 os9 F$SPrior Reset our priority back to normal | |
3174 L1609 lda #Prgrm+Objct Std 6809 module | |
3175 ldx <u0010 Get ptr to some other module name (?) | |
3176 bne L1611 There is one, unlink it instead | |
3177 ldx <u0004 Get ptr to command name | |
1505 | 3178 L1611 |
3179 IFGT Level-1 | |
3180 os9 F$UnLoad Bump link count down back to normal? | |
3181 ELSE | |
3182 pshs a,b,x,y,u | |
3183 os9 F$Link | |
3184 os9 F$Unlink | |
3185 os9 F$Unlink | |
3186 puls a,b,x,y,u | |
3187 ENDC | |
714 | 3188 clra |
3189 clrb | |
3190 std <u0010 Zero out other module name ptr | |
3191 std <u0004 Clear out ptr to main command name | |
3192 lda <u0060 Check if data module needs to be unlinked too | |
3193 cmpa #$01 Just 1 link to it? | |
3194 bne L1627 No, skip ahead | |
3195 lda #Data Data module | |
3196 ldx <u0061 Get ptr to name of data module | |
1505 | 3197 IFGT Level-1 |
714 | 3198 os9 F$UnLoad Bump link count down back to normal |
1505 | 3199 ELSE |
3200 pshs a,b,x,y,u | |
3201 os9 F$Link | |
3202 os9 F$Unlink | |
3203 os9 F$Unlink | |
3204 puls a,b,x,y,u | |
3205 ENDC | |
714 | 3206 L1627 puls cc,d Get back F$FORK error/process # |
3207 leas 1,s Eat priority byte | |
3208 puls pc,u,y,x Restore regs & return | |
3209 | |
3210 L1629 ldb #E$NEMod Non-existing module error | |
3211 L162B coma | |
3212 puls pc,u,y,x | |
3213 | |
3214 L162E fcc '/pipe' | |
3215 fcb C$CR | |
3216 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3217 CmdPIPE pshs x |
714 | 3218 leax <L162E,pc Point to '/pipe' |
3219 ldd #$0103 | |
3220 lbsr L0C0E | |
3221 puls x | |
3222 bcs L169E | |
3223 lbsr L1459 | |
3224 bcs L169E | |
3225 lda ,u | |
3226 bne L1653 | |
3227 os9 I$Dup | |
3228 bcs L169E | |
3229 sta ,u | |
3230 L1653 clra | |
3231 os9 I$Close | |
3232 lda #$01 | |
3233 os9 I$Dup | |
3234 lda #$01 | |
3235 lbsr L0BA8 | |
3236 lda #$02 | |
3237 lbra L0BA8 | |
3238 | |
3239 * Filename for shell log-append mode because of leading '+' | |
3240 L1666 fcc '+/dd/log/uxxx' | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3241 fcb C$CR |
714 | 3242 |
3243 * Make shell logging filename @ u0CBD,u | |
3244 L1674 leax <L1666,pc Point to log name string (append mode) | |
3245 leay >u0CBD,u Point to buffer to hold shell log name | |
3246 lbsr L1320 Copy name to buffer | |
3247 leay -4,y Point to where 1st digit will go | |
3248 lda <u005A+1 Get LSB of user #? | |
3249 pshs y,x,d Preserve regs | |
3250 leay <L1693,pc Point to routine | |
3251 bra L16B9 Go convert digits & append to logname | |
3252 | |
3253 L168A lda <u0047 | |
3254 pshs y,x,d | |
3255 leay <L1693,pc | |
3256 bra L16B9 | |
3257 | |
3258 L1693 ldy $0B,s Get ptr to where shell log # goes | |
3259 ldd $03,s Get 1st 2 digits of # | |
3260 std ,y++ Save in shell log pathname | |
3261 lda $05,s Get last digit | |
3262 sta ,y Save it too | |
3263 L169E rts | |
3264 | |
3265 L169F ldd 4,s Get last 2 digits of process # (ASCII) | |
3266 std >u01EC,u Save it & return | |
3267 rts | |
3268 | |
3269 L16A6 pshs y,x,d Preserve End of parm ctr & others | |
3270 os9 F$ID Get user's ID # | |
3271 sty <u005A Save it | |
3272 leay <L169F,pc Point to routine | |
3273 bra L16B9 | |
3274 | |
3275 * Set up to write out process # when forked? | |
3276 L16B3 pshs y,x,d | |
3277 leay >L021B,pc | |
3278 | |
3279 * Entry: A=Process ID # | |
3280 * Exit: L01EC=2 lower digits of process # in ASCII format | |
3281 | |
3282 L16B9 pshs y,x,b Preserve regs | |
3283 leax 1,s Point X to X value on stack | |
3284 ldb #$2F Init B to start @ '0' in loop | |
3285 L16BF incb Bump ASCII # up | |
3286 suba #100 Start with 100's digit | |
3287 bhs L16BF More left, keep going | |
3288 stb ,x+ Save digit | |
3289 ldb #$3A Init so loop starts @ ASCII '9' | |
3290 L16C8 decb Bump ASCII # down | |
3291 adda #10 Do 10's digit | |
3292 bhs L16C8 Still more, keep going | |
3293 stb ,x+ Save 10's digit | |
3294 adda #$30 Bump 1's digit up to ASCII equivalent | |
3295 ldb #C$CR Add carriage return | |
3296 std ,x Save overtop Y on the stack | |
3297 leax ,s Point X to B on stack | |
3298 jsr ,y | |
3299 leas 5,s Eat stack | |
3300 puls pc,y,x,d Restore other regs & return | |
3301 | |
3302 * KILL command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3303 CmdKill bsr L16EB Go get process # to kill |
714 | 3304 cmpb #2 Trying to kill the system process or 1st shell? |
3305 bls L170A Yes, print 'WHAT?' & ignore it | |
3306 tfr b,a Move process # to proper reg | |
3307 L16E5 clrb S$Kill signal | |
3308 os9 F$Send Send it to the process & return | |
3309 rts | |
3310 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3311 * Clear Screen by writing $0C to stdout |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3312 ClrByte fcb $0C |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3313 ClrLen equ *-ClrByte |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3314 |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3315 CmdCLS |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3316 pshs x |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3317 lda #$01 |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3318 leax ClrByte,pcr |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3319 ldy #ClrLen |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3320 os9 I$Write |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3321 puls x,pc |
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3322 |
714 | 3323 * Set priority - subroutine to calculate binary version of # |
3324 * (used for both process # & priority values) | |
3325 L16EB clrb Initialize # for loop | |
3326 L16EC lda ,x+ This loop will calculate the binary version | |
3327 suba #$30 Of the ASCII # pointed to by X | |
3328 cmpa #9 | |
3329 bhi L16FD | |
3330 pshs a | |
3331 lda #10 | |
3332 mul | |
3333 addb ,s+ | |
3334 bcc L16EC Keep going until overflows past 255 | |
3335 L16FD lda ,-x Get last char done | |
3336 bcs L1708 If #>255, eat RTS & exit with error | |
3337 tst <u0014 If flag is set, return | |
3338 bne L169E | |
3339 tstb Otherwise, check if # is 0 | |
3340 bne L169E No, return | |
3341 L1708 leas 2,s Yes, eat RTS address & exit with error | |
3342 L170A lbra L0BCF Print 'WHAT?' | |
3343 * SETPR routine | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3344 CmdSETPR bsr L16EB Go calculate process # |
714 | 3345 stb <u0021 Save it |
3346 lbsr L0907 Find next field (after commas/spaces) | |
3347 bsr L16EB Go calculate priority (into B) | |
3348 lda <u0021 Get process # | |
3349 os9 F$SPrior Set it's priority & return | |
3350 rts | |
3351 | |
3352 L171C fcc 'pwd: bad name in path' | |
3353 fcb C$CR | |
3354 L1732 fcc '.......................................' | |
3355 L1759 fcc '.' | |
3356 fcb C$CR | |
3357 L175B fcc 'pwd: read error' | |
3358 fcb C$CR | |
3359 | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3360 CmdPWD clr <u003D |
714 | 3361 L176D pshs y,x |
3362 leay >u02F2,u | |
3363 lda #$81 | |
3364 tst <u0037 | |
3365 beq L178F | |
3366 ldx <u0039 | |
3367 bra L17F7 | |
3368 * .PXD command | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3369 CmdPXD clr <u003D |
714 | 3370 pshs y,x |
3371 leay >u0375,u | |
3372 lda #$85 | |
3373 tst <u0038 | |
3374 beq L178F | |
3375 ldx <u003B | |
3376 bra L17F7 | |
3377 L178F sta <u0029 | |
3378 sty <u003E | |
3379 L1794 leax >$0080,y | |
2817
5c6b71612ce4
Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2372
diff
changeset
|
3380 lda #C$CR |
714 | 3381 sta ,x |
3382 stx <u002A | |
3383 leax <L1759,pc | |
3384 stx <u0040 | |
3385 bsr L1801 | |
3386 lbsr L183C | |
3387 L17A9 ldd <u002C | |
3388 std <u0032 | |
3389 lda <u002E | |
3390 sta <u0034 | |
3391 bsr L1828 | |
3392 beq L17D3 | |
3393 lda <u0012 | |
3394 os9 I$Close | |
3395 lbcs L188C | |
3396 ldx <u0040 | |
3397 leax -$01,x | |
3398 stx <u0040 | |
3399 bsr L1801 | |
3400 bsr L183C | |
3401 bsr L1817 | |
3402 leax >u03F8,u | |
3403 lbsr L1859 | |
3404 bra L17A9 | |
3405 L17D3 lda <u0012 | |
3406 ldb #SS.DevNm | |
3407 leax >u00B5,u | |
3408 os9 I$GetStt Get device name | |
3409 bsr L1859 | |
3410 L17E0 lda <u0012 | |
3411 os9 I$Close | |
3412 ldx <u002A | |
3413 lda <u0029 | |
3414 bita #$04 | |
3415 bne L17F3 | |
3416 inc <u0037 | |
3417 stx <u0039 | |
3418 bra L17F7 | |
3419 L17F3 inc <u0038 | |
3420 stx <u003B | |
3421 L17F7 ldy #$0083 | |
3422 lda #$01 | |
3423 clrb | |
3424 lbra L18A0 | |
3425 L1801 lda <u0029 | |
3426 os9 I$Open | |
3427 sta <u0012 | |
3428 rts | |
3429 L1809 lda <u0012 | |
3430 leax >u03F8,u | |
3431 ldy #$0020 | |
3432 os9 I$Read | |
3433 rts | |
3434 L1817 bsr L1809 | |
3435 bcs L1896 | |
3436 leax >u0415,u | |
3437 leay >u0032,u | |
3438 bsr L1830 | |
3439 bne L1817 | |
3440 rts | |
3441 L1828 leax >u002C,u | |
3442 leay >u002F,u | |
3443 L1830 ldd ,x++ | |
3444 cmpd ,y++ | |
3445 bne L183B | |
3446 lda ,x | |
3447 cmpa ,y | |
3448 L183B rts | |
3449 L183C bsr L1809 | |
3450 ldd >u0415,u | |
3451 std <u002F | |
3452 lda >u0417,u | |
3453 sta <u0031 | |
3454 bsr L1809 | |
3455 ldd >u0415,u | |
3456 std <u002C | |
3457 lda >u0417,u | |
3458 sta <u002E | |
3459 rts | |
3460 L1859 os9 F$PrsNam | |
3461 bcs L1890 | |
3462 ldx <u002A | |
3463 pshs b | |
3464 incb | |
3465 clra | |
3466 std <u0032 | |
3467 tfr x,d | |
3468 subd <u0032 | |
3469 cmpd <u003E | |
3470 bls L1881 | |
3471 puls b | |
3472 L1871 lda ,-y | |
3473 anda #$7F | |
3474 sta ,-x | |
3475 decb | |
3476 bne L1871 | |
3477 lda #$2F | |
3478 sta ,-x | |
3479 stx <u002A | |
3480 rts | |
3481 | |
3482 L1881 lda #'* | |
3483 sta ,-x | |
3484 stx <u002A | |
3485 leas 3,s | |
3486 lbra L17E0 | |
3487 | |
3488 L188C pshs b,cc | |
3489 bra L18AB | |
3490 | |
3491 L1890 leax >L171C,pc | |
3492 bra L189A | |
3493 | |
3494 L1896 leax >L175B,pc | |
3495 L189A leas $02,s | |
3496 ldd #$02FF | |
3497 L18A0 stx <u002A | |
3498 pshs b,cc | |
3499 tst <u003D | |
3500 bne L18AB | |
3501 os9 I$WritLn | |
3502 L18AB puls b,cc | |
3503 puls y,x,pc | |
3504 | |
3505 L18DB leax >u0124,u Point to PD.OPT work copy area | |
3506 clrb Change to CLRB | |
3507 os9 I$GetStt Get current PD.OPT settings | |
3508 tst ,x Check device type | |
3509 bne L1914 If not SCF, don't bother changing stuff | |
3510 inc >u1812,u Set flag that we are changing key defs | |
3511 ldd <$10,x Get PD.INT & PD.QUT chars (<CTRL>-<C> & <E>) | |
3512 sta >u180F,u Save copy of PD.INT | |
3513 stb >u180E,u Save copy of PD.QUT | |
3514 ldd #$0A0C Reload with up & down arrows | |
3515 std <$10,x Save 'em | |
3516 lda $06,x Get PD.NUL count (normally 0) | |
3517 sta >u1811,u Save copy | |
3518 lda #$05 Replace with 5 | |
3519 sta $06,x | |
3520 clra | |
3521 clrb Reset path options to new settings | |
3522 os9 I$SetStt Do SS.OPT Setstat | |
3523 | |
3524 * Non-SCF devices go here (ex. a script file would be RBF) | |
3525 L1914 ldb #SS.SSig Send signal on data ready | |
3526 ldx #$000B Signal code to send is $B | |
3527 rts Do SetStt, clear <E signal copy, and go to L191C | |
3528 | |
3529 * X still is $B from L1914 | |
3530 * Called when F$Sleep @ L0171 is interrupted by keyboard/mouse signal | |
3531 L191C ldb <u000E Get Signal code | |
3532 clr <u000E Clear memory copy of signal code | |
3533 cmpb #S$Abort Keyboard abort signal (<CTRL>-<E>)? | |
3534 bne L1928 No, check next | |
3535 bsr L1932 Write CR out if no history yet | |
3536 bra L1967 Go backwards in history | |
3537 | |
3538 L1928 cmpb #S$Intrpt Keyboard interrupt signal (<CTRL>-<C>)? | |
3539 lbne L017B No check for $B signal (ignore rest) | |
3540 bsr L1932 Write CR out if no history yet | |
3541 bra L1991 Go forwards in history | |
3542 | |
3543 * Keyboard abort or Keyboard interrupt signal | |
3544 L1932 tst >u180D,u Any history entries yet? | |
3545 bne L193D Yes, exit | |
3546 bsr L1959 Otherwise, put CR into the buffer | |
3547 os9 I$WritLn Write it out to standard out | |
3548 L193D rts | |
3549 | |
3550 L193E os9 I$ReadLn Read in line | |
3551 bcc L194E No error, skip ahead | |
3552 * NOTE: WHEN THE ABORT A SUB-FORKED PROGRAM BUG OCCURS, THE ABOVE READLN | |
3553 * EXITS WITH CARRY SET & B=0 (ERROR 0) | |
3554 cmpb #$02 Go backward in history buffer signal? | |
3555 beq L1967 Yes, go process | |
3556 cmpb #$03 Go forward in history buffer signal? | |
3557 beq L1991 Yes, go process | |
3558 lbra L1AAA Go to parse routine with unknown error in B | |
3559 L194E cmpy #$0001 Just 1 char. read? | |
3560 lbeq L1AA3 Yes, go do normal parsing (no error) | |
3561 lbra L1A37 Otherwise, change chars <$0D to spaces | |
3562 | |
3563 * Change A to be standard output??? | |
3564 L1959 lda #C$CR Carriage return | |
3565 leax >u0124,u ??? Point to a buffer | |
3566 sta ,x Save CR there | |
3567 clra Prepare to write the CR out to standard input | |
3568 ldy #$0001 | |
3569 rts | |
3570 * PD.QUT (redefined to be go back 1 in history buffer) | |
3571 L1967 tst >u180C,u Any lines in history buffer? | |
3572 bne L1972 Yes, go move between them | |
3573 bsr L1959 Otherwise, put CR into buffer | |
3574 lbra L1AA3 Go to normal command parse routine (no error) | |
3575 | |
3576 L1972 ldb >u180D,u Get 'current' history buffer entry # | |
3577 cmpb #$01 On the first one? | |
3578 bls L1987 Yes, go wrap to end | |
3579 cmpb >u180C,u Somehow point past last one? | |
3580 bhi L1987 Yes, bump back to last one | |
3581 decb Bump to previous one | |
3582 stb >u180D,u Save it as 'current' history entry # | |
3583 bra L19B3 | |
3584 | |
3585 L1987 ldb >u180C,u Get highest history entry # | |
3586 stb >u180D,u Make it the current | |
3587 bra L19B3 | |
3588 | |
3589 * PD.INT (redefined to be go forward 1 in history buffer) | |
3590 L1991 tst >u180C,u Any lines in history buffer? | |
3591 bne L199C Yes, go move between them | |
3592 bsr L1959 Otherwise, put CR into buffer | |
3593 lbra L1AA3 Go to normal command parse routine (no error) | |
3594 | |
3595 L199C ldb >u180D,u Get current history entry # | |
3596 cmpb >u180C,u Higher or same as last one? | |
3597 bhs L19AD Yes, wrap to beginning | |
3598 incb Bump to next one | |
3599 stb >u180D,u Save it as 'current' history entry # | |
3600 bra L19B3 | |
3601 | |
3602 L19AD ldb #$01 Set history entry # to 1st one | |
3603 stb >u180D,u Save as 'current' entry # | |
3604 L19B3 bsr L19D3 Go get ptr to history entry buffer we want | |
3605 sty >u1813,u Save 'current' history buffer ptr | |
3606 leax >u0213,u Point to expanded shell prompt | |
3607 ldy >u01F7,u Get size of expanded shell prompt | |
3608 lda #$02 Std Err | |
3609 os9 I$WritLn Write out shell prompt | |
3610 bsr L19EA Go Pre-load Read buffer with history entry | |
3611 bcc L1A0E No error, continue | |
3612 lbra L1AAA Normal parse with error | |
3613 | |
3614 * Find history entry # we want | |
3615 * Entry: B=history entry # (1-xx) | |
3616 * Exit: Y=Ptr to history buffer entry we wanted | |
3617 L19D3 ldy >u180A,u Get ptr to start of history buffers | |
3618 L19D8 decb Bump down counter to find entry we want | |
3619 beq L19E9 Found it, skip ahead | |
3620 L19DB tst ,y+ Wrong one, search for end of one we are checking | |
3621 beq L19E4 Found it, skip ahead | |
3622 lbsr L1A97 Wrap buffer ptr if we hit end of all history | |
3623 bra L19DB Keep searching for end of current entry | |
3624 | |
3625 L19E4 lbsr L1A97 Wrap buffer ptr if we hit end of all history | |
3626 bra L19D8 Go into next entry in history buffers | |
3627 | |
3628 L19E9 rts Found it, leave | |
3629 | |
3630 L19EA leax >u0124,u Point to temp buffer | |
3631 ldy >u1813,u Get ptr to current history buffer | |
3632 clrb Set counter to 0 (size of buffer) | |
3633 L19F4 lda ,y+ Get char from history buffer | |
3634 beq L1A00 Found end, continue | |
3635 sta ,x+ Put it in temp buffer | |
3636 incb Bump up size counter | |
3637 lbsr L1A97 Wrap buffer ptr if we hit end of all history | |
3638 bra L19F4 Continue copying into temp buffer | |
3639 L1A00 clra D=Size of history buffer | |
3640 decb | |
3641 tfr d,y Move to proper register | |
3642 leax >u0124,u Point to buffer history copy | |
3643 ldb #SS.Fill Fill it with current selected history command | |
3644 os9 I$SetStt | |
3645 rts | |
3646 | |
3647 * Successfull SS.Fill of history buffer goes here | |
3648 L1A0E lda #$01 Write copy of history buffer to std out | |
3649 os9 I$Write | |
3650 leax >u0124,u Point to current history buffer again | |
3651 tfr y,d Transfer # bytes written to D | |
3652 lda #C$BSP Backspace char | |
3653 L1A1B sta ,x+ Fill buffer with backspaces | |
3654 decb | |
3655 bne L1A1B | |
3656 leax >u0124,u Write them to reset cursor to start of line | |
3657 lda #$01 | |
3658 os9 I$Write | |
3659 ldd #SS.Relea Eat keyboard signal (SS.Fill cleared it out of | |
3660 os9 I$SetStt the read buffer already) | |
3661 ldb #SS.SSig Setup for re-enabling it | |
3662 ldx #$000B Signal Code to send on keypress=$B | |
3663 lbra L016A Go re-enable signal send on keyboard/mouse input | |
3664 | |
3665 * Put new entry into history buffers, adjusting # used, etc.) | |
3666 * Entry: Y=# bytes read in ReadLn <>1 | |
3667 L1A37 pshs y Preserve # bytes read | |
3668 tfr y,d Move to D reg | |
3669 ldy >u1808,u Get ptr to where next history entry will go | |
3670 leax >u0124,u Point to line entered by user | |
3671 L1A44 lda ,x+ Get char | |
3672 cmpa #C$CR Control char <$0d? | |
3673 bhs L1A4C No, save the character | |
3674 lda #C$SPAC Replace with space char if it is | |
3675 L1A4C sta ,y+ Save char into history buffer | |
3676 bsr L1A97 Wrap to beginning if we hit end | |
3677 cmpy >u180A,u Point to entry #1? | |
3678 bne L1A59 No, continue | |
3679 bsr L1A7B Yes, make new #1 entry & drop # of entries | |
3680 L1A59 decb Drop # bytes left in new entry | |
3681 bne L1A44 Not done, continue | |
3682 clr ,y+ mark end with NUL | |
3683 bsr L1A97 Wrap to beginning if at end | |
3684 cmpy >u180A,u Pointing to entry #1? | |
3685 bne L1A69 No, skip ahead | |
3686 bsr L1A7B Yes, make new #1 entry & drop # of entries | |
3687 L1A69 inc >u180C,u Increase # of entries | |
3688 sty >u1808,u Save ptr to where next history entry will go | |
3689 puls y Restore # bytes read | |
3690 clra Point to temp buffer again | |
3691 leax >u0124,u | |
3692 bra L1AA3 Normal parse, no error | |
3693 | |
3694 * Reset ptr to new 1st entry in history buffer | |
3695 L1A7B pshs y Preserve current location in history buffer | |
3696 ldy >u180A,u Point to start of 1st entry | |
3697 L1A82 tst ,y+ End of current entry? | |
3698 beq L1A8A Yes, skip ahead | |
3699 bsr L1A97 No, wrap if we need to | |
3700 bra L1A82 Keep going until we find end | |
3701 L1A8A bsr L1A97 Wrap if we need to | |
3702 dec >u180C,u Dec # lines in history buffer | |
3703 sty >u180A,u Save new 'start of history' ptr | |
3704 puls pc,y Restore current location & return | |
3705 * If we are at end of history buffers, wrap to beginning (raw, has nothing to | |
3706 * do with entry #'s) | |
3707 L1A97 cmpy >u1806,u Are we at end of buffer for history entries? | |
3708 bne L1AA2 No, continue on | |
3709 leay >u1815,u Yes, reset to beginning of history buffers | |
3710 L1AA2 rts | |
3711 | |
3712 L1AA3 bsr L1AB1 Reset std paths to normal <CTRL>-<E>/<C> settings | |
3713 andcc #^Carry No error | |
3714 lbra L018B Normal command processing | |
3715 | |
3716 L1AAA bsr L1AB1 Reset std paths to normal <CTRL>-<E>/<C> settings | |
3717 orcc #Carry Error | |
3718 lbra L018B Normal command processing | |
3719 | |
3720 * Reset all 3 standard paths' NUL counts/Keyboard Interrupt/Terminate settings | |
3721 L1AB1 pshs x,d Preserve regs | |
3722 tst >u1812,u Check flag | |
3723 beq L1AD6 If 0 skip ahead | |
3724 leas <-PD.OPT,s Make 32 byte buffer on stack | |
3725 leax ,s Point X to buffer | |
3726 clrb CHANGE TO CLRB | |
3727 clra Standard input path | |
3728 bsr L1AD8 Restore NUL counts, Keyboard Intrpt/Terminate | |
3729 lda #$01 Do same for Standard output path | |
3730 bsr L1AD8 | |
3731 lda #$02 Do same for Standard Error path | |
3732 bsr L1AD8 | |
3733 leas <PD.OPT,s Eat stack buffer | |
3734 clr >u1812,u Reset PD.OPT flags to 0 | |
3735 clr >u180D,u | |
3736 L1AD6 puls pc,x,d Restore regs & return | |
3737 | |
3738 * Restore path options to preserved Keyboard terminate/interrupt & end of | |
3739 * line NUL counts | |
3740 L1AD8 pshs a Preserve path # | |
3741 os9 I$GetStt Get current PD.OPT settings | |
3742 lda >u180E,u Get copy of Keyboard terminate char | |
3743 sta <PD.QUT-PD.OPT,x Save into buffered copy | |
3744 lda >u180F,u Get copy of Keyboard interrupt char | |
3745 sta <PD.INT-PD.OPT,x Save into buffered copy | |
3746 lda >u1811,u Get copy of end of line NUL count | |
3747 sta $6,x Save into buffered copy | |
3748 puls a Get path # back | |
3749 os9 I$SetStt Reset path options with restored values & return | |
3750 rts | |
3751 | |
3752 emod | |
3753 eom equ * | |
3754 end | |
3755 |