The Pilot Programming Language on CP/M

Pilot was created by John A. Starkweather in the early 1960s as a programming language for Computer Assisted Instruction. It has often been compared to Logo because of its use with children. However, it is a much simpler language than Logo and really specializes in providing an easy way to create question and answer systems.

Language Description

Pilot source code consists of lines of the following format:

[label][command][conditional expression]:[operands]

Labels are prefixed with * and are used by J: to Jump to and by U: to call a User subroutine.

Common Commands are listed in a table below.

The conditional expression is generally Y or N to indicate whether to execute the command based on the last M: Match command. Some implementations of Pilot also support more complicated expressions.

The operands for a command are delimited by commas.

CommandAction
A:<Variable>Ask for keyboard input and put result in Variable
C:<Expression>Compute Expression
E:End user subroutine / program
J:<Label>Jump to Label
M:<List>Match last keyboard input against any value in List (Set Y/N logic flag)
R:<Comment>Remark / Comment
T:<String>Type String to display
U:<Label>Jump to a User subroutine at Label

Variables are prefixed with a $ if a string and for those implementations that support numbers they are generally prefixed with a #.

Example: Looping Hello, World!

This example prints 'Hello, World!' ten times with the number prefixing the string.

         C: I=1
*LOOP    T: #I Hello, World!
         C: I=I+1
         C: J=11-I
      J(J): *LOOP
         E:

The line to print the message, *LOOP T: #I Hello, World!, uses #I to reference the variable I. The loop is controlled by the line J(J): *LOOP, which uses a conditional expression, (J), to indicate that the jump should be performed if 'J > 0'.

Example: String Matching and Subroutines

This example demonstrates string matching and subroutines as it repeatedly asks a user to type STRAWBERRIES, QUIT or EXIT. If the user types STRAWBERRIES it will tell the user how much it likes them with cream and if the user types either QUIT or EXIT it will exit the program.

*LOOP     T: TYPE STRAWBERRIES OR ELSE (OR QUIT OR EXIT)
          A: $FRUIT
          M: QUIT,EXIT
         JY: *QUIT
          M: STRAWBERRIES
         UY: *ILIKE
          J: *LOOP
*ILIKE    T: I SURE LIKE $FRUIT AND CREAM
*QUIT     E:

The line A: $FRUIT accepts a string into the variable FRUIT, which is then tested to see if it matches either QUIT or EXIT using M: QUIT,EXIT. The M: command sets the logic flag which is then tested with JY: *QUIT and if it is true (Yes) then the program jumps to the label *QUIT. If not then the accept string is tested against STRAWBERRIES and if it matches then the subroutine *ILIKE is called with, UY: *ILIKE. The *ILIKE subroutine refers to the accepted input string through the variable $FRUIT in, T: I SURE LIKE $FRUIT AND CREAM. Finally E: is used to exit the subroutine and doubles as the program quit indicator at *QUIT. Unfortunately, for some reason E: doesn't seem to exit '8080 PILOT' properly.

8080 PILOT

8080 PILOT was written by John A. Starkweather, the original author of Pilot, under contract to the Lister Hill National Center for Biomedical Communications, National Library of Medicine. This was ported to CP/M by John I. Frederick in 1977 and v1.2 is available on the Walnut Creek CD in CPMUG012.ARK. Although the version number of the executing program states v1.1. Interestingly, although this version was released in 1977, John Starkweather says in the March 1982 edition of InfoWorld that he is going to release a CP/M version. There is a Guide to 8080 Pilot, Version 1.1 in the April 1977 issue of Dr. Dobbs Journal.

The examples above are written for 8080 PILOT.

Z-80 PILOT

Also in the file CPMUG012.ARK is a much smaller version of Pilot written for the Z-80. The source code is only 7k and the .COM file is only 1k, compared to 8080 PILOT whose source code is 67k and .COM file is 5k. However, this smaller size comes at a cost. This version doesn't support subroutines or numeric variables. It also refers to variables in a T: command using a \, e.g. \fruit and A: doesn't accept a variable name, instead it uses the label of the line on which the A: is being executed to indicate the variable name. Despite these differences for many uses it wouldn't matter much if you just want to present information and question a user.

PILOT/80

PILOT/80 was written in MBASIC by Kurt Albrecht and the version on the Walnut Creek CD is dated 1983. It contains its own text-editor, although you can use any editor to create the Pilot source programs by saving them with a '.PIL' extension. Its use of MBASIC does make it slower but that may not be much of a problem because it doesn't support maths through the C: command. The documentation is good and I like the inclusion of the I: command to accept single key input as well as the S: command to handle screen functions such as CLEAR to clear the screen.

Pilot/P

Pilot/P takes Pilot source code and transpiles it to Pascal/Z source code. It was written by David Mundie and Raymond E. Penley and the Walnut Creek CD contains v2.5 from 1984. This implementation departs quite a lot from other Pilot implementations by having a more complex subroutine definition using %: and allowing Pascal statements to be integrated into the Pilot source code. It also has additional commands such as X: to process an expression which then sets the logic flag. One last significant change is that variables are referred to by the T: command by surrounding them with the @ symbol, e.g. @$varName@.

Pilot/P contains great documentation, has lots of examples and uses 'SUPERSUB' (renamed as 'DO.COM') to automate the process of transpiling to Pascal/Z source code, compiling and linking.

Video Demonstrating Pilot on CP/M

Pilot can be seen being used in the following video.

Creative Commons License
The Pilot Programming Language on CP/M by Lawrence Woodman is licensed under a Creative Commons Attribution 4.0 International License.

Share This Post

Feedback/Discuss

Sign up to get new articles straight to your inbox.

Delivered by FeedBurner

Related Articles

The Mouse Programming Language on CP/M

Mouse is an interpreted stack orientated language designed by Peter Grogono around 1975. It was designed to be a small but powerful language for microcomputers, similar to Forth, but much simpler. On...   Read More

If Only Borland Had Stuck With Turbo Modula-2 For CP/M

I have written previously about why Turbo Pascal is a Great Choice For Programming Under CP/M and now it is time to talk about what could have been. You probably haven't heard of Turbo Modula-2 for CP...   Read More

Turbo Pascal: A Great Choice For Programming Under CP/M

CP/M was blessed with many programming languages, each with their own strengths and weaknesses. I think that Turbo Pascal stands out from these and I'm not alone. When Turbo Pascal was released in 19...   Read More

Installing the HI-TECH Z80 C Compiler for CP/M

My language of choice is C and I am currently getting more involved with the CP/M operating system. I have therefore decided that it would be nice to have a C compiler working under CP/M. There are a...   Read More

Installing ZDE 1.6, a programmers editor for CP/M

To do any serious programming under CP/M, the first thing you need is a good programmers editor. There aren't many in the archives, but I have tried most of them and found ZDE to be the best. It is s...   Read More