Chapter 9. PILOT TUTORIAL

To make best use of this chapter you should read it with the computer close 
at hand in order to work through the examples as you go along. Examples 
assume that you have a copy of your PILOT distribution disk mounted in the 
current default disk drive or directory. As you work through this tutorial it 
is a good idea to go back and read the applicable reference sections of the 
manual. It will help fill in details left out here and will familiarize you 
with that manual.  

Various other materials that may be helpful in learning PILOT are listed in 
Appendix C. They include books and on-line tutorial programs on PILOT 
programming and related topics. 

INTRODUCTION 

Computer assisted instruction (CAI) is a general term which refers to the 
process of using an interactive computer to deliver educational material to a 
person.  In general it is done something like this: first, the author 
(program writer) creates a program. The program is sometimes referred to as a 
lesson or as courseware. The student then runs the program on the computer, 
and through interaction with the program the student is led through the 
lesson.  Normally, many students run the program once it is written. The 
process is analogous to writing a book, in that much work is put into the 
original which is used many times.  

How effective is the whole process? It depends on several factors: the 
author's mastery of the subject matter, the particular educational approach 
used to present the material and the particular CAI system used to program 
and deliver the lesson. That is where PILOT comes in; it has evolved over a 
period of about 12 years to fit this type of programming very well.  

Though the author is completely free to use any combination of presentation 
techniques, there are a few types of CAI which can be labeled and described 
here as examples. The simplest form of CAI is drill and practice. This method 
presents problems or questions to the student. Often the problems have a 
randomly generated component. The amount of feedback and assistance given on 
wrong answers varies. A second typical use is testing. This can be similar to 
drill and practice in that a series of questions is presented; the difference 
is that the primary purpose is to evaluate and record the student's 
performance. Either of the above methods may take the form of multiple 
choice, fill in the blank, or verbal reply. These two methods are also the 
easiest type of program to write for the beginner. PILOT provides easy 
commands to present text and/or graphics, accept replies, evaluate replies, 
give feedback and decide what to do next.  

A third type of CAI lesson is the tutorial. This consists of an ongoing 
conversation between the program and the student.  (note: The computer is 
only the medium over which the two parties in the conversation communicate, 
it is not one of the parties in the conversation.) The conversation can 
consist of displays of text and graphics, replies or inputs by the student, 
and further actions by the program based on student replies. This method is 
very useful to show the student how something works then to check the 
student's understanding and dynamically adjust the presentation to the 
student. This method implies that the author can predict in advance the  
possible errors and areas of misunderstanding that the student may have, so 
as to determine what should happen in each case. A good tutorial program 
implements individualized instruction for each student who runs the program. 
Often such a program is improved as it is tested on many students and 
adjusted to handle previously unanticipated problems.  

The final type of CAI mentioned here is simulation.  This consists of the 
program setting up an environment similar to a particular situation so that 
the student can learn something about the situation.  There are many 
interesting possibilities here. A few examples will give you the idea. A CAI 
lesson could teach the use of another software package, such as a word 
processor or database, by leading the student through displays and responses 
that look like those that the package uses. In this way the responses given 
can be checked and appropriate explanations made. Another simulation might 
allow the student to perform laboratory experiments in a simulated lab rather 
than in a real one. The student can practice operating a device or machine in 
a safe and inexpensive environment. Finally, there is the game program which 
incorporates the lesson material into a competitive or entertaining form.  
  
A typical CAI lesson may use any combination of these forms or may 
incorporate other forms. In fact there is much room for innovation in the 
development of effective CAI. But no matter what material is presented or 
what method is used, there are certain basic tools that are used repeatedly 
in various combinations to build the lesson program. These tools are in the 
form of PILOT commands or statements. Once you learn  how to use the various 
statements, you can combine them in your own way to write the lesson you 
want. This tutorial introduces you to the simple uses of some of the PILOT 
statements. The Language Reference Manual contains complete details on all 
PILOT features.  

As a final introductory note, before you would actually write any CAI program 
you would spend considerable time on the selection of your material and on 
the instructional design.  This, of course, depends on your own educational 
philosophy and goals.  Since PILOT in and of itself does not impose any 
particular instructional method, we will not spend time here suggesting 
educational methods to be used.  
 
GETTING STARTED 

A PILOT program is made up of a series of commands or statements. There are 
only about twenty different kinds of statements. Each one has a specific 
purpose.  A statement is always written on one line of the screen. Each 
statement starts with an op code; the op code identifies the particular type 
of statement and consists of a letter. The op code is followed by a colon 
(:), and then possibly text.  

The normal way to write a program is to use a text editor to create a disk 
file. The disk file consists of the statements that make up the program. Once 
the disk file is created you can tell PILOT to run the program. We will talk 
more later about the process of creating the program file on disk.  

To get started we will run an already written PILOT program called SAMPLE1 
which is supplied on your PILOT disk. It will allow us to try out one 
statement at a time without having to write it first into a disk file. To get 
started type the command: 

       PI SAMPLE1 

and push the return key. You can now write your first PILOT statement. Type 
in the line: 

       T:Hello world!  

after you push return you should see: 

       Hello world!  

This is an example of a TYPE statement. The T is called the op code. Notice 
that after the op code you put a colon and after the colon you put the text 
which was to be displayed by the type statement. Try putting in another type 
statement for practice. By experimenting, see what happens if you type the T 
op code in lower case or leave off the colon after the op code.  

You should have noticed that it does not matter whether the op code is upper 
or lower case. You should also have seen that leaving off the colon character 
after the op code is considered an error by PILOT. In that case PILOT shows 
you the statement it considers in error, followed by a message that tells 
what it considers to be wrong.  Usually it will be easy for you to tell what 
is wrong, but if you need more explanation check the ERROR MESSAGES section 
of the Reference Manual. After any error in a program you can choose to stop 
the program by pushing ctrl-C (that is holding down the ctrl key while 
pushing the C key), or you can push any other key to continue on with the 
execution of the program.  

TRYING OUT GRAPHICS 

If you do not have a color adapter on your computer, skip this section, as 
you can not do graphics on a monochrome adapter.  

If you are not still running the SAMPLE1 program get it started by typing: 

       PI SAMPLE1 

Next you can try out the GRAPHICS statement. To do so you must first select a 
screen mode which allows graphics. Also for convenience you can establish a 
text viewport at the bottom of the screen to keep the things you type 
isolated from the graphics you draw.  To do this type: 

       TS:M4;V0,39,20,24 

and push return. The TS op code is used for several purposes; what you did 
here was to set screen mode 4, and make the last 5 lines of the screen the 
text viewport. You should have a blank screen now and the cursor should be 
toward the bottom of the screen.  

To draw graphics you tell an invisible turtle which direction to turn and how 
many steps to take. As the turtle moves it can draw a line of some chosen 
color.  When a program starts, the turtle is in the middle of the screen and 
is pointed towards the top of the screen. Try the following statement which 
tells the turtle to go forward 100 steps:  

       G:F100 
 
You should see a vertical line appear. Now tell the turtle to turn to its 
right and go forward another 100 steps:  

       G:R90;F100 

You should see a horizontal line appear making a right angle with the 
vertical line. In both the above statements the G is the op code for the 
GRAPHICS statement. The F100 is a forward command for 100 steps. The R90 says 
turn right 90 degrees. You can put any number of commands after the colon as 
long as each is separated from the next one by a semi-colon.  Try this 
statement; it completes the drawing of a box:  

       G:R90;F100;R90;F100 

To change the color of the lines drawn by the turtle type: 

       G:C1 

This command sets the line color to color number 1.  See the GRAPHICS section 
of the Reference Manual for information about the various colors available. 
Try drawing a box in the new color: 

       G:F200;R90;F200;R90;F200;R90;F200 

Notice that in the above statement the same sequence is repeated several 
times. There is a short hand way of representing this on the GRAPHICS 
statement. Try the following statement, it is equivalent to the last one:  

       G:*4(F150;R90) 

The notation *n(...) allows you to repeat the commands in the parentheses n 
times. This turns out to be a very powerful feature, as you will see by 
trying out the following statements. Two new commands are used below. The E 
command on the GRAPHICS statement causes the screen to be erased. The L 
command tells the turtle to turn left.  Try each of these statements:  

       G:E;*3(F350;R120) 

       G:E;*5(F240;R72) 

       G:E;*8(F200;L45) 

       G:E;*20(F30;L18) 

       G:*5(F300;R144) 

       G:E;C2;*72(F400;R175) 

There are a few other important facts to know about the GRAPHICS statement. 
One is illustrated by the following example. Try it to see what happens.  

       G:E;H80;*200(F5) 

You should see the line run off the right side of the screen and come back on 
the left side. In general any time you draw off one edge of the screen you 
come back on the opposite edge.  This wrap around feature of the screen makes 
it act as if it were infinite in all directions.  

There are 320 individual pixels (dots) across the screen. They are numbered 
from 0 on the left to 319 on the right. There are 200 pixels from top to 
bottom; they are numbered from 0 on the top to 199 on the bottom. You can 
tell the turtle to go to any particular pixel by giving the horizontal (x co-
ordinate) and the vertical (y co-ordinate) positions.Try these statements for 
an example.  

       G:G20,15;F30 

       G:G300,100;F25 

Normally one step for the turtle is one quarter of a pixel.  That means that 
it would have to go at least four steps to make a line two pixels long.You 
can control the horizontal and vertical scale factors to set the size of one 
turtle step. Try the following three statements. They show the effect of the 
scale factors.  

       G:E;G130,100 

       G:*3(F40;R120) 

       G:X4;Y4;*3(F40;R120) 

Notice that the same triangle is drawn but it is four times as large the 
second time. The reason is that the X and Y scaling factors are each set to 
4. At this setting one turtle step is equal to one pixel on the screen.  

There are several uses of the scale factors. One is to compensate for a 
display screen which has pixels that are not square. For example, when 
drawing what should be a square and it is a little wider than it is tall, you 
can adjust it by setting the X scale to 3 and the Y scale to 4. A second use 
of the scale factors is to purposely distort a figure.  For example, the 
following statement draws what would normally be a circle, but by setting the 
scale factors it draws an ellipse instead.  

       G:E;X3;Y1;*20(F20;R18) 

At this point you should read the GRAPHICS statement section of the Reference 
Manual. After having tried these few examples it will make more sense to you 
than it may have before. You will also notice that there are features 
described there that were not covered here.  

Before you go on to the next section you can clean up the screen by entering: 

       TS:M0 

which puts the screen back into text mode 0.  


THE USE OF VARIABLES 

If you are not already running the SAMPLE1 program then start it by entering: 

       PI SAMPLE1 

A variable is a word which names a storage location in computer memory. PILOT 
has two kinds of variables. The first is a numeric variable which, as you may 
guess, stores a number. The COMPUTE statement is used to save the result of a 
computation in a numeric variable. Try for example: 

       C:X=3+4 

To understand what this statement does you might read it as "save the sum of 
3 and 4 in the variable X".  You can display the value of a variable thus: 

       T: #X 

You should see 7 displayed. Notice that the # itself is not displayed, 
neither is the X. The # character tells the TYPE statement that a numeric 
variable follows and that the value of the variable, not the name of the 
variable, is to be displayed. Numeric variables have many uses, such as 
counting the number of correct and incorrect answers. We have used the 
variable name X, but you may choose any letter or word that will help you 
remember what purpose the variable is to serve.  Try these three statements, 
which might be found in different parts of a program.  

       C: WRONG = 0 
       C: WRONG = WRONG + 1 
       T:You had #WRONG incorrect answer(s).  
 
In this case the variable is named WRONG. As a side note, the examples show 
variable names in upper case only; in practice you can use upper or lower 
case interchangeably in variable names.  That is, the variable name SCORE 
refers to the same value as the variable name score.  

A second type of variable is the character string, or just string. It can be 
used to save a list of characters, such as a person's name.  There are two 
important facts about a string variable. First, the name of a string variable 
always has a $ on the end of it. Second, you have to use the DIMENSION 
statement to set aside memory space for the string before you can use it. Try 
the following statement.  It defines a string variable called NAME$, and sets 
aside enough memory to store up to 10 characters.  

       D: NAME$(10) 

The compute statement can be used to set a string variable in much the same 
manner as a numeric variable. Try these two statements.  

       C: NAME$ = "Mickey Mouse" T:I like $NAME$.  
 
If you did it exactly as shown, then you would see the line: 

       I like Mickey mou.  

NAME$ was set up to hold 10 characters, therefore, only the first 10 
characters were saved.  Why are there two $ characters, one before and one 
after the variable? The first $ indicates to the TYPE statement that a string 
variable name follows and that the value of the string variable is to be 
displayed. The second $ is actually part of the variable NAME$. It would be 
helpful at this point to read the sections of the Reference Manual on the 
COMPUTE and DIMENSION statements, and VARIABLES and EXPRESSIONS.  

A FIRST PROGRAM 

If you are still running SAMPLE1, stop it by pushing ctrl-C.  

To write a program you must create a text file with a name that ends in .PIL 
; for this example you should use the name FIRST.PIL. The EZ editor that 
comes with PILOT makes this process very simple. (If, however, you already 
have a text editor you would rather use, go ahead it does not matter how the 
program gets into the text file.) EZ is described more completely in the 
Reference Manual. Please use EZ to get you started this time, type: 

       EZ FIRST.PIL 

You will see a line that says new file, then the screen will go blank. Start 
typing the lines you wish. After each line, push return. If you make an 
error, use the backspace or arrow keys to move to the spot in error, then 
type the correction over the error. When you are done push the F10 key. Try 
entering the following simple PILOT program.  

       D:NAME$(10) 
       T:Hello, what is your name?  
       A:$NAME$ 
       T:Hi $NAME$, nice to meet you!  

Once you have typed it in, save it by pushing the f10 key. Next try running 
the program by typing: 

       PI FIRST 

The first statement sets up a string variable called NAME$ and reserves 10 
characters of memory for it.  The second statement types out the message 
Hello etc, which is the first thing you should see on the screen. The next 
line contains an ACCEPT ANSWER statement signified by the A op code. It tells 
PILOT to allow the student to enter a response.  Nothing further happens 
until the student types something and pushes the return key. Assuming the 
student types a name, e.g. Mary. The next TYPE statement displays the message 
"Hi Mary, nice to meet you!" 

If the program does not run as you expect it to, use the editor to correct 
the program and try it again.  To edit the program with EZ enter: 

       EZ FIRST.PIL 

exactly as you did when creating the program.  You will see your program on 
the screen. Move the cursor to the spot you need to fix using the arrow keys.  
Then type the corrections over the errors.  

You should try running the program a few times with different responses. See 
what happens if you enter a very long name or no name at all.  

Also, if you are using EZ you should now read the section in the Reference 
Manual which describes it.  Try out each command or function key to make sure 
you understand how it is used.  


A SIMPLE QUESTION FRAME 

One of the things often done in a CAI program is to ask a question (possibly 
accompanied by some explanatory text or graphics), and then accept an answer 
from the student. Next the student answer is judged and an appropriate 
feedback message is given.  If the answer is incorrect then the student is 
given another try. If the answer is correct then the program proceeds to the 
next question. Sometimes one question in a program along with its explanatory 
text, feedback messages, etc is called a FRAME or a PROBLEM. These terms are 
used loosely but generally refer to what the student sees on the screen at 
one time. The reason it is useful to think in these terms is that as the 
interaction between the program and the student becomes more complex there 
may be several exchanges or responses on the same question frame.  In this 
case you have to plan ahead as to the placement of question, graphics, answer 
and feedback on the screen, so as to keep things clear for the student. The 
best way to illustrate how things are done with PILOT is by example.  

Below are some example programs of varying complexity.  Each one illustrates 
the use of various PILOT statements in combination with others. Some 
explanatory notes follow each program to point out some of the highlights, 
but there will often be statements or features used without specific 
explanation. You should study the program to see if you understand how it 
works. Run each program several times trying various incorrect and correct 
replies. This will help you understand how to plan for and handle anticipated 
and unanticipated responses the student might give to a program.  
 
Enter this example as file name SECOND.PIL. It is a very basic (and 
uninteresting) example of question and answer.  Once you have it entered, try 
it out with various replies.  

       T:What color is the sky on a clear day?
       A: 
       M:BLUE!blue
       TY:Right.
       TN:No, try again.
       JN:@A 

Notes on the above program: 

The first TYPE line asks a question. The ACCEPT statement allows the student 
to enter an answer. The MATCH statement will result in a YES match if the 
student answer contains the word blue, in either upper or lower case. In the 
case of a YES match the feedback "Right." is displayed. In the case of a NO 
match the feedback "No, try again." is displayed and the student is allowed 
to answer again.  

The last statement of the program says to JUMP if the result of the last 
MATCH was NO back to the last ACCEPT statement.  The effect is that the 
student can answer again.  

The above example shows the essential elements of a question and answer 
frame: the question is presented, an answer is accepted, it is judged for 
correctness, and feedback is given for correct and incorrect replies. 
However, in practice this program would be a bit boring to say the least. The 
next program shows how to give the program a bit more personality.  

Enter this program as file name THIRD.PIL . It illustrates a simple question 
frame. When typing in the program, notice that there are some blank lines 
shown here between some of the statements.  They are only to make it easier 
for you to see the various sections of the program. You do not need to put 
the blank lines in the file. Also notice that there are several remark 
statements in the program. They, of course, do not affect the operation of 
the program at all, you can leave them out or change them as you wish.  

       R:simple question frame example 
       PR:U 
       D:N$(20) 
       TH:What should I call you today ?  
       A:$N$ 
       T: 
       :Alright $N$, let's get started.  
       W:30 
       TX:Sailing is a lot of fun.  
       :But before we can talk much about it 
       :we have to make sure we both know 
       :the various terms used. For instance, 
       :do you know what we call the back end 
       :of the boat?  
       A: 
 
       R:first check for correct answer.
       M:STERN
       TY:Right $N$, it is the stern.
       JY:@P
   
       R:after 4 tries, give the answer
       T4:I think I better just tell you,
       :it is called the "stern".
       J4:@P
  
       R:in case they answer just YES
       M:YES!OF COURSE!EASY
       TY:Good, what do we call it?
       JY:@A
 
       R:check for anticipated errors
       M:BOW
       TY:Wrong end $N$, try again.
       JY:@A
 
       M:AFT!REAR!PORT!STARB
       TY:Good guess, but not the term I want.
       :Try again.
       JY:@A

       T1:I don't understand you.
       T2:No, this term refers only to boats.
       T3:I think you are just guessing.
       T:Give it another try.
       J:@A

       R:next problem starts here
       PR:
       W:30
       TX:The next question would go here...
       W:40
       E:
 
Notes on the above program: 

The variable N$ is used to save the student's name so it can be included in 
feedback messages.  

There are several groups of statements that are similar in that they consist 
of a MATCH followed by a TYPE-if-YES, followed by a JUMP-if-YES. The MATCH 
tests the answer given by the student by comparing it to the answer on the 
MATCH statement itself. If the student answer contains the answer given on 
the MATCH statement then the result is a YES match.  The Y conditional found 
on the subsequent TYPE and JUMP statements causes the statement to be 
executed only if the previous MATCH result was YES. Otherwise the statement 
is skipped.  

The first PR statement sets the U option. This means that all student answers 
are internally converted to upper case only. Note that in being consistent 
with this, the answers on the various MATCH statements are coded in upper 
case. The net effect of this combination is to ignore whether the student 
answers in upper or lower case.  

To make the program interesting to the student, some incorrect answers have 
been anticipated so that appropriate feedback messages will be given in these 
instances. To a large extent, the skill of the CAI author in doing this 
contributes to the quality of the resulting CAI lesson.  

The DIGIT CONDITIONAL , that is, the placement of a number after an op code, 
is used in several places.  It causes the statement to be executed if it 
equals the number of responses the student has given on this question. The 
two uses shown are to give successive hints on the first, second and third 
wrong tries, and to finally give the answer to the student on the fourth 
wrong try.  

There are two JUMP destinations used, namely back to the ACCEPT to let the 
student try again or forward to the next PROBLEM when it is time to go on.  
MORE ABOUT THE MATCH STATEMENT 

The MATCH statement is one of PILOT's most unique and powerful features. It 
is used to judge the last student answer against a pattern.  The end result 
of the MATCH statement is simply a YES (the student answer does fit the 
pattern) or NO (the student answer does not fit the pattern). The YES or NO 
result can be used to conditionally execute or skip over any statement by 
appending a Y or N to the op code.  As you have already seen, the statement: 

       TY:That is right.  

would be executed only if the previous MATCH statement resulted in a YES. 
Otherwise it would be skipped. Conversely, the statement: 

       TN:That is wrong.

is executed only if the previous MATCH statement resulted in a NO. Otherwise 
it is skipped.  

You have considerable latitude in coding the match pattern. First of all, the 
student answer does not have to match the pattern exactly, it need only 
contain the pattern somewhere within.  That is, the statement M:AUTO would 
give a YES for the responses AUTOMOBILE or SEMI-AUTOMATIC. In each case, the 
pattern AUTO is contained within the response.  

You need to consider the distinction between upper and lower case. If you 
wish to treat answers in either case as equivalent, use the P op code to set 
the U option. This forces all student input to upper case when it is stored 
in the internal answer buffer.  This scheme works equally well with the L 
(lower case) option. The S option causes the removal of all spaces from the 
student answer. Match patterns must be coded according to the options set on 
the P statement.  

There are several ways you can enhance the match pattern to allow for 
variations in the student answer. It is very important to do so in order to 
avoid unnecessary frustration on the part of a student who gives an 
essentially correct reply which happens to vary slightly from the expected 
reply.  There are two wild card characters you can use, the "*" and the "&". 
The "*" matches any single character in the same position of the answer. For 
example: 

       M:OL*MPIC would match OLYMPIC or OLIMPIC.

The & matches any string of zero or more characters. For example M:RED&BLUE 
matchs RED AND BLUE or REDBLUE. "&" means "and". So the statement would mean 
that "RED" and "BLUE" must be present in the given order.  

Often you wish to allow several alternative replies.  The ! can be used to 
separate several possibilities.  "!" is often thought of as meaning or.  For 
example: 

       M:boat!ship

would match either "boat" or "ship".  

The "*", "&" and "!" can be used in any combination within a match statement 
to give flexible answer checking. For example: 

       M:cat&dog!be*r!lion 

would give a YES for "cats and dogs", "grizzly bears", "cold beer" or "lions 
and tigers".  Sometimes the match is a little too flexible.  Consider the 
statement M:no which obviously expects a negative answer. If the student were 
to reply "I don't know", it would match since the answer contains "no". In 
cases where the match needs to be restricted you can use the "%" character. 
It matches only with a space or the start or the end of the student answer. 
Some examples will clarify.  

       M:%no%

would match "no", but not "I don't know" because the first % says the word 
must not be preceded by a non blank character and the second % says the word 
must not be followed by a non-blank character.  

       M:*ed%

requires a word that ends in "ed" since * matches any character and % 
requires that if anything follows "ed" it must be a space.  

The MATCH statement can be told to forgive minor spelling errors by appending 
the S modifier to the M op code. This will allow a YES match even when the 
student response differs slightly from the pattern.  You can ignore mistakes 
made by the student without deciding ahead of time what mistakes might be 
made.  For example: 

       MS:PILOT

would match "PILOT", "PILIT", "PILATE" or "PYLOT".  

You can use the following program to experiment with various MATCH 
statements. Use it to try the features of the MATCH.  

       T:Input a reply or ctrl-C to quit.
       A:
       M: (put whatever you want here) 
       TY:That matches.  
       TN:That does not match.  
       J:@A 

DISPLAY MODES AND FEATURES

With PILOT you can use the screen in several different modes. The display 
mode determines how many character rows and columns there are on the screen, 
what colors appear and whether there may be graphics displayed along with 
text.  

The actual colors and display quality you see depend on the display adapter 
you have (color or monochrome) and the monitor you have. In decreasing order 
of display quality, the types of display you can have are: RGB color monitor, 
composite video monitor and TV set (connected via an RF modulator). In 
general, the documentation here applies only to systems with a color adapter 
card. Graphics and color statements will not work with a monochrome adapter.  

The TYPE SCREEN (TS) statement is used to set the desired screen mode. For 
example: 

       TS:M4

Sets screen display mode 4.  

When a program begins, the mode is set to mode 0. The modes are numbered from 
0 through 6. Modes 4, 5 and 6 allow the use of graphics and user-defined 
characters. In the other modes the standard character set is always used.  

The TYPE SCREEN statement allows you to put text anywhere on the screen. The 
screen always has 25 lines of text available, the top line is considered line 
0, the bottom line is considered line 24.  Depending on the display mode 
there may be either 40 or 80 characters across each line.  The leftmost 
column is considered 0, the rightmost is either 39 or 79. In placing text on 
the screen you specify a character position as two numbers. The first number 
is the column number, the second is the line (row) number.  
 
Column and line numbers are used in two ways.  First, you can define what is 
called a VIEWPORT on the screen. A viewport is a rectangular section of the 
screen in which text can be displayed. When a program starts out, the 
viewport is considered to be the entire display screen. You can set the 
viewport via 

       TS:V0,39,15,24

which sets the viewport to be from column 0 on the left, through column 39 on 
the right and from line 15 on the top through line 24 on the bottom. In a 
mode with 40 columns this would make the viewport equal to the bottom 10 
lines of the screen. When a viewport is set in this way, the cursor is placed 
at the home position (upper left corner of the viewport). Any text output 
would display from that point on and text will be displayed only within those 
bounds. If the viewport becomes full it scrolls up one line to accommodate 
the next line of text. In doing so, all display data outside the text window 
is left unaltered. You can change the viewport as often as you wish; this 
facilitates the use of various parts of the screen to display certain data. 
Each time a new viewport is set up, PILOT remembers what the previous one 
was.  You can get back to the previous viewport by the statement: 

       TS:V;

which sets the viewport and the cursor position in the viewport to its 
previous setting. To see how a viewport works try this program.  
 
       T:This text is outside the viewport.  
       T:It will be unaffected by what 
       T:happens in the viewport.  
       TS:V10,30,11,16 
       T:This text is inside the viewport.  
       T:Type something 
       T:and I will type 
       T:it back.  
       A: 
       E5: 
       T:#%B 
       J:@A 
 
You can position the cursor anywhere within the current viewport by a 
statement similar to: 

       TS:G5,6

which tells the cursor to go to column 5 and row 6 of the viewport. Remember, 
column and row numbering starts at zero. If you specify a row or column too 
large for the viewport then the cursor is set as close as possible to the 
specified position while still remaining in the viewport.  
