LEARNING WITH LOGO PART 6
by Richard Gerlach
Part 5 we used a primitive that was the same as POKE in SmartBASIC, the
primitive .DEPOSIT. This lesson we will explore the other primitives
also considered dangerous. We will also discuss what they actually do in
SmartLOGO, and last, we will run a little program.
The primitive [ .VERSION]
By entering this primitive, you will get only the version of your
SmartLOGO. The version should be 3.11 or higher. Any thing less, and you
need an updated version.
The primitive [ .PRIMITIVES]
By entering this primitive, you will get a listing of all the primitives
that ADAM knows, but you should have fan fold paper if you plan on
printing it out. It uses about four pages, and then it only lists the
names, not the fuctions.
The primitive [ .EXAMINE]
By entering this primitive, you can actually peek into a location of
memory, to see what value is located there. This is the same fuction as
PEEK in SmartBASIC. You can not change the value with this primitive.
The primitive [ .DEPOSIT]
This is your POKE command like in SmartBASIC. You can change the value
of any memory location with this command. You can also mess up your
Logo, requiring a reboot. BEFORE you use this primitive, REMOVE your
copy of SmartLOGO from the drive, so that you will not destroy it by
error. Also save any work prior to poking around into the memory
locations. This advice comes from lots of expertise in the area of
destroying media and programs.
The primitive [ .CALL]
This primitive is the same as in SmartBASIC, by which I mean that you
can CALL or transfer control to a sub-routine in SmartLOGO, at the
address in which you call. This primitive is great at locking up a
program if you do not know what you are calling. Be very careful with
this one.
The primitive [ .ALLOCATE]
By use of this primitive, you can reserve a part of the momory for
special use. You can install a sub-routine here, or a machione language
code command. You are limited here by the addresses you can reserve. The
highest byte is 31740, and the lowest is 31740 - your value + 1.
Remember that by reserving the memory, you cut out the ready available
memory you use.
The primitive [ .CONTENTS]
This primitive will print out a list of all objects that SmartLOGO knows
in its memory, other then primitives. This includes all of your
procedures, names, properties, and any unique words or symbols you have
typed. You must enter the commands ERALL RECYCLE after you examine the
contents to free up your memory.
NOW, for a little graphic fun. There was a German mathematician named
David Hilbert, who invented a curve. By using his math equation, we can
draw a pretty little design on our screen. So we called our program
after him, (Hilbert). The basic shape is divided up into smaller basic
shapes, as can be seen when the program runs, at different levels.
To run the program you will have to entewr the name, plus three values.
The values should be in decending order, and the best values for a
beginning run would be:
HILBERT 8 4 1 (return)
The listing is as follows:
TO HILBERT :SIZE :LEVEL :INVERT
IF :LEVEL < 1 [STOP]
ST CS
PU SETPOS [60 -30] PD
HBERT :SIZE :LEVEL :INVERT
HT WAIT 300 CT (remove this line to keep on END screen after drawing
picture)
TO HBERT :SIZE :LEVEL :INVERT
IF :LEVEL = 0 [STOP]
LT :INVERT * 90
HBERT :SIZE :LEVEL -1 -1 * :INVERT
FD :SIZE
RT :INVERT * 90
HBERT :SIZE :LEVEL -1 :INVERT
FD :SIZE
HBERT :SIZE :LEVEL -1 :INVERT
RT :INVERT * 90
FD :SIZE
HBERT :SIZE :LEVEL -1 -1 * :INVERT
LT :INVERT * 90
END
Hope you enjoy these !
Back to
Top
|