Click Here To Go To The Your Computer Archive



Written By Fintan Culwin


Cover Art
Click Here To Enlarge Loading Screen

Loading Screen
Click Here To Enlarge Opening Screen

Opening Screen
Click Here To Enlarge Screenshot

Game Screenshot

Turtle Graphics

Turtle graphics are the family of drawing routines at the heart of Logo. Fintal Culwin presents a full turtle program for the BBC Micro

Logo is a computer language and a powerful educational tool. It has many of the characteristics of the almost synonymous Lego, insofar as Logo provides a small number of basic building blocks. The blocks can be put together very easily to produce complicated results.

Logo has no formal syllabus or correct methods. The emphasis is not on learning the facts about Logo, but learning about thought processes that can be extended to other situations. Seymour Papert in Mindstorms gives an example of extending Logo ideas to juggling; a skill that I was able to learn in 30 minutes after reading his analysis.

Allowing a child to explore a Logo system by exploring his or her own ideas and being rewarded by feelings of creative and aesthetic achievement uses the most powerful motivating forces. Most educational software is much more conservative, relying on practice rather than creativity and producing external rewards.

As a computer language, a full version of Logo should provide the minimal features of a high-level language: loop structures, decision-branching and editing facilities; in addition, a full Logo includes powerful features such as list-processing and recursive functions.

Logo, like Lisp and Forth, is a threaded interpretative language. It provides a small number of system commands which, when referenced, call short machine-code subroutines. The systems commands can be linked together to give a user-defined command which can then be included within a further defined command.

One of the advantages of using Logo as an introductory computer language is that the structuring of programs in Basic follows naturally from this experience. The problems of spaghetti programming are avoided.

Full implementations of the Logo language are rare and expensive. The TI-99/4 version costs 60 and the BBC version is reported to cost 55. It is much more usual to find a subset of Logo commands and facilities related only to controlling a screen object called a turtle. This limited system is known as graphics Logo or turtle talk.

In this program the routines to control the screen are controlled by Basic subroutines. The program also does not allow procedures to be defined with a parameter but does support very powerful use of the Logo variables which can produce the same effect. Designed for use by children, the system is very user-friendly and almost crash-proof. It has been well-tested with groups of children and does provide an effective Logo environment. If your seven-year-old cannot handle Basic, try this instead. You may not need a secondary school if you do.

Commands are given to the system either by using one of the system command mnemonics in table 1 or by giving one of the defined commands. If a system command is given, it may or may not require a parameter. Numeric parameters can be given either as a number of as a term that includes the system variables NM, TR, SZ.

Numeric parameters can be evaluated by the Basic EVAL function. If the EVAL function is used with a parameter string that cannot be evaluated, an error condition is produced that crashes the system down to its lowest level.

A string parameter is the name of a command; for memory efficiency it should not be longer than eight characters. System commands have to be given to the system as mnemonic space parameters.

Clear Screen clears the screen, resets the angle to 0 and homes the cursor to the centre of the screen. Pen Up and Pen Down set trace output from the cursor off and on. Fill and End Fill fills the areas in the same way as Plot in BBC Basic, starting with the second point after Fill is called. Cursor On and Off switch the cursor on and off. Long procedures can be speeded up significantly by turning the cursor off.

Quit allows you to leave the system to store definitions on tape. The definitions are stored as strings - this is exactly the situation where the most cassette-filing system errors occurs so make sure you have your CFS patch in when you use it.

Cursor Right and Down move the cursor around the screen. Use negative parameters to move left or up. Right and Left turn rotate the cursor clockwise and anti-clockwise respectively. Angle sets the cursor to a definite value. Forward and Backwards move the cursor with appropriate trace output in the direction of the current angle.

Repeat and Next define a repeat loop. Define and End Define delineate a user-defined command. Delete removes a defined command from the system. Describe describes a defined command. Edit allows editing of a command, each term of a command is presented with options of Entering that term, Deleting that term, replacing that term, Inserting a term before the presented term or abandoning the definition. A useful way of turning the screen off while defining a command is to define the command without any terms, then insert the definition using the editor.

System lists the system command available, List lists the defined commands. Undo attempts to undo the last command given. Value lists the alues of the three Logo variables Number, Turn and Size.

Now for the program, and, to paraphrase Arthur Dent, do not panic. Although the program is 10K of listing, it is not spaghetti-written. This does not necessarily mean that it always conforms to structural programming conventions. A workable, testable version can be produced with a small amount of effort and built up from there.

Begin typing in the driver routine between lines 150 and 250. Add the initialisation procedures PROCInt and PROCScr. The utility routines PROCStrip and PROCFind. PROCStrip removes the front spaces from strings and indicates the place where it can be divided to give a string containing the first value. PROCFind looks for a string among the system commands and defined commands. It returns 0 if no such command exists, a value less than 30 for a system command and a value greater than 100 for a defined command.

PROCTur controls plotting lines on the screen and the subroutine called at line 2190 controls the cursor on the screen.

Following this, two of the major routines can be introduced. The PROCInp accepts the commands and passes its results to the major procedure PROCAct. This consists of a GOSUB stack which calls routines corresponding to the 30 allowed terms. The simple screen-handling commands can now be keyed in. This will give a minimal system capable of executing commands immediately on the screen.

The system can now be extended by adding the structures that allow it to be described as a language, the Repeat loop, and the definition routine depend upon the PROCEx procedure.

There only remain the parts that make life easier: the Editing, Description Delete and Quit routines to complete the system.

The main variables of the program, besides the flags, are the arrays. D$(30) holds the mnemonics for the system commands. The arrays DT$(50,2) holds the defined command names in DT$(DT,1). DT is the defined command counter.

The definition of a command is held in the array as a sequence of pairs of strings. The first string of the pair holds the command number as described in PROCFind, the second string holds a dummy value 0 or a simple numerical value or a term that will give a numerical result when passed to the Basic's EVAL function. This is made clearer by an example.

Suppose you defined your first term QSQ as FD NM*.8 // RT 90 this would be stored in DT$(1,1) as " 12 NM*.8 10 90". The command SQ defined as RP 4//QSQ//NX would be stored as "13 4 101 14 0".

The execution of a defined term or a repeat loop is handled by PROCEx; this controls the stack S$(100). The string to be executed is placed on the bottom of the stack and is stripped of pairs of values to be passed to PROCEx. If a repeat loop or a defined term is encountered then the relevant string is placed on top of the stack and execution of the stack moves up one level.

In operation, the program, operating system RAM and screen memory occupy 22K of your 32K. This leaves 10K for the program variables and the stack.

It is possible to use up all of this memory before the reserved limit of 50 defined terms and 100 stack levels is fully used. Despite this you may wish to add further system commands. Commands to change foreground and background colours could easily be added by adding subroutines to the subroutine stack.