PILOT CPC
About Pilot
===========
Pilot is a simple to learn, interpreted programming language that was developed
for educational use. It is based around five simple commands, each of which
consist of one letter followed by a colon. These commands are:
Command Meaning Description
-------------------------------------------------------------------------------
T: Text Prints the text following the colon on the screen.
A: Ask Accepts an input from the user.
M: Match Compares the pattern(s) following the colon with the most
recently accepted input from an A: command. If a match is
found, a special flag, called the match flag, is set.
J: Jump Jump to the specified label, or to the last a: command in the
case of a J: 0 instruction.
S: Stop Ends the program.
------------------------------------------------------------------------------
Any command can be preceeded by the letter y or the letter n. If y is specified,
for example:
yt: That was correct
then the command will only be executed if the match flag is set, ie. the result
of the last M: command was a positive match. Conversely, if n is specified, the
instruction is only carried out if the match flag is not set, ie. the result of
the last M: command was a non-match, for example:
nj: fred
would jump to the label fred if there was not a match in the last M:
instruction.
Let's look at the M: command a bit closer. In the simplest case, one item
specified after the M: command is compared with the user input. Note that case
is ignored, so fred would be matched with Fred, FRED, etc. For example, a
program to test the user's arithmetic ability might be as follows:
t: What is 7 multiplied by 6?
a:
m: 42
yt: Well done, that's correct.
nt: Nope. 42 was the answer.
s:
Fine. But what if the user typed in forty-two, forty two, or even fourty-two?
Well, the m: command can match against more than one item. Each item to be
checked is separated by an exclamation mark (!). So we could rewrite the above
program as
t: What is 7 multiplied by 6?
a:
m: 42!forty-two!forty two!fourty-two!fourty two
yt: Well done, that's correct.
nt: Nope. 42 was the answer.
s:
Now, let's say we wanted to ask the user again, if he got the answer wrong.
Well, we would use the J: instruction. So we could re-write the program:
t: What is 7 multiplied by 6?
a:
m: 42!forty-two!forty two!fourty-two!fourty two
yj: correct
t: No, try again.
j: 0
correct
t: Yes, that's right.
s:
A couple of new things in this program. Firstly, the label correct. A label must
be on a line on its own, and should not contain a colon. When PILOT comes across
the yj: correct command, it first checks the match flag. If this is set (ie. the
right answer), then it searches through the program for the label correct. It
then carries on execution of the program from the line immediately following the
correct label.
Secondly, note the j: 0 command. This commences execution from the last A:
command, ie from line 2.
Well that's about all there is to the PILOT language. Now lets look at using
PILOT CPC.
Using PILOT CPC
===============
To start using PILOT CPC, insert the disk and type
RUN "PILOT"
When pilot has loaded, a message will be displayed, and the program will wait
for you to type something in. Now, PILOT CPC allows you to enter Pilot programs
in a similar way to entering BASIC programs. That is, programs are entered line
by line, and each line is identified by a line number. PILOT CPC has a number of
non-program commands that allow you to enter and alter programs easily. These
are:
à The à command allows you to enter lines into a program, or append them
on to the end of an existing program. The à is immediately followed by
the program line. For example,
àt: Hello
would insert the line t: Hello into the program.
AUTO This allows consecutive lines to be inserted without the need to pre-
cede each line with an à sign. To stop entering lines, just press
ENTER/RETURN at the à sign (ie enter a blank line).
LIST This displays the program currently in memory.
EDIT n This allows line number n to be altered, for example, EDIT 15. The
current line is displayed, and the user prompted to enter a new line.
To copy parts of the old line to the new, you can use the shifted
cursor & copy keys, as in BASIC.
INSERT n Inserts a blank line after the given line number n.
DELETE n Deletes the line with line number n.
RUN Carries out the program currently in memory.
LOAD fnm Loads the given pilot program with filename fnm.plt into memory. For
example, LOAD demo1
SAVE fnm Saves the program currently in memory to disk with the given filename
(the extension .PLT is added automatically).
MODE m Changes the screen mode to m, eg. MODE 1. This command can also be
used in a program as MODE: m, eg.
MODE: 2
CLS Clears the screen
* Ignores the rest of the line, ie precedes a comment.
So, to type in and run the program:
mode: 1
t: Hello there
s:
you could type
AUTO (return)
mode: 1 (return)
t: Hello there (return)
s: (return)
(return)
RUN (return)
Where (return) signifies pressing the key marked RETURN or ENTER.
Well, that's all folks! Happy programming! If you get stuck, have a look at the
example programs on the disk.
Bye for now.
David Wild,
August 1988.