Basic Interactive Functions
Running Commands and Basic Shell Operation The shell 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. The command line always begins with a name of a program which can be: The name of a machine language program on disk The name of a machine language program already in memory The name of an executable program compiled by a high-level language such as Basic09, Pascal, Cobol, etc. The name of a procedure file If you're a beginner, you will almost always use the first case, which causes the program to be automatically loaded from the CMDS directory and run. When processing the command line, the shell searches for a program having the name specified in the following sequence: If the program named is already in memory, it is run. The "execution directory", usually CMDS, is searched. If a file having the name given is found, it is loaded and run. The user's "data directory" is searched. If a file having the name given is found, it is processed as a "procedure file" 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. Mention is made above of the "data directory" and the "execution directory". At all times each user is associated with two file directories. A more detailed explanation of directories is presented later. The execution directory (usually CMDS) includes files which are executable programs. The name given in the command line may be optionally followed by one or more "parameters" which are passed to the program called by the shell. For example, in the command line: list file1 the program name is list, and the parameter passed to it is FILE1. A command line may also include one or more "modifiers" which are specifications used by the shell to alter the program's standard input/output files or memory assignments.
Sending Output to the Printer 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: >/p The ">" character tells the shell to redirect output (See ) to the printer using the Color Computer's printer port, which has the device name "/p" (See ). For example, to redirect the output of the dir command to the printer, enter: dir >/p The xmode 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: xmode /p 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: xmode /p lf
Shell Command Line Parameters 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. For example, the list program is used to display the contents of a text file on your display. It is necessary to tell to the list 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: list startup Some commands have two parameters. For example, the copy 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: copy startup newstartup Other commands have parameters which select options. For example: dir shows the names of the files in the user's data directory. Normally it simply lists the file names only, but if the "-e" (for entire) 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: dir -e The dir 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: dir sys It is also possible to specify both a directory name parameter and the -e option, such as: dir sys -e giving file names and complete statistics.
Some Common Command Formats 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 must be a directory file. CHD filename chd DATA.DIR Changes the current data working directory to the directory file specified. COPY filename1 filename2 copy oldfile newfile Creates filename2 as a new file, then copies all data from "filename1" to it. "filename1" is not affected. DEL filename del oldstuff Deletes (destroys) the file specified. DIR [filename] [-e] [-x] dir myfiles -e List names of files contained in a directory. If the "-x" option is used the files in the current execution directory are listed, othervise, if no directory name is given, the current data directory will be listed. The "-e" option selects the long format which shows detailed information about each file. FREE devicename free /d1 Shows how much free space remains on the disk whose name is given. LIST filename list script Displays the (text) contents of the file on the terminal. MAKDIR filename makdir NEWFILES Creates a new directory file using the name given. Often followed by a chd command to make it the new working data directory. RENAME filename1 filename2 rename zip zap Changes the name of filename1 to filename2.
Using the Keyboard and Video Display 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). 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 "/TERM".
Video Display Functions 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: tmode -upc 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: xmode /term typ=1; display e If your Color Computer cannot do true lower case, your screen will show graphics garbage. 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 tmode command as follows: tmode -pause turns pause mode off tmode pause turns pause mode on 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 .
Keyboard Shift and Control Functions 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. The keyboard has a shift lock function similar to a typewriter's, which is normally "locked". The keyboard's shift lock may be reversed by depressing the control key and 0 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.
Control Key Functions There are a number of useful control functions that can be generated from the keyboard. Many of these functions use "control keys" which are generated by simultaneously depressing the &ctrlkey; key plus some other key. For example, to generate the character for CONTROL D press the &ctrlkey; and D keys at the same time. CONTROL A Repeat previous input line. The last line entered will be redisplayed but not 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. CONTROL D Redisplay present input on next line. CONTROL W 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. CONTROL 0 Shift lock. Reverses present shift lock state. BREAK (or CONTROL E) Program abort - Stops the current running program SHIFT BREAK (or CONTROL C) Interrupt - Reactivates Shell while keeping program running as background task. CONTROL BREAK (ESCAPE) 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. LEFT ARROW (OR CONTROL H) Backspace - erase previous character SHIFT LEFT ARROW (or CONTROL X) Line Delete - erases the entire current line.