Logo on the Apple II An Introduction
Chapter 1
Logo on the Apple II: An Introduction
Logo is a language for computers. Compared with natural human languages like English or French, it has a very small number of words and gram matical rules. But Logo can be extended easily. In fact this is what programming in Logo is all about: using what exists to make new things, and then using the new things to make more new things. The initial vocabulary words, which we refer to as Logo primitives, deal with different kinds of com putation including familiar ones such as adding and subtracting numbers and less familiar ones such as manipulating words and lists of words. A different kind of computation is chosen as the focus of this guide. Technically, the area is known as computer graphics. It has become familiar through computer art, special effects, and video games. As an introductory route into program ming, computer graphics has the advantage that you can see how your programs work. Our experi ence is that this is an excellent way to develop an intuitive understanding of what all programming is about. Using This Guide This Guide is an introduction to Logo and to pro gramming. It is intended to highlight some activi ties that you can do; it is not intended to serve as a complete users guide. It tries to present you with what you need to know to get started. It shows you how to program, to edit, and to save and re trieve your work. For more details on particular aspects and other uses of Logo read the appropri ate sections of the Reference Manual The index in the Reference Manual will help you locate the sec tion you want to read. 3
In this Guide we talk about the Logo environ ment as if it were a living thing. Periodically, you will find a section in this Guide marked Bug Box. A bug is a friendly name for things that dont quite work. The Bug Box tries to anticipate what might go wrong and sug gests ways to fix things. The best way to get to know Logo is to try things on your own. So relax, explore, and have fun!
Apple II System
Setting Up What you need to do now is to start up Logo and begin to program. To do this you have to learn to identify certain parts of the Apple system. If you are already familiar with the Apple computer then this section will be very simple. Your Apple II computer system includes a disk drive and a TV monitor. As part of your Logo kit there is also a Logo diskette. You have to put the diskette into the disk drive before you can use Logo. To put in the diskette, open the door of the disk drive by lifting it outwards; a hinge is on top. You should see a slot for the diskette. Hold the diskette so that the label is face up and slide it into the slot of the disk drive, then close the door. The disk drive is now ready to load infor mation from the diskette into the Apple.
Disk Drive
Diskette
Starting Logo To start Logo, turn on the Apple power switch, which is located on the back side of the computer. You can reach it from your left. If the power is al ready on, turn it off and then on again. The disk drive light will go on. After a moment, the light will go off and if all is going well you should soon see a message on the screen saying
PRESS I F YOU INSERT THE RETURN KEY TO BEGIN DISKETTE, RETURN
H A V E YOUR OWN F I L E I T NOW, T HE N P R E S S
You do not need a file diskette to use this Guide or to use Logo. If you do not have a file diskette, just press the r e t u r n key and go on.
Apple Power Switch
Bug Box A file diskette is one on which you can save your programs. If you do not have a file diskette and want to con tinue without one, then just press the r e t u r n key. If you do not have a file diskette and want one now, look in the Reference Manual to find out how to make one. After you press the r e t u r n key, the disk light will go on again. After a few seconds, it will go off and you should now see a message on the screen saying
WE L C OME
WELCOME TO LOGO
TO
LOGO
Below the m essage you will see a ? (question mark) followed by a flashing I (rectangle). The ? (question mark) is the prom pt symbol. When ? (question mark) is on the screen Logo is waiting for you to type something. The flashing! (rectangle) is the cursor. It appears when Logo wants you to type something and shows where the next character you type will appear.
Prompt and Cursor
Bug Box If you have problems starting Logo, try the fol lowing: 1. Reinsert the Logo diskette into the disk drive. 2. Make sure the diskette is properly inserted. The label should face up, at the front of the drive (near your hand). 3. Turn off the Apple, then turn it on again. 4. Make sure any diskette you insert into the disk drive has its label facing up and at the front of the drive. If you still have problems then perhaps your Apple does not have a 16K r a m or language card in slot 0 or the disk drive is not connected properly. The Keyboard The keyboard is like a typewriter. Type any word or sentence to get a feel for the touch of the key board. Logo probably wont understand what you say, but it doesnt matter.
6
For example, type
HELLO THERE
n
Then press the r e t u r with a complaint like
I DON'T
key. Logo will respond
HELLO
KNOW HOW TO
r i & f e 060 KHoD HON TO HELLO
Logo is correct, but thats not important at the moment. Just play with the keys. There is no bad thing that you can do because you can always start Logo up again by turning the computer off and then on again. Details About the Keyboard There are several different kinds of keys; you may be familiar with some. Character Keys Character keys a , b , c , 7 , $, etc. are like those on a typewriter. They include letters of the alpha bet, numbers, and punctuation marks. You are probably most familiar with these keys. The <- Key The <- key is extremely useful. Very few type writers have such keys. This key causes Logo to erase the character before the cursor. Usually, this is the character you just typed. This key is often called the Delete key. Your Logo kit should have a
d e l e t e
sticker for you to put on the front of this key to remind you of this. If not you might want to make one using adhesive tape. The r e t u r n Key The r e t u r n key is found on many electric type writers (where it means carriage return and is used to move the type position to a new line on the paper). In Logo the r e t u r n key serves a function unknown on typewriters. It tells Logo: Now do what I just typed. You use this key every time you want Logo to obey the instructions you give it. The s h i f t Key The s h i f t key can change character keys. Pressed alone, nothing happens. But holding down this key changes the meaning of some of the character keys. For example, while holding the s h i f t key down press n . Logo prints a [ on the screen. We represent this two-key combination as s h i f t - n . s h i f t - m is a ]. s h i f t -4 is $ and s h i f t -; is +. Some of these are marked on all Apple keyboards on the upper portion of the key pad. Check to see whether s h i f t -m and s h i f t - n are marked as ] and [ on the fronts of the M and n keys. If not look in your Logo kit for stickers to mark them. If you cant find stickers, use adhe sive tape. These bracket symbols are very impor ta n t in Logo. Do not confuse them with parentheses, ( ), which are s h i f t -8 and
SHIFT-9.
RETURN
Key
------
S H IF T
Key
For the s h i f t key to have an effect on another key, always press the s h i f t key first and then keep it down while typing the other key.
I m
cm III
| SHIFT
K W g j
E I I
The Space Bar The space bar is a special character key. It prints an invisible (but very important) character called space. Logo uses spaces as word separators. For example, Logo would interpret t h i s i s a w o r d as a single word and would interpret t h i s i s a w o r d as four words. The Control Key The Ct r l key can change character keys into ac tion keys. You use it like the s h i f t key. Press it alone and nothing happens; hold it down and press a certain character key, and something hap pens. These key combinations do not print out on the screen, but Logo responds to them. For example, while holding the c t r l key down press G. We represent this two-key combination as c t r l - g . When we type these two keys together Logo prints
STOPPED! ?
B i n j f i l
4 M I 1 M
H i 11 Space Bar
> --------- S
1^
1^
i - L
ESC m CTRL I F \ u
J7 A >------ < >------ < Ct r l Key
j- g , C O f lC |>Q
LOGO Ofl HOW TO HELLO
The c t r l - g key combination serves a very impor tant function; it signals Logo to stop whatever it is doing. There are several other control key combinations which will be introduced in later sections.