Electron User


Forth
By Acornsoft
Acorn Electron

 
Published in Electron User 2.01

Open Up A Whole New World With Forth

Forth was invented in 1969 by Charles H. Moore who worked on an IBM 1130 - a third generation computer.

He believed his language to be the next step forward and considered it a fourth generation computer language. However, the language he was developing for the IBM 1130 only permitted five character identifiers so instead of being called Fourth it became "Forth".

It has become the second most popular language on home micros after Basic. So if you have mastered the art of programming the Electron in Basic and are looking for something new, then take a look at Acornsoft's Forth.

Forth

There are two main versions of this language - Forth-79 set out by the Forth Standards Team, and fig-Forth, put forward by the Forth Interest Group in America.

Acornsoft's version follows the Forth-79 standard. All the words in the required word set are present plus a few others added by Acornsoft such as >VDU to send a byte to the VDU drivers.

Forth is neither an interpreted language like Basic nor a true compiled language like Pascal. It's a sort of intermediate language, compiling the definitions to a code close to machine language which is then interpreted when the program is run.

Forth

Forth is known as an interpretive threaded language - the instructions which make up the application are compiled to give a list of addresses which point to previously defined machine code routines.

The result of this is that it runs quite fast as much of the interpretation has already been carried out.

The Electron takes more than 22 seconds to count from 0 to 30,000 in Basic using an ordinary variable and about 7.5 seconds using one of the resident integer variables as the loop counter.

Forth

The same loop in Forth takes about four seconds, making it nearly twice as fast as Basic.

Forth programs are usually, but not always, faster than their Basic equivalents. So, if you are interested in fast arcade-type games and find Basic too slow or machine code incomprehensible, try Forth as an alternative. It might just have that extra bit of speed you are looking for.

The cassette has four programs. These include a Forth dictionary and compiler, an editor, a Forth assembler and a high resolution graphics demonstration.

Forth

The dictionary and compiler take about 4.5 minutes to load and consist of several files which relocate when finished. A copyright message appears and the heading:

Acornsoft FORTH OK

is printed. The OK is not a sort of "Jimmy rules OK" message but one of the features of Forth - it simply means that the task set has been completed.

Forth

Modes 4, 5 and 6 are available and there is more than 6K of memory free for your application. Graphic displays are also possible in Modes 4 and 5.

The manual, which is available separately, shows how to draw triangles, rectangles and how to animate simple characters.

Acornsoft Forth does not support floating point arithmetic but this is not the great handicap it might at first seem.

Floating point numbers are not needed all that often and, when they are, Forth is such a flexible language that you can define your own "words" to handle them.

Since Forth applications - programs - are compiled as they are entered, the original form of the definitions are lost and only the compiled form remains. Acornsoft uses the standard Forth method of storing a copy of the source code in a number of screens.

There are initially two screens on loading but this number can be increased - with a corresponding decrease in the memory left for the dictionary.

Each screen is divided into 16 lines of 64 characters and is identified by a number. A Forth application can use as many screens as it needs and interpretation continues with the next.

Screens can be loaded, saved and edited with the editor supplied.

The editor seems a bit complicated and a bit bewildering at first, but is quite powerful and becomes easier to use with practice.

There are commands for putting text on to a line, deleting a line, inserting text, spreading lines, deleting text and many more.

The manual with the cassette is actually called Forth On The BBC Microcomputer but there is no difference between the two versions. The manual is an absolute necessity and pushes the total price of the package to more than £20.

The manual is excellent, covering topics such as arithmetic (single and double precision), defining new words and vocabularies, loops, input and output, creating arrays, assembly language, graphics and sound.

At the back is a glossary which lists all the Forth words in the dictionary and gives a brief description of their function.

To sum up then, Acornsoft's Forth is an excellent implementation of the language. It is very powerful, encourages structured programming techniques and is faster than Basic for many applications.

If you are interested in programming and want something different and are prepared to put in a bit of effort then Forth would be a good investment and would open up a whole new world that you never knew existed.

If, however, you are just interested in fast machine code arcade games and zapping various nasties of assorted sizes and shapes, then I would not recommend it. But you would be missing out on something far more interesting, exciting and rewarding.

Roland Waddilove

Other Acorn Electron Game Reviews By Roland Waddilove


  • Play It Again Sam 6 Front Cover
    Play It Again Sam 6
  • Pengi Front Cover
    Pengi
  • Joe Blade Front Cover
    Joe Blade
  • Electron ADFS E00 Front Cover
    Electron ADFS E00
  • Bug Eyes Front Cover
    Bug Eyes
  • Death Star Front Cover
    Death Star
  • Joe Blade II Front Cover
    Joe Blade II
  • Codename: Droid Front Cover
    Codename: Droid
  • Strike Force Harrier Front Cover
    Strike Force Harrier
  • Electron DFS E00 Front Cover
    Electron DFS E00