Значок ресурса

Snail Logo

Нет прав на скачивание
Автор: Mel Davies
Год: 1983
Издатели: CP Software
Языки: 🇬🇧 Английский
Формат: 📼 TZX лента
Требования: 🖥️ ZX Spectrum 48K

Ссылки:
Страница на ZXArt
Страница на World Of Spectrum
Страница на Spectrum Computing

Скриншоты:
SnailLogo.gif
SnailLogo.png


SnailLogo_Front.jpg
Forward



A User Guide To SNAIL LOGO



M. DAVIES Copyright 1983



C.P. Software





** NOTE **

There is a printing error in the manual.

Pages 10 (section 3.3) and 19 (sections 4.1, 4.2, start of 4.3)

- ie. the front of the 5th sheet - are blank.





-----



Contents



1. THE GUIDE TO THE GUIDE

1.1 Foreword

1.2 How to use the Guide



2. BACKGROUND & PRINCIPLES OF SNAIL LOGO

2.1 History

2.2 Introducing SNAIL LOGO

2.3 What SNAIL LOGO explores



3. STARTING TO USE SNAIL LOGO

3.1 Introduction

3.2 The Examples

3.3 First Steps

3.4 Next Steps

3.5 Variables

3.6 Procedures and Parameters

3.7 Recursive Procedures

3.8 Calculations



4. THE SNAIL LOGO OPERATING SYSTEM

4.1 Introduction

4.2 Loading the SNAIL LOGO system

4.3 Operating system facilities



5. REFERENCE INFORMATION

5.1 SNAIL LOGO Instruction summary

5.2 Notes on Instruction use

5.3 Operating limits

5.4 Error Reports



Appendix 1 - Use of Zeaker Micro-Turtle.



-----



1 THE GUIDE TO THE GUIDE



1.1 Foreword



The SNAIL LOGO system shares one characteristic with

airline tickets, books and draughts sets. It has to be used to

be appreciated, and listening to someone else talk about

using it is not much fun. So, a guide to using SNAIL LOGO

can only point in the right direction, describe the facilities

available, give some examples and say "FORWARD". The

rest is up to you.



SNAIL LOGO is for learning about, exploring and using

many of the principles of logical thinking. Such principles

apply to activities as varied as designing computer systems

and composing music; anything which involves trying to

define or describe something in an organised way. SNAIL

LOGO can be used by children from the age of 5 or so

(with adult guidance), but it is also found to be entertaining

and instructive by adults, even those who already know

quite a lot about designing things. Different sorts of users

will probably want to use this Guide in different ways and

it does not all have to be studied in depth before getting

started.



1.2 How to use the Guide



The Guide covers all aspects of the SNAIL LOGO system

under five chapter headings, and an outline of each chapter

is given below.



The best way of getting started is to skim through Chapter 2,

especially section 2.2, then jump straight into Chapter 3

and get SNAIL LOGO working. You will then need to use

Chapters 4 and 5 to sort out details and re-read Chapter 2

more carefully in due course.



CHAPTER 1:

Guide to the Guide

You are now reading it!



CHAPTER 2:

Background and Principles of SNAIL LOGO

This chapter briefly recounts the historical reasons for the

development of the language LOGO, and programs like

SNAIL LOGO, then explains the underlying principles.



CHAPTER 3:

Starting to use SNAIL LOGO

A detailed description of how to get SNAIL LOGO up and

running, with examples which lead you into using it

yourself.



-----



CHAPTER 4:

The SNAIL LOGO Operating System

Although SNAIL LOGO has a simple and easy to use

language, using it needs some facilities which together

are known as an operating system. These facilities allow

programs to be written, changed and run, and detailed

explanations are given in this chapter.



CHAPTER 5:

Reference Information

Various facts about the SNAIL LOGO language and system

are noted, to be looked up as required.





NOTE

The SNAIL LOGO system includes an abbreviated form of this Users

Guide in its program, for reference during use. New users should

initially work from this more detailed Guide however.





2. BACKGROUND AND PRINCIPLES OF SNAIL LOGO



2.1. History



Two general points: first, computers and their underlying principles

are important. They are the building blocks of systems which will

become as complex and capable as people. Secondly, there are many

common concepts and ideas underlying the expression of mathematics,

music, logic, genetics and even art. These concepts can be related

to those of computers.



Historically, understanding and using computers has meant becoming

involved in a great deal of detail. So much detail that is becomes

difficult to appreciate the significant principles, and even if you do,

it is hard work to make the computer perform a particular task.

Also, the detail can actually be very interesting so lots of people

never get around to thinking about the principles. The root of the

problem is that although computers can represent very advanced

theoretical concepts, they are implemented today in rather primitive

forms. Because they are primitive, their programming languages

have to be simple for the computer, at the expense of being

complicated and cumbersome for the programmer.



The difficulties of educating people about computers, and more

importantly, the things that can be done with them, have been

addressed by researchers at several centres. Leading one aspect of

the research has been a group at the Massachusetts Institute of

Technology. This group has developed and pioneered the use of a

language named LOGO. Versions of LOGO are now in use in many

educational establishments world-wide. LOGO demonstrates that

a computer language can be both simple and powerful.



-----



2.2 Introducing SNAIL LOGO



The best known feature of LOGO is its so-called "Turtle Graphics".

This idea is based upon a small mechanical turtle, with a pen under-

neath, which crawls along on a large sheet of paper, drawing lines

as it goes. Via a computer, the Turtle can be commanded to

perform movements like FORWARD, and TURN RIGHT. Its

command language is simple but has surprising power. The direct

relationship of the language to the patterns drawn by the turtle also

provides an illuminating visual illustration of programming structures

and sequences, and allows the programmer to observe the operation

of his program. Because it is so easy to use, the programmer may

well be a child, who can use the system to explore their own

ideas. The sense of creative achievement which can come from even

a simple program is a powerful motivating force.



SNAIL LOGO has a language and operating system which provides

an advanced version of "Turtle Graphics". Instead of an actual

mechanical turtle, it uses a graphical snail, which can be made to

move around the computer display screen. In the usual manner of

snails it leaves a track behind it, so it can draw shapes and patterns.



SNAIL LOGO can show many of the principles used in the design of

complicated things - like computer programs. Some of these

principles have particular names, like Hierarchy and Replication, but

it does not matter whether these names are meaningful at the start.

The actual use of SNAIL LOGO will make them clear.



2.3. What SNAIL LOGO explores



In this introduction, some points are illustrated by reference to a

motor-car rather than to a computer program. (Many design

principles are common between the two!) A young child however

can learn the principles from a simple "clean sheet" basis, without

being concerned about comparisons.



Computer languages are sets of words for instructing computers to

carry out specific activities. There are dozens of computer languages,

of many different types. One way of classifying them is by "level".

A low level language (like machine code assembler) is able to instruct

the computer to switch transistors on and off to represent '1's and

'0's. The programmer has to decide how the '1's and '0's are to

represent numbers and facts however, which is an intricate task.



A higher level language (like Basic) has a different sort of vocabulary

and allows large chunks of computer operations to be called for

without troubling about the detailed processes necessary to carry

out each chunk.



-----



Differences between languages can be seen in terms of different

ways of describing a motor-car. To describe to someone exactly how

to build a car, each nut, bolt and component would have to be

specified in an exact sequence, and a low level language would be

used. In principle it would not be necessary to use the word "engine".

That component would be produced by following the instructions

for putting its parts together. Such a description however, would be

a very poor way to explain to a visitor from another galaxy what a

car was, and how it worked. Some much higher level description in

terms of large units like engines and doors would be better, and

ignoring what engines and doors were made from would not matter.



SNAIL LOGO language is very high level. It has simple and powerful

commands like 'FORWARD' and 'REPEAT', which instruct the

Snail to move and to leave a line of track behind it. Also, like

LOGO, there is no need to be concerned with how this works inside

the computer.



There is a reason for SNAIL LOGO having a very high level language.

By making it simple to specify the basic operations, it becomes easy

to explore the ways in which complicated processes and structures

can be built up by combining simple ones in various ways.



Returning to the car illustration, words for parts of a car like seat,

engine and carburettor are not only names for working aspects of

the car, but refer to parts actually designed and made separately. A

car is in fact a group of sub-units which work at different tasks but

cooperate to provide an overall function. A computer program is

similarly made from a structure of different components which can

each contain further components. Such an organisation is called a

hierarchy, and it will also have a sequential organisation. The

components of a program can be called procedures. Some

components are used to assist or service several other components,

like the electrical system of a car. Some components work by

repetition, like a car engine. Sometimes components are replicated

like the wheels, headlights, and front seats of a car. Other

components perform a task which is standard in principle but varies

in some way, like a car gearbox, which always connects some gears

but can have a number of different ratios. Such a variable within a

component is refered to as a parameter. Also, systems like cars or

computer programs can be in different states, like braking or

accelerating, and running or crashed, and these states can be defined

by many separate state variables. Another important process, which

does not have a mechanical analogy but which is useful in computer

programs, is known as recursion.



SNAIL LOGO allows the various aspects of creating and using these

techniques for definition and expression to be explored. All of them

are reflected in the SNAIL LOGO language capabilities, and can be

used in designing graphics programs. They can be observed in

operation because the "Snail" makes its tracks at a speed which

allows the graphics program to be followed as it runs.



A last general point. Learning most computer languages is a rough

equivalent of learning how to put together nuts and bolts, or bricks

and mortar. Learning to draw graphics with SNAIL LOGO is more

the equivalent of learning how to design motor-cars, or houses (and

computer programs of course!).



-----



3. STARTING TO USE SNAIL LOGO



3.1 Introduction



This section leads you into the use of SNAIL LOGO by describing

practical examples. Because this is just to start you off, it only gives

a small sample of the potential of SNAIL LOGO. After studying the

rest of the guide you will be able to expand and enhance the

examples and explore and develop your own ideas.



In case of problems, refer to the other sections of the Guide -

everything is explained.



Before starting the examples these are some important terms

to note:



Instruction, Program and Procedure.



There is no need to remember all the details at once - read the

descriptions below again when you need to.



Instruction: A SNAIL LOGO Instruction is made up of a Command

name, sometimes with values given as a number or a

variable name following the command. Instructions

either cause some action to be taken by the Snail, or

affect the operation of other Instructions. All the

Instructions are shown in Chapter 5, with explanations

of their operation. General principles are as follows:



(a) The Snail always has a position, and a direction. It

changes its position by the number of steps given in the

FORWARD and BACKWARD Instructions, and its

direction by the number of degrees given in RIGHT

and LEFT Instructions. (CENTRE, POSITION,

NORTH and RNORTH also cause changes).



(b) The Snail itself can be visible or invisible, according to

how SNAIL and NSNAIL Instructions are used.



(c) The track of the Snail can be visible or invisible,

according to whether its pen is DOWN or UP. It its

track is invisible, single points of track at its current

position can be shown if an OUTPUT Instruction is

used. The COLOUR Instruction defines the colour of

the track.



(d) REPEAT and PROCEDURE Instructions affect other

Instructions, and are described below.



Program: A program is a list of SNAIL LOGO Instructions which

are obeyed one after the other when the program is

run. The REPEAT and RFINISH Instructions cause all

the Instructions in between them to be repeated the

number of times stated in the REPEAT Instruction. A

program must always finish with an END Instruction.

If variables are used they can be manipulated by SET,

INCREASE, DECREASE and MAKE Instructions, and

inspected by the SHOW Instruction. A program or a

procedure can be made to end only under certain

conditions by the IFEND Instruction.



-----



Procedure: A procedure is a list of Instructions just like a program.

However a procedure can not be run directly. Only

programs can be run. Procedures are used by programs

or other procedures. Procedures each have a name (like

SQUARE or CIRCLE) which you can choose, usually

to indicate what the group of Instructions which they

contain will do. Thus, programs can use the whole

group of Instructions in a procedure just by using the

procedure name. For example: PROCEDURE SQUARE.



3.2 The Examples



When you follow the directions given for the examples in sections

3.3 to 3.8 below, your computer will show the results on its

display. Think about the relationship between the SNAIL LOGO

Instructions used and the patterns produced.



Before starting section 3.3 have a look at the list of SNAIL LOGO

Instructions in section 5.1, and refer to them as necessary to

understand what each Instruction is doing.



SNAIL LOGO is operated from its "Menu" display. The Menu is a

list of facilities displayed on the screen, in three groups. By entering

the single letter code (except for one case of three letters), the

facility is obtained for use. After use, the facility returns to the

Menu so that the next can be selected, Facilities can only be

obtained from the Menu when it is actually displayed.



The ENTER key is usually all that is required to step on from one

stage of a facility to the next, and eventually return to the Menu.

However, if entering a program, editing a program, or entering a

procedure, that operation must be finished first by entering END, or

cancelled, before the ENTER key can be used to return to the Menu.

Read section 4.3(1) NOW, to make sure that you understand this,

and note the use of the Z and U keys. Often the ENTER key must

be used several times to step through a facility to get back to the

Menu.



An important point:- you may find that the various checks and

error messages which arise are annoying! However you will soon get

used to the simple rules, and the checks are very important,

particularly for children. As far as is practicable they make sure that

your SNAIL LOGO program is sensible before you RUN it, so there

won't be silly or confusing results.



Until you alter it by a program, the Snail always starts in the centre

of the screen, pointing "North", with its pen down, and invisible.



Press any keys you like. You will not do any harm to your computer

or SNAIL LOGO, though if you try hard enough, BREAK might

stop SNAIL LOGO running. If you do, just reload from tape.



Early examples describe facility use in detail. Later examples refer to

the use of facilities without repeating all the details. Refer again to

earlier examples if necessary.



Finally, if you do not know what to do at any stage, always try

pressing the ENTER key.



-----



3.3 First Steps



** PAGE BLANK **



-----



3.4 Next Steps



Now to enter some Instructions which make up simple SNAIL

LOGO programs, and run them. To enter an Instruction, the whole

Instruction such as FORWARD 29 is typed, and appears at the

bottom of the screen. The Delete key can be used in the usual way

at that stage. When the instruction is complete the ENTER key is

pressed.



(1) Enter EPR on the menu. (You have now overwritten the Flower

program). The system is now ready to accept program

Instructions.



(2) Enter 123ABC. The result is an error report. (Section 5.4

describes the various types.) ENTER to cancel it. (EN on the

screen means ENTER).



(3) Enter FORWARD 6 (Note the single space). Enter END. That is

an accepted program. ENTER twice to return to the Menu.



(4) Enter R on the Menu to run the program, and watch the

display. Check the 6 forward steps taken by the Snail.

ENTER to return to the Menu.



(5) Enter EPR on the Menu, and then the following program, (using

ENTER after each Instruction).



REPEAT 6

BACKWARD 1

RFINISH

END



(6) Return to the Menu and run the program with R. Notice the

effect of REPEAT and BACKWARD.



(7) Enter L on the Menu to list the program. ENTER to get the

(P)ROC? message, then enter P to convert the program to a

procedure. A request for a procedure name will be shown. Enter

SIXBAC. A request for a procedure number will be shown.

Enter 1.



(8) Enter the following program, (EPR), which uses the procedure

SIXBAC, and run it.



REPEAT 2

PROCEDURE SIXBAC

RFINISH

END



Notice the effect of using the procedure twice (by repeating it).



-----



(9) Enter and run the following programs, given with abbreviated

commands. Use chapter 5 to check the command names. Whilst

entering these programs investigate the effects of entering U

and Z.



(a) SN (b) PO 10,10 (c) RE 9

RI 90 RE 4 FO 15

FO 8 RI 90 RI 160

END FO 8 RF

RF END

END



(10) Enter P on the Menu, and then give the name SQUARE to a

procedure. Give it the number 2. Write the procedure

Instructions to give a square of 6 steps each side. (Hint - look

at example 9(b) above). Enter and run a program to use

procedure SQUARE. (Hint - look at (8) above, but there is no

need to REPEAT the procedure).



(11) Use N on the Menu and see what happens.



(12) Try entering and running this program:



RE 3

PR SQUARE

RI 120

RF

END



(13) Enter E on the Menu for Edit. Enter line number 3. Enter R

for Replace. Enter the Instruction RI 90 (to replace the

Instruction RI 120), then END. When the changed program has

been listed, enter Z to finish the Edit. Run the revised

program.



(14) List the program and convert it to a procedure named

BLOCKS, number 3. Enter and run the following program:



PO 20,20

PR BLOCKS

PO 40,20

PR BLOCKS

END



Note how a hierarchy of procedures may be built up, each

using other procedures. How would you make the two Blocks

appear the same way around?



-----



3.6 Variables



The next set of examples introduces the use of variables. These add

considerably to the power of the SNAIL LOGO language.



A variable is a numeric value which has a name. It is referred to by

its name, so the number which it represents can be any value and can

change, which is why it is called a variable.



SNAIL LOGO has eight different variables, named A,B,C,D,E,F,G,H.

They can all have any positive or negative numeric value. Only

positive whole number values can be entered directly, but negative

or fractional values can be obtained by performing arithmetic on

the variables.



The variables do not all behave in the same way. There are two

different types, "Global" variables and "Local" variables.



Global Variables: E,F,G,H



A Global variable is available to, and can be used by, any program or

procedure in the SNAIL LOGO system. If some procedure called

APPLE sets E to a value of 17, procedure ORANGE can read and

use and change that value. There is only one E, one F, one G, and

one H.



Local Variables: A,B,C,D



There are many copies of each local variable. Every procedure and

the program has its own separate copy. If the program sets A=3,

procedure APPLE cannot see or use that value of 3. APPLE might

set its A=24 and this would not disturb the value of 3 in the

program's copy of A. Procedure ORANGE can use yet another

different value and all the values of A would exist separately.



There is one way in which a program or procedure can set the

values of A,B or C (not D) for another procedure. That is by using

the PROCEDURE instruction. PR APPLE,9 not only calls the

procedure APPLE, but sets the value of procedure APPLE's copy of

A to 9. The PROCEDURE instruction does not affect the value of

the copy of A for the program or procedure in which it occurs. The

use of this facility is described below under the Procedures and

Parameters heading in section 3.6.



Variable D



Variable D is basically an ordinary local variable and can be used as

such. However it is used by the SNAIL LOGO system to hold the

direction in which the Snail is pointing on entry to programs and

procedures. This allows the RNORTH (Relative North) command to

operate, by enabling the "North" direction to be rotated as a

procedure is rotated. If D is altered by Instructions, RNORTH will not

work correctly, though this effect can be useful in advanced

programs.



-----



Controlling and Using Variables



Variables can be used in many Instructions, such as FORWARD A

and REPEAT F. However they have to be given values before being

used. Initially SNAIL LOGO sets all variables to 0. Other values can

be set by a PROCEDURE Instruction as described above, and by

several other types of Instruction.



SET directly gives a value

e.g. SET C,19

INCREASE adds a number to the present value

e.g. INC F,3

DECREASE subtracts a number from the present value

e.g. DEC G,1

MAKE allows arithmetic to be carried out

e.g. MAKE A=B+C

MAKE C=F/G

MAKE D=H*A

MAKE E=D-A



To see the value of a variable on the display screen as the program

runs, use the SHOW Instruction; e.g. SHOW C.



Note that for multiplication using the MAKE Instruction, the star

symbol must be used, as for Basic.



(1) Enter and run the following programs:



(a) SET A,0 (b) SET A,4

RE 6 SET B,5

INC A,20 MA G=A+B

FO 6 MA D=A/B

CE SH G

SH A SH D

RI A END

RF

END



(2) Input the following procedure TAR (give it the number 5)

by entering P on the Menu, then enter the program to use

it, and run it.



Program Procedure TAR

SE H,5 RI 90

RE 4 DE H,1

FO 5 FO H

PR TAR RN

CE END

RI 90

RF

END



This program illustrates both the use of the RN Instruction

(try replacing it with NORTH), and the global nature of the

H variable.



-----



3.6 Procedures and Parameters



These examples illustrate the use of parameters in procedures. Look

at the general form of PROCEDURE Instructions in section 5.1

before starting.



The variables A, B and C used in a procedure can be given values by

the PROCEDURE Instruction which calls that procedure. For

example:



PROCEDURE APPLE,3,10,90



The first number given after the procedure name sets the value of A

in procedure APPLE, the second sets B and the third sets C. This

technique is referred to as passing parameters to a procedure. Thus a

program may call the same procedure a number of times and obtain

different results by passing different parameters. For example, three

different sized squares could be drawn with the three Instructions:



PROC SQUARE,3 PROC SQUARE,5 PROC SQUARE,10



Note that if a PROCEDURE Instruction is included in a REPEAT

loop, the parameters are passed only on the first call. Thus the

parameters are not reset on each loop cycle.



(1) Use P on the Menu and enter the following procedure named

CIRCLE (Number 4):



RE 8

FO A

RI 45

RF

END



Enter and run the following program. Notice the parameter

value of 2 given to the procedure, which is then used as the

value for A in the procedure.



RI 20

RE 4

PR CIRCLE,2

LE 90

RF

END



(2) Use the Edit "Replace" facility to change line 3 of the program

to PR CIRCLE,4 and run it again. Then again use Edit to

"Insert" the Instruction PR CIRCLE,2 as well as, and next to,

PR CIRCLE,4 (Use either line number 3 or line number 4).

Run this program.



(3) Write the following procedure, POLY (decide on your own

numbers from now on), and a program to run it with different

values of A.



Procedure POLY Program

MA B=E/A SET E,360

RE A PR POLY,3

FO 6 PR POLY,5

LE B PR POLY,7

RF END

END



-----



Using the relationship that A times B = 360 gives this particular

kind of result. Try other relationships.



If you have two minutes to spare, this program is worth waiting

for. It uses POLY. The same effect could be obtained, and

would run faster, by writing it as a single program.

SET E,360

RE 16

PR POLY,8

RI 22.5

RF

END



(4) Try this:



Procedure SPIRAL Program

FO C RE 50

IN C,1 PR SPIRAL,1,1,1

RI 90 RF

END END



Note that the values for A and B are dummies, necessary to set

C. Stop this before completion if you wish, by pressing 2.



(5) Write a procedure TRISPI, and a program to use it, that will give

a triangular spiral effect.



(6) Try this:



Procedure SPITRI Program

FO A RE 50

IN A,1 PR SPITRI,1

RI 120 RI 5

END RF

END



(7) Try this:



Procedure GALAXY Program

FO A UP

IN A,1 RE 50

RI 149 OU

END PR GALAXY,1

RF

END



Experiment with different angles in the GALAXY procedure.



(8) Finally note that the simple procedure and program below can

be used for many shapes, simply by using different parameter

values. Try the example given:



Procedure FLEXI Program

RE A PR FLEXI,3,4,720

FO B END

RI C

RF

END



-----



3.7 Recursive Procedures



As has been shown, hierarchic procedures can be written so that a

program may call a procedure HOUSE, which may call a procedure

DOOR, which may call a procedure KNOB. However a procedure

may also call itself; this process is known as recursion.



(1) Try this:



Procedure FRED Program

FO 1 PR FRED

PR FRED END

END



(2) Variables may be used, and changed, for example:



Procedure JOE Program

FO A PR JOE,1

IN A,1 END

PR JOE,1

END



If Bounce is set and Z is not used, both of the above examples

will run until the recursion stack is exhausted, when an error

message END OF RECURSION STACK will be given. To avoid

this, the IFEND Instruction is useful.



(3) Procedure JIM Program

SET B,5 PR JIM,1

FO A END

IN A,1

IFEND A>B

PR JIM,1

END



The conditions for an IFEND Instruction may use local or

global variables. The latter may be set by other procedures or by

program. (How could example 3 above be speeded up slightly

by using a global variable?) Note that IFEND may be used in

any situation, not just with recursive procedures. Use within a

Repeat loop will stop exeeution at that point however.



Careful examination of the running of the examples (2) and (3)

above will show that two single steps are taken before A incre-

ments to 2,3 etc. This illustrates an important point. When a pro-

cedure calls itself recursively, the same copies of its local variables

are used, so that changes to variables made in the procedure are

effective the next time the procedure calls itself. However, this

set of variables is not the same set as allocated by the program

when it first calls the procedure. Thus on the first call, the

program may set the variables and on the recursive call within

the procedure the values of the variables may again be defined,

not necessarily to the same values. It is only on the first

recursive call that the initial value settings will be applied how-

ever, else changes made to variables during the procedure would



-----



be cancelled on each recursive call. It should now be possible to

see why two single steps are first taken by the above examples.

Try experimenting with different values and plenty of SHOW

instructions to see the effects. Use an initial value of 0 in the

program call to avoid an initial movement, as in the next example.



(4) Try this:



Procedure REC Program

RE B SE H,5

FO A PR REC,0

RI 45 END

RF

IN A,1

IF A>H

PR REC,1

END



(5) Try this:



Procedure SQR Program

RE 4 PR SQR,1

FO A END

RI 90

RF

IN A,1

RI 25

PR SQR,1

END



3.8 Calculations



Simple calculations related to shapes may be made as follows:



(1) Perimeter Length



Procedure MOV Program

MA H=H+A SE H,0

FO A RE 2

SH H PR MOV,6,90

RI 8 PR MOV,4,90

END RF

END



(2) Area



Areas can be calculated in a generally similar manner to

perimeters but the area must be sectioned into rectangles and

triangles. This can be shown effectively by first drawing an

outline, then sectioning it and calculating the area of each section

as it is drawn in, with a second variable to sum the running

total. Colour is effective here. A variety of detailed techniques

may be used, and the exercise is left as a project for the user.



-----



4. THE SNAIL LOGO OPERATING SYSTEM

4.1 Introduction

4.2 Loading the SNAIL LOGO system

4.3 Operating system facilities



** PAGE BLANK **



-----



Each facility is described below. The easiest way to become

familiar with them is to use them! General guidance and error

messages are provided throughout.



All SNAIL LOGO inputs need CAPITAL letters, therefore make

sure that the CAPS LOCK remains set.



Have a glance at the reference list of language commands in

chapter 5 before studying the rest of this section if you have

not already done so.



(2) Enter Program (EPR)



This facility allows SNAIL LOGO Instructions to be entered in

sequence to form a program, entering each one with the ENTER

key. Because entering a new program cancels the previous one,

a 3 letter code is used to minimise the chance of accidents.



Line numbering is automatic. The simple organisation of

command words and numbers (the Instruction syntax) is shown

in chapter 5. One space is required between commands and a

number or name, and commas are used to separate variables and

numbers. If Instructions do not have a correct syntax, or cannot

be understood, an error report is given. A list of these reports

appears in section 5.4. Following an error report use ENTER

to cancel that Instruction. Only the first two letters of

each command name are checked, therefore the other letters

can be omitted and an abbreviated form used, which is usually

preferred after a little use. (This also allows commands like

FOSSIL 19 and CLOUD to be input and accepted as

FORWARD 19 and CLEAR however!)



The last Instruction in every program (even for a "do nothing"

program with no other Instructions) must be END.



Instructions which are within a Repeat loop are indented in the

listing, making the repeated sections easy to see. Nested (that is,

inside each other) repeats are further indented.



The number of REPEAT and RFINISH Instructions in a

program must be equal. If they are not, a message saying RF

NOT EQUAL RE gives a warning when you try to END, and

does not permit the END Instruction. Press ENTER to cancel

the message, then add RE or RF Instructions as necessary. The

indentation makes this very easy to check. Almost always, one

more RF is needed. Use U and Z as necessary.



After END is used, an ACCEPTED message is given, which

means what it says, and at that stage two successive messages

(P)ROC? and (C)OPY? indicate that the program can, if you

wish, be converted to a procedure by entering P (followed by

a procedure name and number), and/or copied to a printer

with C.



-----



(3) List Program (L)



This gives a listing of the current program, and after an ENTER, the

standard options are given to convert the program to a procedure, or

copy it to a printer.



(4) Edit Program (E)



This facility allows changes to be made to a program by replacing,

deleting or inserting Instructions. Start by entering a line number.

Deletions and replacements are of the specified line. Insertions are

made before the specified line, so use a number one more than that

of the last line to add extra Instructions at the end of the program.

If a "silly" line number is given, there is a return to the Menu (via

(C)OPY?) if the number was less than 999. (Rubbish inputs are

ignored, as in other aspects of SNAIL LOGO).



After specifying a line number the option to Replace, Insert or

Delete is given. Enter R, I or D. For either R or I, a heading of

"Inserted Instructions" appears and Instructions can be entered in

the usual way. Note that the Instructions entered are line numbered

from 1 at this stage.



Finish a set of "Inserted Instructions" with END to return to the

Edit line number selection stage. Note that END is necessary to

return, even if no Instructions have actually been inserted. A second

line number can then selected for a further edit process. When all

changes are complete, return to the Menu with Z. The Menu return

is via the (C)OPY? option.



Note that when inserting or replacing Instructions, any number of

them can be put in together. Note also that when using Edit, single

RE or RF Instructions can be added or deleted (unlike when

Entering a program, when only pairs of an RE and an RF are

accepted). Warnings are given but "silly" sequences of RE and RF

can therefore be generated by the Editor. Trying to run these will

lead to an error message.



A procedure named in a program PROCEDURE Instruction can be

deleted by having its number used by another procedure definition.

If a program including a PR Instruction with a procedure name

which no longer exists is edited, an error report will be given, and

the PR Instruction omitted from the edited version of the program.



(5) Enter Procedure (P)



Procedures can be generated directly with this facility. First a name

for the procedure must be specified, then a procedure number, from

1 to 9 . Any other number will cause a return to the name entry

stage. If either name or number is omitted there is a return to the

Menu. Different numbers must be used when more than one

procedure is needed, as use of a number causes any other procedure

with that number to be overwritten. If two procedures have the

same name, that with the lower number is used when that name is

called by a program.



Procedures must be defined i.e. named, numbered and entered (the

Instructions can be simply END for a "do nothing" procedure)

before trying to refer to that procedure by name in a PR Instruction.



-----



Thereafter the procedure can be changed by entering a new set of

Instructions under the same name and number. If the system does

not know of a procedure, an error report is given when its name

is used.



Note that if entering a new version of a procedure already called

by some procedure or program, the same number must be used, as

that number is fixed in the procedure call. Even if the procedure is

"cleared" (see below) the calling PROCEDURE Instruction will use

the same number and then treat the non-existent procedure as empty.



All Instructions can be used in the same way as for programs, also

the U and Z facilities. As for programs, RE Instructions and RF

Instructions must match in number within procedures. Again as for a

program, a procedure must be finished with END, and it may then

be copied.



(6) Clear Procedure (C)



This facility cancels a procedure after its name has been entered. If

more than one of the same name exists, only the lower numbered

one will be cancelled. It is advantageous not to allow a large number

of unused procedures to remain as they impose a load on the system

and reduce its speed in some operations.



(7) List Procedure (K)



Gives a listing of the named procedure, and an opportunity to make

a copy of it.



(8) Procedure Names (N)



Gives a list of the currently defined procedures by name and number.



(9) Run Program (R)



Executes the program. An error report will be given if impossible

sequences or unequal numbers of REPEAT and RFINISH

Instructions are found or for division by zero, or at the end of the

recursion stack, or for leaving a repeat loop with IFEND. A

program run can be stopped at the end of its current Instruction by

pressing 'Z'. At the end of a run, the graphics can be copied to a

printer by entering C in response to (C)OPY?.



(10) Set Bounce/Stop Bounce (B)



Allows the walls of the drawing area to reflect the Snail track at an

appropriate angle if desired. This is not serious use of SNAIL LOGO

but can be fun! If a track encounters a wall without Bounce being

set, program execution stops with a WALL message. When Bounce is

set, the border colour is yellow, otherwise blue.



(11) Instructions (I)



Gives a summary of the SNAIL LOGO Instructions on a sequence of

pages, which are accessed by repeated use of the ENTER key, even-

tually returning to the Menu. Entering M will give an immediate

return to the Menu.



-----



5. REFERENCE INFORMATION



5.7 SNAIL LOGO Instruction Summary



In the following Instruction Definitions 'n', 'V' and 'N' have

meanings as below:



n - A number

V - A Variable name A to H

N - A number or a Variable name A to H



The range of numbers differs according to the instruction and is

defined below.



FORWARD N Moves the specified number of steps in the

current direction



BACKWARD N Moves the specified number of steps opposite

to the current direction



RIGHT N Rotates the current direction clockwise by the

specified number of degrees



LEFT N As for RIGHT but anticlockwise



REPEAT N Causes all instructions following it to be repeated

the specified number of times



RFINISH Terminates the effect of REPEAT



POSITION n,n Sets the current position of the Snail to the

values given (Horizontal,Vertical)



COLOUR n Sets the colour of the Snail track



SET V,n Sets the Variable to the value given



DECREASE V,n Subtracts the value given from the Variable value



INCREASE V,n Adds the value given to the Variable value



SHOW V Prints the Variable value and name on the screen



MAKE V=V+V Adds Variables



MAKE V=V-V Subtracts Variables



MAKE V=V*V Multiplies Variables (Note "star" as in Basic)



MAKE V=V/V Divides Variables



IFEND V=V Ends the program or procedure if the condition

is satisfied



IFEND V>V Ends the program or procedure if the condition

is satisfied.



IFEND V<V Ends the program or procedure if the condition

is satisfied.



-----



SNAIL Causes a Snail symbol to be displayed at the

end of each track produced by the

following instructions



NSNAIL Cancels the effect of SNAIL



DOWN Causes Snail tracks (and symbol) generated

after this instruction to be visible



UP Causes Snail tracks (and symbol) generated

after this instruction to be invisible



OUTPUT Causes an element of Snail track to be printed

at the current position



CENTRE Moves the current position to the screen centre



NORTH Sets the current direction towards the top of

the screen



RNORTH Sets the current direction to the initial

direction when the program or procedure

started



CLEAR Clears the screen







PROCEDURE name



PROCEDURE name,n,n,n (1,2 or 3 n's may be specified)



PROCEDURE Instructions action the Instruction sequence which has

previously been defined by the name. If desired one, two or three

parameter values may be passed to the procedure, by including them as shown

after the name, separated by commas. Within the procedure the

parameters are identified as A, B and C. The parameter values in the

PROCEDURE instruction are always assigned in the sequence A, B, C.



END Must be used as the last Instruction in programs and

procedures



Instruction Range for n and N



FORWARD,BACKWARD Whole number 0 to 999

REPEAT,SET

INCREASE,DECREASE



RIGHT,LEFT Whole number 0 to 999

PROCEDURE and the value of 22.5



POSITION 1 to 62 for horizontal

1 to 42 for vertical



COLOUR 0 to 6



-----



5.2 Notes on Instruction Use



(1) All Instructions may be abbreviated down to a minimum of the

first two letters, except END.



(2) REPEAT Instructions must be followed by RFINISH at some

point. Repeat loops may be nested within each other, and

multiple loops may be used, both within programs and

procedures.



(3) Initial values of Variables are zero.



(4) A Snail symbol can be removed by rewriting it at the same

location. It can be displayed at the current location by the

sequence SN FO 0. (Try SN FO 0 FO 0).



(5) When A, B or C are used in procedures, values can be specified

in the PR Instruction when the procedure is called. A dummy

value must be given for A and B, if C alone is to be specified,

and for A if B alone is needed, to maintain the sequence A,B,C.



(6) Before any Instructions are given in a program, initial conditions

are CENTRE, NORTH, DOWN, NSNAIL, COLOUR 0.



(7) For colour number definitions see computer manual.



(8) RE0 and RE1 both give a single pass through instructions.







5.3 Operating Limits



(1) Running the examples and some of your own will show how

short the typical SNAIL LOGO program is. The following limits

should be noted in that light:



Screen size : 62 steps by 42 steps



Max Procedure Length : 15 instructions or 70 chars



Max Program Length : 45 instructions or 200 chars



Max No. of Procs : 9



Max Length of Proc Name : 7 chars (alpha only)



Max No. of chars in parameter values is 12 including decimal

points.



Max No. of proc calls in a program or a procedure is 10.



Max nested depth of Repeat loops (program plus procs) is 15.



These maxima are rarely encountered. The abbreviated form of

Instructions is the normal one, so the 70/200 characters limit is

ample. The normal program is under 20 Instructions, so can fit

one screen. A paging mechanism is provided for exceptional cases.



-----



(2) Exceptionally long Instructions within nested repeat loops,

(which are indented for each loop), can overflow onto the next

line of the screen. This does not cause any problem either for

the program listing or the editor, unless there is more than one,

and the screen is full, and the 200 character limit has not been

hit. In that case screen overflow can occur and a BASIC

"Continue" Instruction be needed, though this is most unlikely

to occur.



5.4 Error Reports



Error and warning reports are given under various circumstances. In

all cases use ENTER to clear the report. Subsequent actions depend

upon the report, and are indicated below.



(1) Instruction Syntax Errors



COMMAND ERR

The command word in the Instruction has not been recognized.



NUM IN COMMD

A number has been found in the Instruction command. Usually

caused by omitting a space.



NO SPACE REQ

Some inappropriate space has been found in the Instruction.



NUM/NAME ERR

Some inappropriate characters have been found in the part of

the Instruction which should be a number, a parameter value

or a procedure name.



NUM NO GOOD

A number outside the range given in section 5.1 has been found.



NUM/NAME REQ

A number, parameter A/B/C or procedure name has not been given.



NUMBER ??

Some character other than a number has been found where a

number is expected.



NOT VAR NAME

Some character other than A to H has been found where a

variable name is expected.



PROCEDURE ??

The procedure name given is not recognised.





For all Instruction errors the offending Instruction is cancelled

by the ENTER used to clear the error message.



-----



(2) Other Errors and Warnings



10 PROCS MAX

An attempt has been made to use 11 PROCEDURE Instructions

in a program or a procedure.



REP LOOP ERROR

An invalid REPEAT/RFINISH sequence has been found during

a program run, e.g. RF..........RE, or RF and RE in

unequal numbers. The run is aborted and ENTER returns to

the menu.



REPEAT LOOP ONLY PART EDITED

A warning given by the Editor, intended to prevent the problem

indicated immediately above.



ONLY 15 INSTRS IN PROCEDURES

An attempt has been made to use 15 Instructions other than

END in a procedure, or a conversion of a program to a

procedure. (There would therefore be no room for the END).



NO SPACE LEFT

Arises if a procedure exceeds 70 characters or a program 200

characters. Unlikely if abbreviated Instructions are used. The

program or procedure is cancelled by ENTER.



PROC NAME CANCELLED

Shown after an ENTER to clear the message arising from the

two cases immediately above.



PAGE FULL/CONT

Shown when a program exceeds 20 Instructions. Use ENTER,

and a new page will be generated, headed by CONT. Line

numbers will restart from 1 however, so the Editor cannot be

used on subsequent pages. A program of up to 45 Instructions

(on 3 pages) can be entered and run.



WALL

Shown when a program run has caused the Snail to hit the edge

of the drawing area (even if Snail is invisible at the time!).

ENTER returns to the Menu.



RF NOT EQUAL RE

See section 4.3(2)



END OF RECURSION STACK

Procedures may call themselves up to a maximum of 50 times only.



REP LOOP IFEND

A Repeat loop has been terminated by an IFEND Instruction.

Execution of program cannot continue.



DIVIDE BY ZERO

An attempt has been made to divide a variable by a variable

having a value of zero.



-----



Appendix 1 - Use of Zeaker Micro-turtle





1 Introduction



Although SNAIL LOGO is complete and self-contained, it can also be used

to control the Zeaker micro-turtle either as an alternative to the Snail

track, or in parallel, when both Snail and the micro-turtle will operate.

All of the standard SNAIL LOGO Instructions may be used with the micro-

turtle, though the following notes on their operation applied.



SNAIL Causes the micro-turtle to operate its horn at the end of each

movement.



OUTPUT,CENTRE }

NORTH,RNORTH } Are inapplicable to the micro-turtle and do not

CLEAR,COLOUR } have any effect.

POSITION }





2 Control Facilities



The micro-turtle is controlled by a sub-menu selected by the letter T on the

main menu. The main menu indicates whether the Snail, the micro-turtle,

or both are currently selected by showing the Snail symbol and/or the

letter T against the RUN option.



On the sub-menu the following facilities are provided:



a) To select the micro-turtle control and turn the Snail :T

display off



b) To select both the micro-turtle control and :X

[remainder of sentence not printed]



c) To turn micro-turtle control off and to select the :O

Snail display



d) To adjust the length of a "turtle step", by a number 1-9 :S



e) To calibrate right and left hand turns by setting :K

coefficients in the range 1 to 98. These should be separately

adjusted to give accurate right and left 90 degree turns.



f) To select the output drive port address for the :P

micro-turtle. Normally this should be left set to the standard

value of 63.
Автор
Verter_bot
Загрузки
0
Просмотры
8
Расширение
zip
Размер
10.1 КБ
Хэш
09aca5c993ce1b066dae2b1dab2fcee6
Первый выпуск
Последнее обновление

Оценки

0.00 звезд(ы) 0 оценок
Назад
Вверх