view docs/nitros9guide/chap2.chapter @ 2168:fbfc56b826bf

Makin' changines
author boisy
date Sat, 24 May 2008 12:52:17 +0000
parents b00cf13c9f61
children
line wrap: on
line source

<chapter>
<title>Basic Interactive Functions</title>

<section id="sec2.0">
<title>Running Commands and Basic Shell Operation</title>
<para>
The <command>shell</command> is a the part of NitrOS-9 that accepts commands from your
keyboard. It was designed to provide a convenient, flexible, and
easy-to-use interface between you and the powerful functions of the
operating system. The shell is automatically entered after NitrOS-9 is
started up. You can tell when the shell is waiting for input
because it displays the shell prompt. This prompt indicates that
the shell is active and awaiting a command from your keyboard. It
makes no difference whether you use upper-case letters, lower-case
letters, or a combination of both because NitrOS-9 matches letters of
either case.
</para>
<para>
The command line always begins with a name of a program which can
be:
</para>

<itemizedlist>
<listitem><para>The name of a machine language program on disk</para></listitem>
<listitem><para>The name of a machine language program already in memory</para></listitem>
<listitem><para>The name of an executable program compiled by a high-level
language such as Basic09, Pascal, Cobol, etc.</para></listitem>
<listitem><para>The name of a procedure file</para></listitem>
</itemizedlist>
<para>
If you're a beginner, you will almost always use the first case,
which causes the program to be automatically loaded from the
<filename class="directory">CMDS</filename> directory and run.
</para>
<para>
When processing the command line, the shell searches for a
program having the name specified in the following sequence:
</para>

<orderedlist  numeration="arabic">

<listitem><para> If the program named is already in memory, it is run.</para></listitem>

<listitem><para> The &quot;execution directory&quot;, usually <filename class="directory">CMDS</filename>, is searched.
If a file having the name given is found, it is loaded and
run.</para></listitem>

<listitem><para> The user's &quot;data directory&quot; is searched. If a file having
the name given is found, it is processed as a &quot;procedure
file&quot; which means that the file is assumed to contain one
or more command lines which are processed by the shell in
the same manner as if they had manually typed in one by one.</para></listitem>

</orderedlist>
<para>
Mention is made above of the &quot;data directory&quot; and the &quot;execution
directory&quot;. At all times each user is associated with two file
directories. A more detailed explanation of directories is presented
later. The execution directory (usually <filename class="directory">CMDS</filename>) includes
files which are executable programs.
</para>
<para>
The name given in the command line may be optionally followed by
one or more &quot;parameters&quot; which are passed to the program called by
the shell.
</para>
<para>
For example, in the command line:
</para>
<screen>
list file1
</screen>
<para>
the program name is <command>list</command>, and the parameter passed to it is FILE1.
</para>
<para>
A command line may also include one or more &quot;modifiers&quot; which are
specifications used by the shell to alter the program's standard
input/output files or memory assignments.


</para>
<section id="sec2.0.1">
<title>Sending Output to the Printer</title>
<para>
Normally, most commands and programs display output on the Color Computer video display. The output of these programs can
alternatively be printed by specifying output redirection on the
command line. This is done by including the following modifier to
at the end of any command line:
</para>
<screen>
&gt;/p
</screen>
<para>
The &quot;&gt;&quot; character tells the shell to redirect output (See <xref linkend="sec4.3.2"/>) to
the printer using the Color Computer's printer port, which has the device
name &quot;/p&quot; (See <xref linkend="sec3.2"/>). For example, to redirect the output of the
<command>dir</command> command to the printer, enter:
</para>
<screen>
dir &gt;/p
</screen>
<para>
The <command>xmode</command> command can be used to set the printer port's
operating mode such as auto line feed, etc. For example, to examine
the printer's current settings, type:
</para>
<screen>
xmode /p
</screen>
<para>
To change any of these type XMODE  followed by the new value.
For example, to set the printer port for automatic line feeds at the
end of every line, enter:
</para>
<screen>
xmode /p lf
</screen>
</section>
</section>

<section id="sec2.1">
<title>Shell Command Line Parameters</title>
<para>
Parameters are generally used to either specify file name(s) or
to select options to be used by the program specified in the command
line given to the shell. Parameters are separated from the command
name and from each other by space characters (hence parameters and
options cannot themselves include spaces). Each command program
supplied with NitrOS-9 has an individual description in the last section
of this manual which describe the correct usage of the parameters of
each command.
</para>
<para>
For example, the <command>list</command> program is used to display the contents of
a text file on your display. It is necessary to tell to the <command>list</command>
program which file it is to be displayed, therefore, the name of the
desired file is given as a parameter in the command line. For
example, to list the file called startup  (the system initialization
procedure file), you enter the command line:
</para>
<screen>
list startup
</screen>
<para>
Some commands have two parameters. For example, the <command>copy</command> command is
used to make an exact copy of a file. It requires two parameters:
The name of the file to be copied and the name of the file which is
to be the copy, for example:
</para>
<screen>
copy startup newstartup
</screen>
<para>
Other commands have parameters which select options. For example:
</para>
<screen>
dir
</screen>
<para>
shows the names of the files in the user's data directory. Normally
it simply lists the file names only, but if the &quot;-e&quot;
(for <emphasis>e</emphasis>ntire)
option is given, it will also give complete statistics for each file
such as the date and time created, size, security codes, etc. To do
so enter:
</para>
<screen>
dir -e
</screen>
<para>
The <command>dir</command> command also can accept a file name as a parameter which
specifies a directory file other than the (default) data directory.
For example, to list file names in the directory sys , type:
</para>
<screen>
dir sys
</screen>
<para>
It is also possible to specify both a directory name parameter and
the -e option, such as:
</para>
<screen>
dir sys -e
</screen>
<para>
giving file names and complete statistics.
</para>
</section>

<section id="sec2.3">
<title>Some Common Command Formats</title>
<para>
This section is a summary of some commands commonly used by new
or casual NitrOS-9 users, and some common formats. Each command is
followed by an example. Refer to the individual command
descriptions later int his book for more detailed information and
additional examples. Parameters or options shown in brackets are
optional. Whenever a command references a directory file name, the
file <emphasis>must</emphasis> be a directory file.

<screen>
CHD filename                               chd DATA.DIR
</screen>
Changes the current <emphasis>data</emphasis> working directory to
the <emphasis>directory</emphasis> file specified.
<screen>
COPY filename1 filename2                   copy oldfile newfile
</screen>
Creates filename2  as a new file, then copies all data from
&quot;filename1&quot; to it. &quot;filename1&quot; is not affected.
<screen>
DEL filename                               del oldstuff
</screen>
Deletes (destroys) the file specified.
<screen>
DIR [filename] [-e] [-x]                   dir myfiles -e
</screen>
List names of files contained in a directory. If the &quot;-x&quot; option is
used the files in the current <emphasis>execution</emphasis>
directory are listed,
othervise, if no directory name is given, the current
<emphasis>data</emphasis> directory will be listed.
The &quot;-e&quot; option selects the long format
which shows detailed information about each file.
<screen>
FREE devicename                            free /d1
</screen>
Shows how much free space remains on the disk whose name is given.
<screen>
LIST filename                              list script
</screen>
Displays the (text) contents of the file on the terminal.
<screen>
MAKDIR filename                            makdir NEWFILES
</screen>
Creates a new directory file using the name given. Often followed
by a <command>chd</command> command to make it the new working data directory.
<screen>
RENAME filename1 filename2                 rename zip zap
</screen>
Changes the name of filename1 to filename2.
</para>
</section>

<section id="sec2.4">
<title>Using the Keyboard and Video Display</title>
<para>
NitrOS-9 has many features to expand the capability of the Color Computer
keyboard and video display. The video display has screen pause,
upper/lower case, and graphics functions. The keyboard can generate
all ASCII characters and has a type-ahead feature that permits you
to enter data before requested by a program (except if the disk is
running because interrupts are temporarily disabled).
<xref linkend="video-display"/> of
this manual is a list of the characters and codes that can be
generated from the keyboard. The keyboard/video display can be used
as a file known by the name &quot;/TERM&quot;.
</para>

<section>
<title>Video Display Functions</title>
<para>
Most Color Computers use reverse video (green letters in a black box) to
represent lower-case letters. Normally they are not used, so you
have to turn them on if you want to use them with the command:
</para>
<screen>
tmode -upc
</screen>
<para>
However, the Color Computer 3 and certain models of the Color Computer 2 can also do true lowercase on the 32x16 video display.  To see if your Color Computer can do true lowercase, type the following command:
<screen>
xmode /term typ=1; display e
</screen>
If your Color Computer cannot do true lower case, your screen will show graphics garbage.
</para>
<para>
The screen pause feature stops programs after 16 lines have been
displayed. Output will continue if you hit any key. Normally this
feature is on. It can be turned on or off with the <command>tmode</command> command as
follows:
</para>
<screen>
tmode -pause              turns pause mode off
tmode pause               turns pause mode on
</screen>
<para>
The display system also has a complete set of commands to emulate
commercial data terminals, plus a complete set of graphics commands.
These are described in detail in <xref linkend="key-definitions"/>.
</para>
</section>

<section>
<title>Keyboard Shift and Control Functions</title>
<para>
Two keys are used in combination with other keys to change their
meaning. The SHIFT KEY selects between upper case and lower case
letters or punctuation, and the &ctrlkey; key can be used to generate
control characters.
</para>
<para>
The keyboard has a shift lock function similar to a typewriter's,
which is normally &quot;locked&quot;. The keyboard's shift lock may be
reversed by depressing the control key and <keycap>0</keycap> keys
simultaneously. The shift lock only affects the letter (A-Z) keys.
When the keyboard is locked, these keys generate upper case letters,
and lower case only if the SHIFT key is depressed. When the
keyboard is unlocked, the reverse is true, e.g., lower case letters
are generated unless the SHIFT key is depressed at the same time as
a letter key.
</para>
</section>

<section id="sec2.4.3">
<title>Control Key Functions</title>
<para>
There are a number of useful control functions that can be
generated from the keyboard. Many of these functions use &quot;control
keys&quot; which are generated by simultaneously depressing the &ctrlkey; key
plus some other key. For example, to generate the character for
<keycap>CONTROL</keycap> <keycap>D</keycap> press the &ctrlkey; and <keycap>D</keycap> keys at the same time.
</para>
<variablelist>
<varlistentry>
  <term><keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>A</keycap></keycombo></term>
  <listitem>
<para>
Repeat previous input line. The last line entered will be redisplayed but
<emphasis>not</emphasis> processed, with the cursor positioned at the end of
the line. You may hit return to enter the line, or edit the line by
backspacing, typing over characters to correct them, and entering
control A again to redisplay the edited line.
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>D</keycap></keycombo></term>
  <listitem>
<para>
Redisplay present input on next line.
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>W</keycap></keycombo></term>
  <listitem>
<para>
Display Wait - This will temporarily halt output to the display so
the screen can be read before the data scrolls off. Output is
resumed when any other key is hit.
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>0</keycap></keycombo></term>
  <listitem>
<para>
Shift lock. Reverses present shift lock state.
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycap>BREAK</keycap> (or <keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>E</keycap></keycombo>)</term>
  <listitem>
<para>
Program abort - Stops the current running program
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycombo action="simul">
  <keycap>SHIFT</keycap> <keycap>BREAK</keycap></keycombo> (or <keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>C</keycap></keycombo>)</term>
  <listitem>
<para>
Interrupt - Reactivates Shell while keeping program running as
background task.
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>BREAK</keycap></keycombo> (<keycap>ESCAPE</keycap>)</term>
  <listitem>
<para>
End-of-File - This key is used to send an end-of-file to programs
that read input from the terminal in place of a disk or tape file.
It must be the first character on the line in order for it to be
recognized.
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycap>LEFT ARROW</keycap> (OR <keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>H</keycap></keycombo>)</term>
  <listitem>
<para>
Backspace - erase previous character
</para>
  </listitem>
</varlistentry>
<varlistentry>
  <term><keycombo action="simul">
    <keycap>SHIFT</keycap> <keycap>LEFT ARROW</keycap></keycombo> (or <keycombo action="simul">
  <keycap>CONTROL</keycap> <keycap>X</keycap></keycombo>)</term>
  <listitem>
<para>
Line Delete - erases the entire current line.
</para>
  </listitem>
</varlistentry>
</variablelist>
</section>
</section>

</chapter>