Integer BASIC Compiler

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v5 n7 (Volume 5, Issue 7)
Date: July 1984
Pages: 10
Program:   Integer BASIC Compiler
Machines:  TS2068
Form:      Cassette
RAM Req:   48K
Listing:   No
Listable:  Yes
Language:  BASIC
Display:   Poor
Author:    John Richard Coffey
From:      JRC Software
           POB 448
           Scottsburg, IN 47170
           812/752-6071
Price:     $24.95 with Z80 Assembler

If you have lots of experience programming in languages that don’t tell you about errors, JRC has a BASIC compiler that you may be able to use. But don’t expect it to hold your hand.

JRC’s idea was to write a language that looked like a subset of BASIC, but ran closer to machine code speed. Many simple routines in machine code can be written in a simple BASIC and then translated to machine code by the compiler. The speed enhancement is impressive: JRC’s compiled code runs about 100 times faster than interpreted BASIC. Unfortunately, if you think you can just compile your existing programs, you’re wrong.

JRC Compiled BASIC supports only a small subset of TS2068 BASIC. Variables may only range from A to Z, single letter only. Numbers may range from 0 to 65536. No FOR loops, no INPUT statement, no joystick access, etc. In total, JRC lists 35 specific limitations (things you may do in TS2068 BASIC but not in the compiler), not including statements and commands wholly unsupported. Of course, you could write code to get around most of these limitations, and it would probably run at reasonable speed, but the documentation for the compiler makes it difficult to know at a glance what’s allowed.

If you have a need for writing fast code that doesn’t need alot of the power of BASIC, this compiler may be just the ticket. BASIC code typically runs after less debugging than a comparable assembly language program, since the commands do so much more each. Machine code generated by JRC’s compiler will usually run completely without ROM support (of course, if it prints to the screen, it uses a ROM routine). You can specify where the machine code should be stored, and need not preserve the source code once you have a working program. You can save compiled code on cassette.

I wrote a small test program that generates random points and blackens them on the screen. A listing appears below.

  10 LET X=RND*65536/256-1
20 LET Y=RND*65536/512
30 PLOT x,y
40 GO TO 10

After running for a while, it stopped with an Out of Memory error. This program shouldn’t consume memory at all: it uses two variables and keeps reusing them. This bug must be in the compiler.

Valid statements and commands in JRC Compiled BASIC include PRINT (including AT, BRIGHT, INK, PAPER, INVERSE, OVER, STR$ (only after PRINT), and TAB), BEEP, BORDER, CHR$, CLS, CODE (one char. argument only), COPY, DIM (to specify length of strings only), GOTO and GOSUB (constant line numbers only), IF (with a minimum of possible expressions), INKEY$, LET, LPRINT, OUT, PAUSE, PEEK, PLOT, POINT, POKE, REM, RETURN, RND*65536 (always returns between 0 and 65535), SOUND, and STOP. You can also use +, – (but not unary, and no negative numbers), *, /, =, <, <>, OR, and AND.

If this list contains the functions you need, and you are an experienced programmer (preferably with knowledge of machine code), you might be happy with JRC’s compiler. Otherwise, beware!