Mercurial > hg > Members > kono > nitros9-code
annotate docs/nitros9guide/chap2.chapter @ 603:e9578f62b346
All refentries finished.
author | roug |
---|---|
date | Fri, 15 Nov 2002 21:49:51 +0000 |
parents | 525b12e17d60 |
children | cc153d1671f7 |
rev | line source |
---|---|
144 | 1 <chapter> |
2 <title>Basic Interactive Functions</title> | |
3 | |
4 <section> | |
5 <title>Running Commands and Basic Shell Operation</title> | |
6 <para> | |
7 The "shell" is a the part of OS-9 that accepts commands from your | |
8 keyboard. It was designed to provide a convenient, flexible, and | |
9 easy-to-use interface between you and the powerful functions of the | |
10 operating system. The shell is automatically entered after OS-9 is | |
11 started up. You can tell when the shell is waiting for input | |
12 because it displays the "OS9:" prompt. This prompt indicates that | |
13 the shell is active and awaiting a command from your keyboard. It | |
14 makes no difference whether you use upper-case letters, lower-case | |
15 letters, or a combination of both because OS-9 matches letters of | |
16 either case. | |
17 </para> | |
18 <para> | |
19 The command line always begins with a name of a program which can | |
20 be: | |
21 </para> | |
22 | |
23 <itemizedlist> | |
24 <listitem><para>The name of a machine language program on disk</para></listitem> | |
25 <listitem><para>The name of a machine language program already in memory</para></listitem> | |
26 <listitem><para>The name of an executable program compiled by a high-level | |
27 language such as Basic09, Pascal, Cobol, etc. (See 4.8)</para></listitem> | |
28 <listitem><para>The name of a procedure file (See 4.6)</para></listitem> | |
29 </itemizedlist> | |
30 <para> | |
31 If you're a beginner, you will almost always use the first case, | |
32 which causes the program to be automatically loaded from the CMDS | |
33 directory and run. | |
34 </para> | |
35 <para> | |
36 When processing the command line, the shell searches for a | |
37 program having the name specified in the following sequence: | |
38 </para> | |
39 | |
40 <orderedlist numeration="arabic"> | |
41 | |
42 <listitem><para>- If the program named is already in memory, it is run.</para></listitem> | |
43 | |
44 <listitem><para>- The "execution directory", usually "CMDS", is searched. | |
45 If a file having the name given is found, it is loaded and | |
46 run (See 5.4.1).</para></listitem> | |
47 | |
48 <listitem><para>- The user's "data directory" is searched. If a file having | |
49 the name given is found, it is processed as a "procedure | |
50 file" which means that the file is assumed to contain one | |
51 or more command lines which are processed by the shell in | |
52 the same manner as if they had manually typed in one by one.</para></listitem> | |
53 | |
54 </orderedlist> | |
55 <para> | |
56 Mention is made above of the "data directory" and the "execution | |
57 directory". At all times each user is associated with two file | |
58 directories. A more detailed explanation of directories is presented | |
59 in section 3.3. The execution directory (usually CMDS) includes | |
60 files which are executable programs. | |
61 </para> | |
62 <para> | |
63 The name given in the command line may be optionally followed by | |
64 one or more "parameters" which are passed to the program called by | |
65 the shell. | |
66 </para> | |
67 <para> | |
68 For example, in the command line: | |
69 </para> | |
70 <screen> | |
71 LIST FILE1 | |
72 </screen> | |
73 <para> | |
74 the program name is LIST, and the parameter passed to it is FILE1. | |
75 </para> | |
76 <para> | |
77 A command line may also include one or more "modifiers" which are | |
78 specifications used by the shell to alter the program's standard | |
79 input/output files or memory assignments (See 4.2). | |
80 | |
81 | |
82 </para> | |
83 <section> | |
84 <title>Sending Output to the Printer</title> | |
85 <para> | |
86 Normally, most commands and programs display output on the Color | |
87 Computer video display. The output of these programs can | |
88 alternatively be printed by specifying output redirection on the | |
89 command line. This is done by including the following modifier to | |
90 at the end of any command line: | |
91 </para> | |
92 <screen> | |
93 >/P | |
94 </screen> | |
95 <para> | |
96 The ">" character tells the shell to redirect output (See 4.3.2) to | |
148
525b12e17d60
Made the word "Dragon" an entity, thereby making it replacable with "Color"
roug
parents:
144
diff
changeset
|
97 the printer using the &make; Computer's parallel port, which has the device |
144 | 98 name "/P" (See 3.2). For example, to redirect the output of the |
99 "dir" command to the printer, enter: | |
100 </para> | |
101 <screen> | |
102 DIR >/P | |
103 </screen> | |
104 <para> | |
105 The "xmode" command can be used to set the printer port's | |
106 operating mode such as auto line feed, etc. For example, to examine | |
107 the printer's current settings, type: | |
108 </para> | |
109 <screen> | |
110 xmode /P | |
111 </screen> | |
112 <para> | |
113 To change any of these type XMODE followed by the new value. | |
114 For example, to set the printer port for automatic line feeds at the | |
115 end of every line, enter: | |
116 </para> | |
117 <screen> | |
118 xmode /P lf; | |
119 </screen> | |
120 </section> | |
121 </section> | |
122 | |
123 <section> | |
124 <title>Shell Command Line Parameters</title> | |
125 <para> | |
126 Parameters are generally used to either specify file name(s) or | |
127 to select options to be used by the program specified in the command | |
128 line given to the shell. Parameters are separated from the command | |
129 name and from each other by space characters (hence parameters and | |
130 options cannot themselves include spaces). Each command program | |
131 supplied with OS-9 has an individual description in the last section | |
132 of this manual which describe the correct usage of the parameters of | |
133 each command. | |
134 </para> | |
135 <para> | |
136 For example, the LIST program is used to display the contents of | |
137 a text file on your display. It is necessary to tell to the LIST | |
138 program which file it is to be displayed, therefore, the name of the | |
139 desired file is given as a parameter in the command line. For | |
140 example, to list the file called startup (the system initialization | |
141 procedure file), you enter the command line: | |
142 </para> | |
143 <screen> | |
144 LIST STARTUP | |
145 </screen> | |
146 <para> | |
147 Some commands have two parameters. For example, the COPY command is | |
148 used to make an exact copy of a file. It requires two parameters: | |
149 The name of the file to be copied and the name of the file which is | |
150 to be the copy, for example: | |
151 </para> | |
152 <screen> | |
153 COPY STARTUP NEWSTARTUP | |
154 </screen> | |
155 <para> | |
156 Other commands have parameters which select options. For example: | |
157 </para> | |
158 <screen> | |
159 DIR | |
160 </screen> | |
161 <para> | |
162 shows the names of the files in the user's data directory. Normally | |
163 it simply lists the file names only, but if the "E" | |
164 (for <emphasis>e</emphasis>ntire) | |
165 option is given, it will also give complete statistics for each file | |
166 such as the date and time created, size, security codes, etc. To do | |
167 so enter: | |
168 </para> | |
169 <screen> | |
170 DIR E | |
171 </screen> | |
172 <para> | |
173 The DIR command also can accept a file name as a parameter which | |
174 specifies a directory file other than the (default) data directory. | |
175 For example, to list file names in the directory sys , type: | |
176 </para> | |
177 <screen> | |
178 DIR SYS | |
179 </screen> | |
180 <para> | |
181 It is also possible to specify both a directory name parameter and | |
182 the e option, such as: | |
183 </para> | |
184 <screen> | |
185 DIR SYS E | |
186 </screen> | |
187 <para> | |
188 giving file names and complete statistics (See example in 3.8.1). | |
189 </para> | |
190 </section> | |
191 | |
192 <section> | |
193 <title>Some Common Command Formats</title> | |
194 <para> | |
195 This section is a summary of some commands commonly used by new | |
196 or casual OS-9 users, and some common formats. Each command is | |
197 followed by an example. Refer to the individual command | |
198 descriptions in Section 8 for more detailed information and | |
199 additional examples. Parameters or options shown in brackets are | |
200 optional. Whenever a command references a directory file name, the | |
201 file <emphasis>must</emphasis> be a directory file. | |
202 | |
203 <screen> | |
204 CHD filename chd DATA.DIR | |
205 </screen> | |
206 Changes the current <emphasis>data</emphasis> working directory to | |
207 the <emphasis>directory</emphasis> file specified. | |
208 <screen> | |
209 COPY filename1 filename2 copy oldfile newfile | |
210 </screen> | |
211 Creates filename2 as a new file, then copies all data from | |
212 "filename1" to it. "filename1" is not affected. | |
213 <screen> | |
214 DEL filename del oldstuff | |
215 </screen> | |
216 Deletes (destroys) the file specified. | |
217 <screen> | |
218 DIR [filename] [e] [x] dir myfiles e | |
219 </screen> | |
220 List names of files contained in a directory. If the "x" option is | |
221 used the files in the current <emphasis>execution</emphasis> | |
222 directory are listed, | |
223 othervise, if no directory name is given, the current | |
224 <emphasis>data</emphasis> directory will be listed. | |
225 The "e" option selects the long format | |
226 which shows detailed information about each file. | |
227 <screen> | |
228 FREE devicename free /d1 | |
229 </screen> | |
230 Shows how much free space remains on the disk whose name is given. | |
231 <screen> | |
232 LIST filename list script | |
233 </screen> | |
234 Displays the (text) contents of the file on the terminal. | |
235 <screen> | |
236 MAKDIR filename makdir NEWFILES | |
237 </screen> | |
238 Creates a new directory file using the name given. Often followed | |
239 by a "chd" command to make it the new working data directory. | |
240 <screen> | |
241 RENAME filename1 filename2 rename zip zap | |
242 </screen> | |
243 Changes the name of filename1 to filename2. | |
244 </para> | |
245 </section> | |
246 | |
247 <section> | |
248 <title>Using the Keyboard and Video Display</title> | |
249 <para> | |
148
525b12e17d60
Made the word "Dragon" an entity, thereby making it replacable with "Color"
roug
parents:
144
diff
changeset
|
250 OS-9 has many features to expand the capability of the &make; |
144 | 251 keyboard and video display. The video display has screen pause, |
252 upper/lower case, and graphics functions. The keyboard can generate | |
253 all ASCII characters and has a type-ahead feature that permits you | |
254 to enter data before requested by a program (except if the disk is | |
255 running because interrupts are temporarily disabled). Appendix C of | |
256 this manual is a list of the characters and codes that can be | |
257 generated from the keyboard. The keyboard/video display can be used | |
258 as a file known by the name "/TERM". | |
259 </para> | |
260 | |
261 <section> | |
262 <title>Video Display Functions</title> | |
263 <para> | |
148
525b12e17d60
Made the word "Dragon" an entity, thereby making it replacable with "Color"
roug
parents:
144
diff
changeset
|
264 The &make; Computer uses reverse video (green letters in a black box) to |
144 | 265 represent lower-case letters. Normally they are not used, so you |
266 have to turn them on if you want to use them with the command: | |
267 </para> | |
268 <screen> | |
269 TMODE -UPC | |
270 </screen> | |
271 <para> | |
272 The screen pause feature stops programs after 16 lines have been | |
273 displayed. Output will continue if you hit any key. Normally this | |
274 feature is on. It can be turned on or off with the TMODE command as | |
275 follows: | |
276 </para> | |
277 <screen> | |
278 TMODE -PAUSE turns pause mode off | |
279 TMODE PAUSE turns pause mode on | |
280 </screen> | |
281 <para> | |
282 The display system also has a complete set of commands to emulate | |
283 commercial data terminals, plus a complete set of graphics commands. | |
284 These are described in detail in Appendix D. | |
285 </para> | |
286 </section> | |
287 | |
288 <section> | |
289 <title>Keyboard Shift and Control Functions</title> | |
290 <para> | |
291 Two keys are used in combination with other keys to change their | |
292 meaning. The SHIFT KEY selects between upper case and lower case | |
293 letters or punctuation, and the CLEAR key can be used to generate | |
294 control characters . | |
295 </para> | |
296 <para> | |
297 The keyboard has a shift lock function similar to a typewriter's, | |
298 which is normally "locked". The keyboard's shift lock may be | |
299 reversed by depressing the control key (CLEAR) and 0 keys | |
300 simultaneously. The shift lock only affects the letter (A-Z) keys. | |
301 When the keyboard is locked, these keys generate upper case letters, | |
302 and lower case only if the SHIFT key is depressed. When the | |
303 keyboard is unlocked, the reverse is true, e.g., lower case letters | |
304 are generated unless the SHIFT key is depressed at the same time as | |
305 a letter key. | |
306 </para> | |
307 </section> | |
308 | |
309 <section> | |
310 <title>Control Key Functions</title> | |
311 <para> | |
312 There are a number of useful control functions that can be | |
313 generated from the keyboard. Many of these functions use "control | |
314 keys" which are generated by simultaneously depressing the CLEAR key | |
315 plus some other key. For example, to generate the character for | |
316 CONTROL D press the CLEAR and D keys at the same time. | |
317 </para> | |
318 <variablelist> | |
319 <varlistentry> | |
320 <term>CONTROL A</term> | |
321 <listitem> | |
322 <para> | |
323 Repeat previous input line. The last line entered will be redisplayed but | |
324 <emphasis>not</emphasis> processed, with the cursor positioned at the end of | |
325 the line. You may hit return to enter the line, or edit the line by | |
326 backspacing, typing over characters to correct them, and entering | |
327 control A again to redisplay the edited line. | |
328 </para> | |
329 </listitem> | |
330 </varlistentry> | |
331 <varlistentry> | |
332 <term>CONTROL D</term> | |
333 <listitem> | |
334 <para> | |
335 Redisplay present input on next line. | |
336 </para> | |
337 </listitem> | |
338 </varlistentry> | |
339 <varlistentry> | |
340 <term>CONTROL W</term> | |
341 <listitem> | |
342 <para> | |
343 Display Wait - This will temporarily halt output to the display so | |
344 the screen can be read before the data scrolls off. Output is | |
345 resumed when any other key is hit. | |
346 </para> | |
347 </listitem> | |
348 </varlistentry> | |
349 <varlistentry> | |
350 <term>CONTROL 0</term> | |
351 <listitem> | |
352 <para> | |
353 Shift lock. Reverses present shift lock state. | |
354 </para> | |
355 </listitem> | |
356 </varlistentry> | |
357 <varlistentry> | |
358 <term>BREAK KEY (or CONTROL E)</term> | |
359 <listitem> | |
360 <para> | |
361 Program abort - Stops the current running program | |
362 </para> | |
363 </listitem> | |
364 </varlistentry> | |
365 <varlistentry> | |
366 <term>SHIFT BREAK KEY (or CONTROL C)</term> | |
367 <listitem> | |
368 <para> | |
369 Interrupt - Reactivates Shell while keeping program running as | |
370 background task. | |
371 </para> | |
372 </listitem> | |
373 </varlistentry> | |
374 <varlistentry> | |
375 <term>CONTROL BREAK KEY (ESCAPE)</term> | |
376 <listitem> | |
377 <para> | |
378 End-of-File - This key is used to send an end-of-file to programs | |
379 that read input from the terminal in place of a disk or tape file. | |
380 It must be the first character on the line in order for it to be | |
381 recognized. | |
382 </para> | |
383 </listitem> | |
384 </varlistentry> | |
385 <varlistentry> | |
386 <term>LEFT ARROW (OR CONTROL H)</term> | |
387 <listitem> | |
388 <para> | |
389 Backspace - erase previous character | |
390 </para> | |
391 </listitem> | |
392 </varlistentry> | |
393 <varlistentry> | |
394 <term>SHIFT LEFT ARROW (or CONTROL X)</term> | |
395 <listitem> | |
396 <para> | |
397 Line Delete - erases the entire current line. | |
398 </para> | |
399 </listitem> | |
400 </varlistentry> | |
401 </variablelist> | |
402 </section> | |
403 </section> | |
404 | |
405 </chapter> |