Turtle PILOT
Alan W. Poole
Loomis, CA
This series concludes with a comparison of Atari and Apple PILOT instructions, the program variables within the languages, and a table summarizing PILOT commands. The Turtle PILOT language, a version for the VIC and the PET, will be published next month. Last month the Atari version of the language was published and there was a version for the Apple in the September issue.
Welcome back for the third and final article about Turtle PILOT. If you haven't seen the last two articles, I would suggest you do that now, unless you are willing to miss out on a powerful new language for your Apple. [The Atari version of PILOT was published in the October 1982 issue of COMPUTE!, and the language for the Apple appeared in the September issue.] In Parts I and II we dealt with all the commands and instructions in Turtle PILOT. Translating an Atari PILOT program to Turtle PILOT will be the main topic of this article, along with a few miscellaneous notes and some documentation on the Editor and Translator programs. At the end of this article you will find a summary of all the commands and instructions in Turtle PILOT.
The program we are going to convert from Atari PILOT to Turtle PILOT first appeared in David Thornburg's "Friends Of The Turtle" column in the April 1982 issue of COMPUTE! magazine. Both versions of the program are listed below, along with a list of the changes made to the program to convert it to Turtle PILOT.
- Line 3 was added to clear the screen and place the cursor in the text window below the high resolution graphics.
- The symbol placed at the end of a Type instruction to continue the next printed character on the same line is the ampersand instead of the backslash used in Atari PILOT.
- Turtle commands are preceded by a G: instruction in Turtle PILOT instead of the GR: used in Atari Pilot.
- Numeric variable names are not preceded by a pound sign (#) in Turtle PILOT, except in a Type instruction, where they are preceded and followed by a pound sign.
- White was the only color used in the Turtle PILOT version because colors are plotted only at every other coordinate on the Apple.
Turtle PILOT version | Atari PILOT version |
1 *VISITURT | *VISITURT |
2 U:*ERASE | U:*ERASE |
3 B:HOME:VTAB21 | |
4 T:WELCOME TO THE VISIBLE TURTLE | T:WELCOME TO THE VISIBLE TURTLE |
5 T: | T: |
6 J:*STARTHERE | J:*STARTHERE |
7 *MASTERLOOP | *MASTERLOOP |
8 T:TURN & | T:TURN \ |
9 U:*ACCEPT | U:*ACCEPT |
10 G:PEN ERASE | GR:PEN ERASE |
11 U:*TURTLE | U:*TURTLE |
12 G:TURN A | GR:TURN # A |
13 *STARTHERE | *STARTHERE |
14 G:PEN WHITE | GR:PEN YELLOW |
15 U:*TURTLE | U:*TURTLE |
16 T:DRAW & | T:DRAW \ |
17 U:*ACCEPT | U:*ACCEPT |
18 G:PEN ERASE | GR:PEN ERASE |
19 U:*TURTLE | U:*TURTLE |
20 G:PEN WHITE | GR:PEN RED |
21 G:DRAW A | GR:DRAW # A |
22 G:PEN WHITE | GR:PEN YELLOW |
23 U:*TURTLE | U:*TURTLE |
24 J:*MASTERLOOP | J:*MASTERLOOP |
25 E: | E: |
26 *ERASE | *ERASE |
27 G:GOTO 0,0;TURN TO 0; CLEAR | GR:GOTO 0,0;TURN TO 0; CLEAR |
28 U:*TURTLE | U:*TURTLE |
29 E: | E: |
30 *ACCEPT | *ACCEPT |
31 A:A | A:#A |
32 M:E | M:E |
33 UY:*ERASE | UY:*ERASE |
34 E: | E: |
35 *TURTLE | *TURTLE |
36 G:GO 4; TURN -90; GO 1; TURN 180 | GR:GO 4; TURN -90; GO 1; TURN 180 |
37 G:30(DRAW 2; TURN 12) | GR:30(DRAW 1; TURN 12) |
38 G: GO 1; TURN 180 | GR: GO 1; TURN 180 |
39 G:10(DRAW 2; TURN 36) | GR: 10(DRAW 1; TURN 36) |
40 G: TURN 90; GO-4 | GR: TURN 90; GO-4 |
41 E: | E: |
Miscellaneous Notes On Turtle Pilot
- It is not necessary to include the asterisk in front of a label used in the object of a Jump or Use instruction.
- A Jump instruction without an object will jump back to the last Accept instruction.
- One dollar sign or pound sign may be used in a Type instruction, but don't use two unless a variable is being Typed.
- All spaces on the left side of the colon in every instruction will be ignored when the program is translated. Spaces on the right of the colon will be ignored with the G: instruction.
- When you first run a program, the turtle will be automatically initialized to the middle of the screen, an angle of zero, and the color white.
Program Documentation
So far I have not provided any documentation for the Editor and Translator programs other than the REMarks included in the programs. Lines 50000 to 55060 do not contain any REMarks. These lines are never executed while the Translator is RUN-ning. Some PILOT instructions require a subroutine to perform the same task in BASIC. This is the purpose of the lines greater than 50000. These lines are included in every translated program. Below is a list of the functions of these subroutines and lists of the variables used in the Editor and Translator programs.
Lines 50000-50050: Initialization. Lines 50020-50025 set the pitch values for notes. Lines 50030-50040 POKE a machine language sound routine into memory.
Lines 51000-51130: Type instruction. QT$ is string to be Typed.
Lines 52000-52220: Accept instruction. Uses the GET command to allow any character to be typed, without an error occurring. QI$ is string typed.
Lines 53000-53030: Match instruction. Q$(25) is list of items to be Matched.
Lines 54000-54020: TURN command. QT is number of degrees to turn.
Lines 55000-55060: DRAW command. QL is length of line.
Editor Variables
BELL$: CTRL-G
C: Editor command number.
C$(9): List of Editor commands.
D$: CTRL-D.
F: Temporary flag.
FL: First line number.
1$: General input.
IN$(11): List of PILOT instructions.
K$: Key pressed.
K: ASCII code of K$.
L, L1, L2: Temporary loop counters.
LL: Last line number.
LN: Number of last line in program.
LT: Number of line being typed.
N$: Name of program to be LOADed.
P: Parentheses counter.
P$(2500): Program lines.
RE$: "LINE NO. OUT OF RANGE"
SE$: "SYNTAX ERROR"
T, T$: Temporary variables.
Translator Variables
C: Conditioner, 0 = none, 1 = Y, 2 = N.
D$: CTRL-D.
EX$: Expression.
F: Flag to indicate if turtle commands are in a loop.
GC: Number of turtle graphics command.
G$(6): List of turtle commands in one line of PILOT program.
I: Instruction number.
I$: Line of PILOT program input from disk.
I$(12): List of PILOT instructions.
K$: Character read from PILOT program on disk.
L$: Part of instruction left of colon.
LN: Line number being translated.
LN$: Translated line.
M$(25): Items in object of Match instruction.
N$: Name of program being translated.
NL: Number of lines in PILOT program.
P$(2500): PILOT program lines.
R$: Part of instruction right of colon.
T1$: T$ with spaces removed.
L, T, T$, 11: Temporary variables.
Now that you have learned all the commands and features of Turtle PILOT, you can start writing programs and experimenting with the language. I'm sure you will find that the power and simplicity of Turtle PILOT far outweigh the inconvenience of having to wait a couple of minutes while your program is translated to Applesoft.
Summary Of Turtle PILOT
Editor Commands
ADD – Start or continue program.
LIST – List program.
EDIT – Change line(s) of program.
INSERT – Add a line.
DEL – Delete line(s) of program.
NEW – Erase program in memory.
LOAD – Load program from disk.
SAVE – Save program on disk.
MEM – Display free bytes.
CAT – Catalog disk.
PR# – Change output slot.
ESC – Key to exit Editor.
PILOT Instuctions
T: Type
A: Accept
M: Match
J: Jump
U: Use
E: End
C: Compute
R: Remark
S: Sound
G: Turtle graphics
B: BASIC commands
* – Used in front of label.
Y – Yes conditioner.
N – No conditioner.
Turtle Commands
CLEAR – Turn on and erase hi-res graphics.
TURN – Add to turtle's angle.
TURNTO – Reset turtle's angle.
DRAW – Draw line at angle turtle is headed.
GO – Move turtle without drawing.
PEN – Change color.
SCREEN – Clear screen to a color.
GOTO – Change coordinates of turtle.
FULL – Full screen graphics.
MIX – Mixed graphics and text.
QUIT – Return to text mode.