Beebug


Which Forth For The BBC Micro?

Author: John Yale
Publisher: Acornsoft/Adder
Machine: BBC/Electron

 
Published in Beebug #19

In last month's issue of Beebug, John Yale gave a short introduction to the computer language FORTH. This month, John provides a comparative review of the three implementations of FORTH now readily available for the BBC micro.

Which Forth For The BBC Micro?

FORTH is a comparatively new computer language that has rapidly achieved a cult following among many programming enthusiasts. It differs from languages 1like Basic in that writing FORTH programs involves extending the language itself to meet the application, rather than using the language as provided to describe a solution (as happens with Basic). A measure of the interest in FORTH is the availability of at least one popular micro that offers FORTH as its standard language. Versions of FORTH are also available for many other micros and there are now three implementations of FORTH available for the BBC micro.

Acornsoft FORTH and r q FORTH (supplied by Level 9 Computing) are cassette or disc FORTHs based on the Fig (FORTH Interest Group) FORTH model modified to meet the FORTH-79 standard.

JWB FORTH supplied by HCCS Associates differs from the other two in that it is supplied in an 8k byte EPROM for fitting in the computer. JWB FORTH is based on the Fig FORTH model but without the FORTH-79 modifications. HCCS explain that as the majority of applications are supplied by Fig this should make things easier for new users. However, this will only be the case if you already have a quantity of Fig software, as priority is now given to publishing FORTH-79 programs.

Full details of prices, suppliers and recommended books are given at the end of this review.

Editor

FORTH source code is normally stored in 1k byte blocks or screens. Acornsoft FORTH and JWB FORTH both provide the standard Fig line and string editor for editing these screens. Although this is a powerful editor when mastered, it is difficult for the beginner to use. Use of the cursor and Copy keys does however allow editing in a similar manner to Basic.

Acornsoft FORTH allows two screens in memory at one time and JWB FORTH allows one. As each screen is typed in, compiled and tested it must be saved to tape before the next screen can be entered. This does cause problems when a screen in the middle of an application needs changing.

In contrast r g FORTH adopts a different approach to block storage and editing. Firstly a selectable number of blocks is kept in memory for instant recall at any time, saving to tape only being required at the end of a session (or more frequently for security). The only disadvantage to this scheme is that it uses a large amount of memory which might be required for graphics.

However, as the number of blocks stored is configurable, the user may reduce this to say two blocks and revert to the scheme used by the other systems under review. Secondly r g FORTH uses a screen size of 512 bytes organised as 16 lines of 32 characters instead of 64 characters as used by the other systems. This allows a complete screen to fit onto a Mode 7 display but unfortunately it does not comply with the FORTH-79 standard which requires 1024 byte blocks. Editing is performed by moving the cursor to the required place on the screen and typing away. A set of control keys is also provided to delete text or move it around the screen via a holding buffer. This editor is much easier to use than the Fig one, and will be found to be more powerful than the Basic editor supplied as part of the BBC computer.

Benchmarks

The December 1982 issue of Personal Computer World has a set of Benchmarks for FORTH implementations. In general JWB FORTH is slightly slower in execution, though the differences between the three systems are not significant.

Cassette System

All three systems can save blocks on cassette. As mentioned above, Acornsoft FORTH allows two screens in memory at one time and JWB FORTH allows only one. Thus as each screen is entered and debugged, it must be saved to tape using the built in block save facility. r g FORTH uses the standard MOS *SAVE command (accessed from within FORTH) to save all the block buffers in one cassette file. In practice, this system is much easier to use.

Disc System

When FORTH is used with discs all the screens are kept on the disc, only being brought into memory as required for editing or compiling. This system which is known as 'virtual memory' is transparent to the user, it seeming as if all the blocks are continuously available (except for the disc activity as blocks are swapped in and out).

Acornsoft disc FORTH is supplied on a protected disc, but this has little effect and it is possible to produce a backup copy of your FORTH system as it is easily transferred from memory to a new disc by *SAVEing from PAGE to HERE (this also works with the cassette version). I found the disc access time of 3 - 4.5 seconds per block rather long but this does depend on the DFS in use. Blocks are stored nine to a file which allows 99 blocks on a 100k disc.

A disc version of r q FORTH is supplied on the back of the cassette. Block reading and writing is much faster than with Acornsoft FORTH as the disc filing system is not used. Instead sectors are accessed directly via OSWORD calls, giving block read times in the range 0.7 to 1.6 seconds.

The JWB FORTH EPROM will also work with the BBC disc filing system but as each block is stored as a separate file this means a maximum of 31 blocks on a disc due to the DFS file limit. Thus two thirds of the disc is wasted. This system also does not support the important FORTH word BLOCK.

ROM System

JWB FORTH is the only one of the three packages currently being supplied as a ROM system (actually in EPROM). Fitting instructions are supplied with the EPROM which is selected by *FORTH.

Acornsoft FORTH should be available in ROM later this year.

Level 9 Computing have no plans at present for a ROM version of r g FORTH.

Documentation

Acornsoft FORTH is not supplied with any documentation and requires separate purchase of the book 'FORTH on the BBC Microcomputer'. This is suitable for beginners and advanced users alike and is highly recommended.

r g FORTH is supplied with a 72 page A5 manual containing a complete glossary of all the words in the system, configuration details, source code of the editor etc. This manual contains all the information the experienced FORTH user requires to use the system, but it is not a good introduction for the beginner. Also supplied by Level 9 is an A4 summary card giving brief details of all the words in the system, configuration, editing, saving etc.

JWB FORTH is supplied with a 37 page A4 manual containing a glossary, sections on Graphics and Sound, System description and some demonstration programs. The review copy glossary was rather difficult to read as the first few letters of each line were lost in the binding. This manual is again not an introductory text and HCCS will be introducing a separate book 'Welcome FORTH' in the near future.

A new book The Complete FORTH by Alan Winfield will provide a suitable introduction to any of the FORTH systems reviewed here, particularly the FORTH-79 standard, as this is the dialect used throughout the book. All the basic FORTH techniques are covered in the book's 130 pages, including the definition of new defining words with DOES>. Some of the chapters have exercises, and answers are given at the back of the book. Two complete FORTH programs are also given as examples.

Starting FORTH, the standard work on FORTH covers more ground with more detail and is highly recommended, but at less than half the price The Complete FORTH is very good value.

Assembler

Acornsoft FORTH provides an assembler package in source code form on tape or disc which may be added to the system by compiling it and saving a copy of the extended system. The other two systems do not provide an assembler as part of the standard system, but allow access to the machine operating system via CALL (r g FORTH) or *FX and OSWORD (JWB FORTH). Of these, CALL is the more powerful, allowing access not only to OSBYTE and OSWORD but also to file routines such as OSFILE etc. Level 9 Computing also provide a separate r g FORTH Toolkit which includes an assembler.

Compatibility

Whilst the standard FORTH words are the same in both systems designed to the FORTH-79 standard, the situation is not so good where new words have been defined to use some special feature of the BBC micro. An example is the word used to send the rest of the command line to the Operating System, equivalent to the Basic use of '*'.

Thus we have OS' (Acorn), *MOS (r q) and MONITOR (JWB). This doesn't need too much conversion but consider a word with three parameters to provide the equivalent of, say, PLOT. This could be KXY PLOT, XY KPLOT or even Y X K PLOT and there are good reasons for all three choices. I would suggest that in such cases as this, all authors should keep to the same order as in the equivalent Basic command, i.e. K X Y PLOT. This is not always the most convenient for FORTH, but at least it would be standard.

None of the different cassette or disc systems reviewed are compatible with each other. However, all three can compile Wordwise files from disc if Return is used at the end of each line.

Error Messages

Acornsoft and JWB FORTH use error numbers whereas r g FORTH uses English messages for all errors (eg. 'no such block' rather than '# Msg no 6').

When an error occurs in the loading of a source block it is not always apparent at what point in the block the error, has occurred. Typing 'WHERE' in Acornsoft FORTH displays the screen number and the line in error with an arrow pointing at the point in the line where the error was detected. Typing 'WHERE' in r q FORTH enters the screen editor with the cursor at the point in the block where the error occurred.

Upgrades

Level 9 are also now supplying a FORTH toolkit containing an assembler, turtle graphics package, decompiler (allows you to see the definition of any word in the dictionary), double precision extension and various other extras.

Conclusions

Of the systems reviewed, r g FORTH stands out as the best system for cassette-based use, and the r q FORTH Toolkit is very good value at £10.

For a disc-based system the choice is between Acorn and r g FORTH which both give good performance.

A ROM-based FORTH has obvious advantages, particularly for cassette use. The HCCS ROM is available now but has several drawbacks, not being to the FORTH-79 standard, having a poor cassette system and with only restricted disc use.

Suppliers And Prices

Acornsoft Ltd, c/o Vector Marketing Ltd, Denington Industrial Estate, Wellingborough.

FORTH cassette £16.85
FORTH on the BBC Microcomputer £7.50

Level 9 Computing, 229 Hughenden Road, High Wycombe, Bucks. HP13 5PG.

r q FORTH £15.00
r q FORTH Toolkit £10

Starting FORTH (book) £14.35

HCCS Associates, 533 Durham Road, Low Fell, Gateshead, Tyne and Wear NE9 SEY.

JWB FORTH EPROM £34.72
Welcome FORTH (book) £6.75

John Wiley & Sons Ltd. (Publisher)
The Complete FORTH, A.J.Winfield, £6.95, ISBN 0-905104-22-6

The above may also be available from computer shops, specialist book shops and major chain stores such as W.H.Smith.

John Yale