Not Known
Hardware: Add-on
Not Applicable

Paul Gardner
Chris Bourne

A long, long time ago, there was a little firm called CURRAH, and the people at CURRAH had a dream... They dreamt that they could create a magic box that would give the mysterious 'Spectrum User' powers beyond imagination.

Unfortunately, CURRAH went bust before their dream became reality, but their black box that gives you FORTH, an Assembler and a debugging tool, all from within BASIC, is now available from Quadhouse Computers. At £19.50 Paul Gardner finds it hard to resist.


Back in early 1984, MicroSource was conceived as an idea. It was originally to be a ROM based BASIC compiler and assembler package. It soon became apparent though, with the prices of ROM chips as they were, that the BASIC compiler would either have to be quite limited or expensive to produce. The next idea was to offer a Forth compiler and an assembler. That was possible because of the compact nature of Forth code. It was finally designed and tested but then CURRAH went into liquidation. MicroSource was not forgotten, however, and the rights to the package were bought by DK'tronics in mid 1984. Then it was forgotten. Now, more than a year after it was finally completed, Quadhouse Computers have negotiated the rights to distribute MicroSource, and at a much lower price than was originally intended.


The final MicroSource package is a plug-in ROM based module that gives you access to Forth, an Assembler and a 'Software Front Panel' debugging tool. The box itself is similar to the CURRAH MicroSpeech package, but smaller. It is another 'last in the line' add-on for the Spectrum, so you will need a motherboard of sorts if you want to plug in any other products that don't have a through connector.

The MicroSource circuit holds two chips, a 4K masked ROM and a small ULA. The ROM is switched in whenever a new variable is created. Because of this it is necessary to make sure that the Interface 1 variables are installed first if you have an Interface 1 attached - either cause an error or do a CAT of your microdrive.


The assembler is a full Z80 assembler that supports macros with local labels, conditional assembly, powerful pseudo-ops, various number bases and an expression evaluator that allows you to import the contents of pre-defined BASIC variables into machine code. The assembler is invoked by a statement:

LET assembler=0

and the assembly routine then follows this statement as a list of REM ! lines eg:

810 LET assemble=0
820 REM ! org 32000
830 REM !start ld a,2
840 REM ! defm a$
850 REM ! ret
860 - (basic program continued) -

The contents of the variable a$ are imported onto the assembly routine during assembly and occupy the bytes reserved by the DEFM pseudo op.

Any labels used in the assembly routine are set up as BASIC variables and can be used directly in a BASIC program. So for the above routine, RANDOMISE USR start would call the routine.

The assembler outputs the machine code it produces either directly into memory, or to any opened channel if you have an Interface 1 fitted. Object code produced can be saved onto microdrive files or even sent over the network. For non microdrive owners the assembler will print a 'map' of the object code locations, so that you can save it to tape using the usual SAVE 'name' CODE routine.

As your source code is assembled, the assembly listing produced can be output to screen, printer or again, to any opened channel. Listing 2 is an assembly listing of the routine contained in the demonstration program.


The Forth is invoked from BASIC by the statement:

LET forth=0

after which the Forth system will execute or compile the following lines as Forth code. Like the assembler, the Forth lines in a program start with a REM statement:

890 LET forth=1
900 REM # 2 DUP + 32000 C!
910 REM # % newword
100 10 DO I. LOOP;
920 REM # newword
930 - (basic program continued) -

For technical reasons, any Forth definitions are started with a % (percent) sign instead of the usual : (colon).

Forth definitions are compiled into a dictionary which can be saved to tape or microdrive and later re-loaded and linked into the dictionary, although only if loaded back into the original memory locations.

The Forth language supported is a small subset of Forth '79. Most of the omissions cover virtual memory, double length number handling and most of the useful commands for creating your own data and language structures. Some useful additions include the ability to pass variables between BASIC and Forth and the ability to pass parameters into, and then call, machine code routines. Listing 3 gives the full list of Forth words supported. Those marked with an asterisk differ from the standard in some way.


The debugging part of the package is a 'software front panel' that allows you to step through machine code routines while displaying the contents of all, or some of the Z80 registers and a section of memory. Listing 4 shows a screen dump of the form panel, as it views the machine code that was assembled from the demonstration program. Debug also allows you to display memory contents as screens full of hex bytes or ASCII characters. There are a number of commands that allow you to selectively step through machine code routines, with the option of following, or not following, subroutine calls as you wish.

For all the potential of Debug as a tool it is badly let down in two respects. It is very difficult to follow a machine code routine that is simply displayed as hex bytes. If only the current instructions were displayed as Z80 assembly mnemonics it would be easier to use. The other problem concerns print-outs. I use an old Kempston printer interface and when Debug tries to send the display output to my printer the entire system crashes! However, I have been assured that Debug works perfectly with Interface 1 and any serial port printer, or the original Sinclair printer.


This simple demonstration has a main BASIC part that sets up a string of 3072 characters of mixed character codes. The program contains three 'subroutines', one in BASIC, one in Forth and one in assembly language. These routines are functionally identical in that they will convert the string in Z$ so that all the lower case letters are changed to upper case ones. Before any of the routines are called, the Forth lines need to be compiled and the assembly code needs to be assembled. After that the test string is set up and each routine is used to convert a copy of the test string. The retrospective timings for the routines are some indication of the speed advantage to be gained by not using BASIC for the repetitive or slow sections of a program:

BASIC 100 seconds
Forth 30 seconds
M/C 0.05 seconds


It is unfortunate but there are some. Given the history of this product, we are unlikely to see a bug free ROM being released. Apart from the error in Debug which stops it printing out to a Kempston printer interface, there seems to be no serious bug in the Assembler-Debug part of the package. The most serious bug I have found is in the Forth. Contrary to the Forth '79 standard, in this version you can use the word ."" (dot-quote) outside word definitions but not inside word definitions! For you BASIC fans, that's like having a version of BASIC that won't let you PRINT text strings written as part of the program... For similar reasons you may as well not include comments in your Forth programs because if you're not careful they cause some very spurious errors that you will never find.

One other 'bug' is that you can only transport the values and addresses of simple variables between the BASIC, Forth and assembly language. This means that you cannot easily get Forth to do processing on BASIC arrays. This is a real pity, as array processing is one of the most time-consuming elements of BASIC programming.


The assembler itself is worth the £19.50 that is being asked for the whole package. If you are aware of the bugs in the Forth then it is easy to evade or avoid them. The manual is very good and explains things in just the right amount of detail. The program listed in this article should show you some of the power the MicroSource offers you. I shall certainly buy this one! (High praise indeed- ED)

MicroSource costs £19.50 from:
Quadhouse Computers
Regent House
Victoria Road

Screenshot Text

The Assembly listing produced when MicroSource assembles lines 920 to 1180 of the first listing.


Three subroutines in different languages achieve the same thing: turning lower case characters into upper case characters - a tedious example, maybe, but it shows how you can take a BASIC variable (Z$ here) and use it in three separate languages!

The Forth vocabulary supported by MicroSource.

The screendump of a typical Debug Front Panel display - in this instance, displaying the machine code routine, again derived from lines 920 to 1180 of Listing 1.