Although BASIC is the most common language for programming microcomputers, it is not the only one. Your ZX80 or 81 can learn FORTH, another high level language. (For an intro to FORTH, check out Byte Aug. 80.) FORTH has several advantages over other languages in certain applications, particularly in computers as controllers.
Artic Computing announced that they were developing FORTH on an EPROM (erasable programmable read only memory) for the ZX81, to be available in April. No word yet on their success. The package, 2 4K EPROMs on a board with users manual, sells for £60, or about $102 US. For info, contact Richard Turner, Artic Computing, 396 James Reckitt Ave, Hull, England HU8 0JA.
Richard Holmes of Batavia, IL, has partially implemented FORTH on his ZX80 with 8K ROM and 16K RAM. He reports:
My starting point was Threaded Interpretive Language by R.G. Loeliger ($18.95 from Byte Books, 70 Main St., Peterborough, NH). This book contains most of the assembly code needed to implement FORTH on a Z80-based computer. It certainly makes the job easier, as long as you watch for the occasional typo. The worst problem with the book is that Loeliger’s division routines are faulty.
The book doesn’t give routines to make FORTH work with the ZX80/81 configuration. I had to write 3 main machine-dependent routines–$ECHO (writes a character to the screen), $KEY (displays the screen and gets keyboard input) and BASIC (returns control to the 8K ROM).
Some requirements: on return from a USR call, registers IY and I must contain 4000h and 1Eh. Of course, SP must also be undisturbed. HL’ must also be preserved. So on startup, FORTH must save SP and HL’. Then when the BASIC routine is called, it must restore SP and HL’, load 4000h into IY (my FORTH code doesn’t mess with I, so no need to reset it), and do a RET to get back to the ROM. My version also calls a routine that saves all the registers in a block of RAM locations you can PEEK. This helps enormously when debugging.
$ECHO and $KEY are based around calls to ROM routines. $ECHO sets up a RST 10 call, which takes care of writing to the screen. You have to load 4000h into IY first. $KEY calls routines at 0229h (displays screen), 0F48 (cleans up keyboard handling) and 07BD (decodes the keyboard). Again, 4000h must be loaded into IY; also IX must be preserved before these calls as the ROM doesn’t preserve it.
One other problem concerns character sets. FORTH is based around the ASCII (American Standard Code for Information Interchange) set which includes characters not in the ZX81 set. I defined an ASCII to ZX81 “mapping”; I replace needed ASCII characters with inverse ZX81 characters as follows:
ASCII ZX81 ASCII ZX81
a-z A-Z ! .
# = % £
& + ' "
@ ? [,] (,)
\ / ^ *
_ - {,} <,>
~ ;
Rich added that he would discuss putting FORTH on a ZX80/81 with anyone who’s interested. Send him a SASE and $.50 to cover reproduction of his materials. Richard S. Holmes, 1303 E. Wilson Apt. 4, Batavia, IL 60510.
Howard Gladstone of Gladstone Electronic Distributors called to say they remastered all their tapes. Our review of their ZXAS and ZXDB programs reported trouble loading these tapes. This problem should no longer exist for tapes shipped after mid-April 1982.