Turtle Graphics Interpreter
Turtle Graphics Interpreter | ||
---|---|---|
Developer | Irwin Tillman | |
Publisher | COMPUTE!s Gazette | |
Release | 1984 | |
Platform | C64 | |
Genre | Programming Language Logo | |
Operation | ||
Media | , , Listing | |
Language | ||
Information |
Turtle Graphics Interpreter (short: TGI) is an interpreter for LOGO programming for the C64, that was first published in Compute!'s Gazette issue October 1984 and developed by Irwin Tillman. It is a fully LOGO interpreter, that was programmed complete in BASIC. With the TGI the user can create easy and fast HIRES computer graphics and so learning to programming a computer.
Description[edit | edit source]
Turtle Graphics Interpreter contains this three program listings:
- TURTLE GRAPHICS - The "Turtle Graphics Boot" program
- TURTLE GRAPHICS 1 - "Turtle Graphics Interpreter"
- TURTLE GRAPHICS 2 - "Turtle Data"
"It's an excellent learning tool for children, and it offers a new graphics capacity for all ages. For disk or tape users."[1]
The program TGI is a in the painting mode a little bit slowly!
First Steps[edit | edit source]
After loading and running the "Turtle Graphics Boot" program loads the two other programs into the memory. Then the start screen appears.
The screen has two sections:
- In the upper section, you see in the middle of this screen the turtle as a triangle in black color (default) in position 0,0.
- In the lower section, you see a text field with 5 lines for input your commands for moving the turtle for painting, editing the graphic screen, procedures and files. To input a command you write the command behind the
?
.
The Turtle Graphics interpreter recognizes 30 commands, some of which can be abbreviated.
In LOGO is a command or a few combined commands are a procedure. A procedure can also used in other procedures, that gives a new procedure. Procedures can saved and loaded in TGI or deleted from the memory.
For example: The procedure hexagon (for painting a hexagon) can be combined to another procedure called honeycomb, that contains 7 hexagons.
This explains, that with simple symbols, which are combined together, complex graphics are drawn.
- The defaults colors are
- Border color: red (2)
- Text background color: light blue (14)
- Text color (for command line): green (5)
- Pen color: blue (6)
- Turtle color: black (0)
Also it exists a "TGI Logo Work Disk", on which are 7 program examples (in TGI and LOGO called: procedures):
BOX STARSQUARE STAR TRIANGLE SAMPLEDESIGNS SYDFLOWER SYDSTAR
This procedures can loaded into TGI with the command LOAD FILENAME
and start with the PROCEDURE_NAME.
- Example
LOAD BOX
BOX
Commands[edit | edit source]
This is from COMPUTE!'s Gazette Magazine and Disk October 1984 (Issue 16 Vol. 2, No. 10):
Here are the list of the 30 TGI commands and its abbreviations.
It is important, that between the commands and paramters in numbers are a space!
Example: FD 50
Turtle Commands and Primitives[edit | edit source]
Command: Short: Command Example: Remarks: ================================================================= FORWARD FD FORWARD 50 RIGHT RT RIGHT 90 LEFT LT LEFT 90 REPEAT RP REPEAT 4 [FD 50 RT 90] PENUP PU - stops turtle from drawing PENDOWN PD - starts turtle drawing (default) PENERASE PE - turtle erases lines and dots if PENDOWN PENDRAW PW - turtle draws if PENDOWN (returns to current PENCOLOR) (default) PENCOLOR PC PENCOLOR 0 with 0-15 like the C64 colors; pencolor changes the color of the entire picture, thereby avoiding Commodore color conflicts (where one color bleeds into another) BACKGROUNDCOLOR BC BACKGROUNDCOLOR 0 with 0-15 like the C64 colors for changing background color TURTLECOLOR TC TURTLECOLOR 0 with 0-15 like the C64 colors for changing turtle color SHOWTURTLE ST - (default) HIDETURTLE HT - CLEARSCREEN CS - sets turtle position to 0,0 heading 0 (HOME) & clears graphics screen HOME - - sets PENUP mode, sends turtle to position 0,0 heading 0, then returns to whichever mode turtle was in before CLEAN - - clears graphics screen but does not send turtle HOME SETHEADING SETH SETHEADING 0 / SETHEADING -90 sets turtle's heading SETPOSITION SETP SETPOSITION 0 0 / SETPOSITION -50 -50 sets PENUP mode, sets turtle's X and Y coordinates, then returns to whichever mode turtle was in before PRINTHEADING - - prints turtle's heading PRINTPOSITION - - prints turtle's X and Y coordinates QUIT - - quits TGI but does not reset computer or erase program or procedures in memory.CONT
will continue from where you were.RUN
will clear memory and restart TGI for another user.
Editing Commands[edit | edit source]
Command: Short: Command Example: Remarks: =============================================================================================================== DEFINE - DEFINE PROCEDURENAME enters input mode, displaying procedure name folled by a question mark and a space, allowing two lines of procedure to be input; 80 characters less the length of procedure name and less the question mark and space following it. Interestingly, it allows redefining of preset commands and primitives ERASE - ERASE PROCEDURENAME clears memory of specific procedures ERASEALL - - clears memory of all procedures NAMES - - lists names of all procedures in memory, will overrun text area PRINTPROCEDURE PPROC PRINTPROCEDURE PROCEDURENAME lists the contents of specific procedure, will overrun text area RENAME - RENAME OLDPROCNAME NEWPROCNAME renames a procedure
File Commands[edit | edit source]
It is recommend not to use quotes!
- LOAD
Reads in a set of procedures from a file on disk, quotes MUST be consistent; if SAVEd with single or double quotes, can only be LOADed with single or double quotes. Examples:
LOAD FILENAME LOAD "FILENAME LOAD "FILENAME"
- SAVE
Saves a set of procedures in a file on disk, quotes MUST be consistent; if SAVEd with single or double quotes, can only be LOADed or SCRATCHed with single or double quotes. Examples:
SAVE FILENAME SAVE "FILENAME SAVE "FILENAME"
- SCRATCH
Erases a file on disk, quotes MUST be consistent; if SAVEd with single or double quotes, can only be SCRATCHed with single or double quotes. Examples:
SCRATCH FILENAME SCRATCH "FILENAME SCRATCH "FILENAME"
- Notes
The files are saved as SEQ file with the FILENAME and the file type .TURTLE on disk.
If you save a file as BOX the directory of the disk shows: BOX.TURTLE
The FILENAME is mostly the PROCEDURE_NAME!
Key Commands[edit | edit source]
- CLR/HOME : Clears the text portion of the screen and homes the cursor (regardless of whether the SHIFT key is pressed).
- F1 : Changes the border color.
- F3 : Changes the text-background color.
- CRSR keys : Trying to move from the text window into the hires screen will be treated as a CLR/HOME.
- RUN/STOP : Break the TGI and you are back in BASIC. Restart with
CONT
.
Note: CTRL +G on most Logo's will break the turtle out of a loop. In Turtle Graphics Interpreter, this option doesn't exist. However it can be replicated by pressing RUN/STOP and typing GOTO 150
. This will not clear the memory and all your procedures will still exist. If you hit RUN/STOP and RESTORE , type GOTO 120
to bring back the drawing screen (the screen will be CLEANed, and the turtle will not be HOMEd.) Again, your procedures will be intact. It is recommended that you save your procedures and restart the program, as it can become unstable.
Program Examples[edit | edit source]
This code examples are from COMPUTE!'s Gazette Magazine and Disk October 1984 (Issue 16 Vol. 2, No. 10, pages 90-94):
- Rectangle:
RP 2 [FD 80 RT 90 FD 30 RT 90]
- Hexagon:
RP 6 [FD 100 RT 60]
- Pentagon:
RP 5 [FD 100 LT 72]
- Pentagram:
RP 5 [FD 161.8 LT 144]
- Two pentas:
SETP -60 -80 SETH 90 PENTAGON LT 36 PENTAGRAM
- Arrow:
RECTANGLE LT 90 FD 15 LT 135 RP 2 [FD 42.4 LT 90] LT 45 FD 15 PE FD 28 PW
- Honey comb:
SETP -30 30 SETH 330 RP 6 [RP 6 [FD RT 60] RT 120 PU FD 25 LT 60 PD]
- Honey comb2:
RP 6 [FD 25 RT 60] RT 120 PU FD 25 LT 60 PD
Note: Also in the demo file on the TGI Logo Work Disk as: SAMPLEDESIGNS
- TGI Logo Work Disk
This program examples are on the TGI Logo Work Disk and must load into TGI. The loaded procedure names are in small words. To run a procedure input its procedure name.
- BOX : box
- STARSQUARE : square - window - star - simplestar
- STAR : star
- TRIANGLE : triangle
- SAMPLEDESIGNS : arrow - arrows2 - rectangle - honeycomb - honeycomb2 - hexagon - pentagon - pentagram - twopentas (this figures are also shown as program examples!)
- SYDFLOWER : stem - ground - leaves - move - triangle - blossom - DAISY (last procedure for painting all procedures!)
- SYDSTAR : star
References[edit | edit source]
- ↑ COMPUTE!'s Gazette October 1984 Issue 16 Vol. 2, No. 10, p. 90-94
Links[edit | edit source]
- C64Games.de - Game No. 6066 + Manual - "Turtle Graphics Interpreter" Compute!'s Gazette October 1984