Commodore 64 Logo by Terrapin

This list was adapted from Learning With Logo by Daniel Watt, an excellent and highly recommended book. When I started this list, I didn't have an original Commodore 64 Logo manual, so this list is incomplete, and likely contains inaccuracies. After I purchased the manual and added a copy of it to my site, I was not really motivated to complete this list. Additionally, it was written while I was experimenting with an early, buggy version of Commodore Logo which I have now replaced with Commodore Logo Version 8.

This list will at least provide a base to begin learning and exploring. There are additional commands on the Utilities disk for using sprites, sound, and printers; refer to the manual text for further info. Searching the internet for additional Terrapin Logo, Commodore 64 Logo, Apple II Logo and TI Logo commands and primitives may be helpful.

***At the bottom of this document are some Apple Terrapin Logo commands and their C64 Terrapin Logo equivalents.

Enjoy! I probably won't update this list now that I have the manual, but if anyone feels like adding to or correcting this list, please email me at mikeebean@hotmail.com and I'll include your changes on my site.

Command / Short Form / Examples with Inputs
Explanation or Notes

--------
Turtle Commands and Primitives:

FORWARD	FD	FORWARD 10
		FORWARD -10
		FORWARD :VARIABLE

BACK		BK	BACK 10
			BACK -10
			BACK :VARIABLE

RIGHT		RT	RIGHT 90
			RIGHT -90
			RIGHT :VARIABLE

LEFT		LT	LEFT 90
			LEFT -90
			LEFT :VARIABLE

PENUP		PU	-
stops turtle from drawing

PENDOWN	PD	-
starts turtle drawing (default)

PENERASE	-	-
erases lines and dots if PENDOWN, whereas drawing over lines and dots with the background color causes Commodore color conflicts (colors bleed into each other). Unknown what cancels this command, however PENCOLOR changes will work

PENCOLOR	PC	PENCOLOR 1
			PENCOLOR :VARIABLE
				0 = black
				1 = white
				2 = red
				3 = cyan
				4 = purple
				5 = green
				6 = blue
				7 = yellow
				8 = orange
				9 = brown
				10 = light red
				11 = dark gray (gray 1)
				12 = medium gray (gray 2)
				13 = light green
				14 = light blue
				15 = light gray (gray 3)

BACKGROUND	BG	BACKGROUND 0
			BACKGROUND :VARIABLE
				see color list above

SHOWTURTLE	ST	-
(default)

HIDETURTLE	HT	-

DRAW		-	-
clears graphics screen & sets turtle position to 0,0 heading 0
(HOME)

HOME		-	-
sends turtle to position 0,0 heading 0. If in PENDOWN mode, the
turtle will draw as it moves

CLEARSCREEN	CS	-
clears graphics screen but does not send turtle HOME

NODRAW	ND	-
shows and clears text screen until drawing commences

CLEARTEXT	-	-
clears text screen

WRAP		-	-
allows turtle to go off the screen and reappear on opposite
side (default)

NOWRAP	-	-
prevents turtle from going off the screen

FULLSCREEN	F5 key	-
shows graphics screen without text until error or disk access
note: F5, F3 and F1 do not work following disk access but
recover after drawing

SPLITSCREEN	F3 key	-
shows graphics screen with text
note: F5, F3 and F1 do not work following disk access but
recover after drawing

TEXTSCREEN	F1 key	-
shows text screen only and stays on text even if drawing
note: F5, F3 and F1 do not work following disk access but
recover after drawing

SETXY		-	SETXY 100 30
			SETXY (-100) (-30)
			SETXY :VARIABLE :VARIABLE
sets turtle's X and Y coordinates. If in PENDOWN mode, the
turtle will draw as it moves

SETX		-	SETX 100
			SETX -30
			SETX :VARIABLE
sets turtle's X coordinate. If in PENDOWN mode, the turtle will
draw as it moves

SETY		-	SETY 100
			SETY -30
			SETY :VARIABLE
sets turtle's Y coordinate. If in PENDOWN mode, the turtle will
draw as it moves

SETHEADING	SETH	SETHEADING 90
			SETHEADING -90
			SETHEADING TOWARDS 20 10
sets turtle's heading

XCOR		-	PRINT XCOR
			SETX XCOR + 20
returns turtle's X coordinate

YCOR		-	PRINT YCOR
			SETY YCOR + 20
returns turtle's Y coordinate


HEADING	-	PRINT HEADING
			IF HEADING = 0 STOP
returns turtle's heading

GOODBYE	-	-
clears memory and restarts Logo for another user 

--------
Editing Commands:

TO		-	TO
			TO PROCEDURENAME
			TO [PROCEDURE1 PROCEDURE2]
enters edit mode, displaying procedure name and content if any, blank page if just TO

END		-	-
used as the end of a procedure in edit mode

EDIT		ED	EDIT
			EDIT ALL
			EDIT PROCEDURENAME
			EDIT [PROCEDURE1 PROCEDURE2]

enters edit mode, displaying procedure name and contents if
any. EDIT by itself will edit the last usage of the edit mode,
or blank page if no procedures

ERASE 	ER	ERASE ALL
			ERASE PROCEDURENAME
			ERASE [PROCEDURE1 PROCEDURE2]
clears memory of all or specific procedures

PRINTOUT	PO	PRINTOUT
			PRINTOUT ALL
			PRINTOUT NAMES
			PRINTOUT PROCEDURENAME
			PO [PROCEDURE1 PROCEDURE2]
		POTS	PRINTOUT TITLES
ALL lists all memory contents including variable, NAMES lists
names of all variables and their contents in memory,
PROCEDURENAME lists the contents of the specific procedure,
PRINTOUT TITLES or POTS lists names of all procedures in memory.
Usage of PRINTOUT by itself is uncertain.

DEFINE	?	?
Uncertain usage. May involve creating a new procedure using variables or
user input, however it is not explained in the book I am using.

--------
File Commands:

READ		-	READ "FILENAME
reads in a set of procedures and variables from a file on disk

SAVE		-	SAVE "FILENAME
saves all procedures and variables in memory in a file on disk

ERASEFILE	-	ERASEFILE "FILENAME
erases a file on disk. If used in splitscreen mode, freezes the
computer

READPICT	-	READPICT "FILENAME
reads a graphics screen from disk

SAVEPICT	-	SAVEPICT "FILENAME
saves a graphics screen on disk

ERASEPICT	-	ERASEPICT "FILENAME
erases a graphics screen file on disk

CATALOG	-	-
lists files on disk

SETDISK 	?	?
How this command applies to the Commodore version is uncertain. Apple version: One to three inputs (Drive, Slot, Volume (last 2 optional) . No outputs. Sets the disk drive to Drive, slot to Slot, and volume to Volume.

DOS		?	?
Unknown usage 

--------
Input, Output, and Printing Commands:

PRINT			PR	PRINT [TEXT]
				PRINT 8
				PRINT -8
				PRINT :VARIABLE
				PRINT XCOR
				PRINT HEADING

PRINT1		?	PRINT1 [TEXT]
unknown usage

REQUEST		RQ	MAKE "VARIABLE REQUEST
gets input from keyboard until RETURN is pressed

READCHARACTER	RC	MAKE "VARIABLE READCHARACTER
gets single key input 

RC?			-	IF RC? OUTPUT READCHARACTER
Unknown usage. Appears similar to GET in BASIC. If no key is pressed, continues to next command.

CURSOR		?	CURSOR 1 1
Moves cursor to coordinates. Apparently can also output column and line numbers of cursor position. Unknown usage.


TEXT			?	?
Unknown usage. Outputs the definition of Name as a list of lists.


OUTPUT		?	?
Unknown usage.

PADDLE		?	PRINT PADDLE 1
				FORWARD PADDLE 0
Unknown usage. Outputs variable from paddle/joystick ports. Outputs number between 0 and 255 representing the rotation of the dial on the specified paddle.

PADDLEBUTTON	?	PRINT PADDLEBUTTON 0
				OUTPUT PADDLEBUTTON 0
				IF PADDLEBUTTON 1 DRAW
Unknown usage. Outputs true or false if paddle/joystick button is pushed

JOYSTICK		?	?
Unknown usage. 

JOYBUTTON		?	?
Unknown usage.
 
PRINTER		?	?
Unknown usage. Turns on and off output of text to printer. Apple: Message to Logo that any subsequent information displayed on the screen is to be printed. Example: .PRINTER 1 If printer card is in slot # I, sends text to printer. Use PRINTER 0 to turn off printer and to return to screen.

--------
Arithmetic & Number Commands: (THIS SECTION UNEDITED AND UNTESTED)

+		-	FORWARD :VARIABLE + 10
			PRINT 5 + 3+ Two inputs (Xl, Xl). One output.
Outputs the sum of its inputs.
Example: 4+5, 4 + 5,3+3+3
All output 9


-		-	FORWARD :VARIABLE - 10
			PRINT 5 - 3- Two inputs (Xl, Xl). One output.
Outputs the result of Xl- Xl.
Example: 5 - 3, 5 - 3, 5 - 3
All output 1

- 		-	?
Outputs the negative of Xl.
Example: - 5
Outputs - 5


*		-	FORWARD :VARIABLE * 10
			PRINT 5 * 3* Two inputs (Xl, Xl). One output.
Outputs the product of its inputs.
Example: 5*6, 5 * 6
Both output 30


/		-	FORWARD :VARIABLE / 10
			PRINT 360 / 12/ Two inputs (Xl, Xl). One output.
Outputs Xl divided by Xl.
Example: 8/4, 8 / 4
Both output 1



REMAINDER	-	PRINT REMAINDER 17 3
			MAKE "VARIABLE REMAINDER :VARIABLE 2
returns remainder of first number divided by second number
REMAINDER Two inputs (Xl, X2). One output.
Outputs the remainder obtained when Xl is divided by Xl.
Example: REMAINDER 17 5
Outputs 1.

ROUND One input (N). One output.
Outputs N rounded to the nearest integer. 
Example: ROUND 5.501
Outputs 6.

SQRT		-	PRINT SQRT 100
			MAKE "A SQRT :VARIABLE
returns square root of a numberSQRT One input (N). One output.
Outputs the square root of N, or error message if N is negative.
Example: SQRT 36
Outputs 6.


RANDOM	-	PRINT RANDOM 20
			MAKE "A 1 + RANDOM 99
			PRINT RANDOM :VARIABLE
returns a random number from 0 to number following the command.
RANDOMIZE should be used at the start of program to seed the
random number generator, otherwise the pattern of 'random'
numbers will be same every time the computer is restarted
RANDOM One input (N). One output.
Outputs a random non-negative integer less than N. 
Example: RANDOM 6 
OutputsO,1,2,3,4,or5.


RANDOMIZE
RANDOMIZE should be used at the start of program to seed the
random number generator, otherwise the pattern of 'random'
numbers will be same every time the computer is restarted

NUMBER?

COUNT One input (List). One output.
Outputs the number of elements in List.
Example: COUNT [HOW MANY ARE THERE] Outputs 4.

SIN One input (N). One output.
Outputs the sine of N degrees.
Example: Sin 30
Outputs .5.

COS One input (N). One output.
Outputs the cosine of N degrees.
Example: COS 60
Outputs .5.

QUOTIENT Two inputs (Xl, X2). One output.
Outputs Xl divided by X2, truncated to an integer. 
Example: QUOTIENT 18 4
Outputs 4.

--------
Words, Lists and Variable Commands: (THIS SECTION UNEDITED AND UNTESTED)

MAKE Two inputs (Object, Name). No output.
Gives the variable Name the value Object. 
Example: MAKE "THIS 475
PR :THIS
475


THING One input (Name). One output.
Outputs the value of the variable Name.
Example: MAKE "SIZE 33
THING :SIZE
Outputs 33


WORD Two inputs (Word I, Word2). One output (Word).
Outputs a word made up of Word I and Word2. Example: WORD "BAT'MAN
Outputs BATMAN.
# (WORD Word 1, Word2, Word3,...)


SENTENCE	SE SENTENCE Two inputs (Object!, Object2). One output (List).
SE Outputs a list made up of the words in Object! and
Object2.
Example: SENTENCE [NOW IS][THE TIME] Outputs [NOW IS THE TIME].
# (SENTENCE Object!, Object2, Object3, . . .)


FIRST One input (Object). One output.
Outputs the first element of Object.
Example: FIRST [A B C]
Outputs A.


BUTFIRST	BF BUTFIRST One input (Object). One output.
BF Outputs all but the first element of Object.
Example: BUTFIRST [NOW IS THE TIME]
Outputs IS THE TIME.


LAST One input (Object). One output.
Outputs the last element of Object.
Example: LAST [CAT COW HEN DOG]
Outputs DOG.


BUTLAST		BL BUTLAST One input (Object). One output.
BL Outputs all but the last element of Object.
Example: BUTLAST [NOW IS THE TIME] Outputs NOW IS THE


ASCII		ASCII One input (character). One output.
Outputs the ASCII code for character.
See Appendix B for the full ASCII character set. Example: ASCII "D
Outputs 68

CHAR		-	PRINT CHAR 17
used to print commodore-ascii characters or send formatting
commands to a printer. Apple: Outputs the character whose ASCII code is N. Example: CHAR 65 Outputs A.

FPUT Two inputs (Object, List). One output.
Outputs a new list formed by putting Object at the beginning of the List.
Example: FPUT "RAT [BAT HAT]
Outputs [RAT BAT HAT].

LPUT Two inputs (Object, List). One output.
Outputs a new list formed by putting Object at the end of the List.
Example: LPUT "123 [BAT HAT]
Outputs [BAT HAT 123].

ITEM Two inputs (N, List). One output.
Outputs the Nth element of List.
Example: ITEM 2 [ROME CHICAGO MOSCOW] Outputs CHICAGO.

LIST Two inputs (Object!, Object2).
Outputs a list whose elements are Object! and Object2.
Example: LIST "HOUSE [BARN CABIN]
Outputs [HOUSE [BARN CABIN]]
# (LIST Object! Object2 Object3 . . .)

LOCAL One input (Name). No outputs.
Makes its inputs local to the procedure where LOCAL occurs.
# (Local Name1, Name2, Name3, . . .)

--------
Procedure Control & Conditional Commands: (THIS SECTION UNEDITED AND UNTESTED)

REPEAT

IF Inputs: (Pred, Instructionlistl, Instructionlistl (optional".
Outputs-whatever instruction list outputs (if any). If Pred is TRUE, runs Instructionlistl. If Pred is FALSE, runs Instructionlistl.
Example: IF (FIRST:NAMES) = "MITCH [PR [HI MITCH]] [PR [NOT HERE]]
Prints HI MITCH if condition is met.


STOP Stops the current procedure and returns control to the caller.

> Two inputs (Xl, Xl). One output.
Outputs "TRUE if Xl is greater than Xl, "FALSE otherwise.
Example: 5>4, 5 > 4
Both output "TRUE

< Two inputs (Xl, Xl). One output.
Outputs "TRUE if Xl is less than Xl, "FALSE otherwise.
Example: 4<5, 4 < 5
Both output "TRUE

= Two inputs (Objectl, Objectl). One output.
Outputs "TRUE if Object 1 equals Objectl, "FALSE otherwise.
Example: 4=4, 4 = 4, (FIRST "OTHELLO) = "0
All output "TRUE


TEST One input (Pred). No outputs.
Stores value of Fred (TRUE or FALSE) for subsequent tests.
Example: See IFTRUE or IFFALSE.

IF

IFFALSE IFF One input (Instructionlist).
Runs Instructionlist if result of most recent TEST was FALSE.

IFTRUE IFT One input (Instructionlist).
Runs Instructionlist if result of most recent TEST was TRUE.
Example:
TEST :X > 5
IFT [PR [THE NUMBER IS GREATER THAN 5]]
IFF [PR [GIVE ME A BIGGER NUMBER]]

ALL

ALLOF

ANYOF

NOT

AND Two inputs (Pred!, Pred2). One output (TRUE or
FALSE).
Outputs TRUE if Pred! and Pred2 are true; FALSE otherwise.
# (ANDPred!,Pred2,Pred3,.. .).
Example: AND :X>5 :X<1O
Outputs TRUE if X is between 5 and 10.

NOT One input (Pred). One output (TRUE or FALSE).
Outputs TRUE if Fred is FALSE; TRUE otherwise. Example: NOT EQUAL" ABC" 123
Outputs TRUE.

OR Two inputs (Pred!, Pred2). One output (TRUE or
FALSE).
Outputs FALSE if both inputs are false. TRUE otherwise. (OR (Predl, Pred2, Pred3 . . . .) # Example: OR :X <5 :X> 10
Outputs "TRUE if X is outside of 5-10.

ELSE

TOPLEVEL

OUPUT		OP OUTPUT One input (Object). One output (Object).
OP Makes Object the output of current procedure, and returns control to the caller. 
Example: OUTPUT :SIZE
Outputs the value of SIZE, which must now be used as input.

RUN One input (Instructionlist). Same outputs as Instructionlist, if any.
Runs Instructionlist as if typed directly. 
Example:MAKE "COMMANDS [REPEAT 6 [FD 50 RT 60]
RUN :COMMANDS
Draws a hexagon.


PAUSE No inputs. One output (Message).
Suspends current procedure and outputs Message. Resumes with CO


CONTINUE CO One input (Object-optional). No outputs.
Resumes running a procedure after a PAUSE or CTRL-Z. If CO has an input, it becomes the output from PAUSE.

GO One input (Name). No outputs.
Used to loop back to instruction following LABEL.
Example: TO COUNTUP
MAKE "X 1
 no procedure named LABEL "LOOP
PRINT :X
MAKE "X :X + 1
GO "LOOP
END
It is better to use recursion than to use GO like this.

--------
Miscellaneous Commands:

TRACE		-	-
turns on program tracing for debugging purposes. Each program
line is printed on the screen and executed one at a time. You
must press RETURN to proceed to the next line

NOTRACE		-	-
turns off program tracing

TOWARDS		?	?TOWARDS One input (Position). One output (Heading).
Outputs Heading to make turtle face Position. 
Example: SETHEADING TOWARDS [20 10] Heads the turtle in the direction of position [20 10].

.DEPOSIT	-	.DEPOSIT 53280 0
this example actually doesn't do anything, so this command may or may not work. At any rate Logo recognizes it so it may be there but unimplemented. Used in Apple Terrapin Logo to send data directly to the computer's memory. Similar to POKE statements in BASIC. Apple: .DEPOSIT Two inputs (N,A). No outputs. Writes A into machine address N.



;		-	; DAN'S PROGRAM
used before notes and remarks in procedures so that the program can be more easily understood by people, but the computer will overlook the remarks. Same as REM in BASIC.

--------
Special Keys Used in Command Mode:

RETURN or CTRL-M		sends Logo a typed command. ENTER key
on emulators

DEL or CTRL-T		erases the character to the left of the
cursor

CTRL-D			erases the character at the cursor
position (delete character)

CRSR <-	or <- key	moves the cursor back one space

CRSR ->	or CTRL-;	moves the cursor ahead one space

CTRL-A			moves cursor to beginning of line

CTRL-L			moves cursor to end of line (last)

CTRL-0 through 8		changes text color, see color list under PENCOLOR

C=-1 through 8		changes text color, see color list under PENCOLOR

CTRL-E			changes text color to white

CTRL-=			returns text color to default blue

CTRL-9			turns on reverse mode until you press RETURN

CTRL-0			turns off reverse mode

CRSR UP	or CTRL-P	copies previous command onto current
command line

CTRL-K			deletes all characters at and to the left of the cursor (kill)

CTRL-W			pauses whatever Logo is doing until another keypress

CTRL-Z			Interrupts whatever is running, causing a PAUSE.
Resumed with CONTINUE or CO

CTRL-G			stops whatever Logo is doing

F1 key or TESTSCREEN	shows text screen only and stays on
text even if drawing. Note: F5, F3 and F1 do not work following
disk access but recover after drawing

F3 key or SPLITSCREEN	shows graphics screen with text. Note:
F5, F3 and F1 do not work following disk access but recover
after drawing

F5 key or FULLSCREEN	shows graphics screen without text
until error or disk access. Note: F5, F3 and F1 do not work
following disk access but recover after drawing.

C= key combinations	all of its color and graphics are supported

SHIFT-C= key		switches from upper case (default) and
lower case

RUN/STOP + RESTORE	resets Logo for new user, erases memory. Same as GOODBYE

--------
Special Keys Used in Edit Mode:
CTRL-Q Allows insertion of delimiting characters.?

RETURN or CTRL-M	moves the cursor to a new line. Any
text at and to the right of the cursor is moved down with it.
ENTER key on emulators

DEL or CTRL-T		erases the character to the left of the
cursor

CTRL-D			erases the character at the cursor
position (delete character)

CRSR <-	or <- key	moves the cursor back one space

CRSR ->	or CTRL-;	moves the cursor ahead one space

CRSR UP	or CTRL-P	moves the cursor up one line (previous
line)

CRSR DOWN or CTRL-N	moves the cursor down one line (next
or CTRL-Q		line)

CTRL-L			moves the cursor to the end of a line

CTRL-A			moves the cursor to the beginning of a
line

CTRL-F or CTRL- <- key	moves the cursor forward one screenful
of text

CTRL-B			moves the cursor back one screenful of
text

CTRL-K			erases (kills) an entire line from and
to the right of the cursor

CTRL-O			opens a new line at the cursor
position. Any text at and to the right of the cursor is moved
down one line

CTRL-C	returns to Command Mode and defines all procedures
being editd (also ESC on certain emulators)

CTRL-G			returns to Command Mode without
altering or defining any procedures

C= key combinations	all of its graphics are supported

SHIFT-C= key		switches from upper case (default) and
lower case

----------------------------------------------------------------------------------------------
*********************************************************************************
Apple II vs. Commodore 64 (INCOMPLETE LIST, Both Apple Logo and Terrapin Logo commands listed)

-----------
Unutilized/Different Commands: 

APPLE II  /  COMMODORE 64 EQUIVALENT

PENCOLOR 2	use PENCOLOR 5 instead
PC 3		use PC 4 instead
PC 4		use PC 8 instead
PC 5		use PC 6 instead

BACKGROUND 6	unutilized mode on C64, use PC 1, BG 0 to simulate

TURTLESTATE TS	use DRAWSTATE instead, PRINT DRAWSTATE outputs an additional 5 items over the Apple version. Additionally, items 3 and 4 are switched.

OUTDEV		use PRINTER instead

FENCE 		use NOWRAP instead

--------
Unutilized/Different Keys:

APPLE II  /  COMMODORE 64 EQUIVALENT

CTRL-T		use F1 instead

CTRL-S		use F3 instead

CTRL-T		use F5 instead

ESC			use DEL or CTRL-T instead

REPT			nonexisting key on 64, press desired key repeatedly instead

CTRL-E		use CTRL-L instead

RESET			unutilized key, instead turn computer off and on or press RESET button on C=128 (not really part of Apple Logo or Terrapin Logo, but referred to in the book Learning With Logo, so I listed it)