QL Books Issue 48 Contents Micon Midi

Hardware World



The Forth Source

THE BEST things come in small packages. That describes the recently released Currah μSource from Quadhouse. In a self-contained ROM cartridge it has a full-function-two-pass macro assembler, Forth and a debugger, all of which can interact with Basic. It is also compatible with Interface 1.

μSource cartridge

Currah, as regular readers of Sinclair User will remember, also made the μSpeech - a speech synthesiser - but went down last year. Quadhouse has bought the rights to the μSource and is now producing it.

Both the assembler and Forth work by storing their information in Basic lines, in the form of a REM statement followed by either '!' to denote an assembler line or '#' for a Forth line. Multistatement assembler lines are possible.

This is its main limitation as the editing facilities of Spectrum Basic are fairly primitive. Despite that, the range of features and the ease of use more than compensate.

The Assembler

Using Basic in this way means that you do not have the normal renumber, block move, and block delete commands which you find in assemblers with their own editors, such as Devpac, but as a bonus you can use Basic variables within the assembler. You could have a line such as:

REM ! LD HL,base

where base has previously been defined.

In theory, there is nothing to stop you re-assembling and running code a number of times within the same program using different values.

Operands can be calculated within the assembler, mixing Basic variables, trigometric functions or plain numbers in decimal, hex and binary. Basic strings can also be imported as required.

Sinclair User Classic

The best feature of the assembler is the ability to use macros, the assembler equivalent of a Basic procedure. Parameters are passed to the macro and on assembly the value of the parameter at the time is used.

Unlike a subroutine, recursion is allowed - the macro calling itself - up to any level. Conditional assembly is also catered for.

Assembly can either be direct to memory or, if desired, to a channel. That channel can be to a microdrive file, RS232 or Net if Interface 1 is attached. You can generate listings in a number of formats, to a choice of channels.

If the μSource only contained this assembler it would be worth the money, however you also get Forth.

Figure 1. Reserved Variables

Assemble
Forth
Loader
Debug
Forsv1
Forsv2

Forth

The μSource Forth is loosely based on Forth-79 and is a 16-bit integer only. Over 70 words and six control operators are predefined and the user dictionary can be linked to those or another user-defined dictionary.

Great variation is allowed in the way that Forth can be used, either in a single line or as a series of routines, in a similar manner to the BBC assembler. When invoked, each valid Forth line is interpreted until a non-valid line is encountered. In that way any number of separate blocks of lines can be used.

Like the assembler, Basic variables can be used within Forth, and that allows for an easy mix of the two languages. The only things it cannot handle are multi-dimensional arrays.

There is not enough space here to list all the predefined words and features. They are reasonably extensive, but not up to the Melbourne House-Abersoft-standard. Most omissions, however, can be catered for by dropping back into Basic, and then back to Forth.

This Forth is for the serious enthusiast; μSource has to be plugged in to run the programs and so is only useful for people who write programs for their own use. Given that, many people will find it invaluable.

Figure 2. Assembler Pseudo-Ops

ORG    Origin
LIST   To channel n
OBJ    Object code to channel n
OPT    Various options
DEFW   DEFine Ward
DEFB   DEFine Byte
DEFM   DEFine Message
DEFV   DEFine allophone
DEFS   Reserve Space
EQU    EQUate a label
MACRO  Start of Macro definition
ENDM   End of Macro definition
ASIF   Start if conditional assembly
END    END of conditional assembly

Debugger

In addition to all the above you also get a debugger. This allows you to step through any part of the Spectrum ROM or RAM and display and/or alter it. There is also a single step monitor.

The monitor has the normal facilities to set breakpoints, jump into routines, plus the ability to single step subroutines or alter the 'front panel' display to show just those registers/memory addresses you require.

Given the limitations imposed by basing the assembler and Forth in Basic lines, μSource works very well. The advantage of having these programs in ROM can not be overstated.

The assembler on its own makes the μSource good value, with Forth and the debugger thrown in it is excellent value. While μSource is not intended for the computer novice, for the enthusiast it is a must. It costs £19.95.

John Lambert

Quadhouse Computers, Cleveland.



QL Books Issue 48 Contents Micon Midi

Sinclair User
March 1986