Tiny BASIC Extended available

Dave Dunfield dave06a at dunfield.com
Fri Mar 23 10:42:07 CDT 2007


> Every so often, a discussion of Tiny BASIC appears around here.  I was curious about one of the very
> I hope this is of interest to people.  I'm very interested in other versions of Tiny BASIC out
> there, if someone has ever typed this listing before, etc.  I'm familiar with Tom Pittman's work,
> but other resources would be greatly appreciated.

This isn't based on any other system, but it might be of interest to you... In the late
70's, or possibly very early 80's, I wrote a "tiny" BASIC interpreter for the University
of New Brunswicks computer club - a few guys building 8080, 8085 and Z80 based computers.

The basic is a bit non-standard, having been somewhat influenced by my facination with APL
at time - not that there were any real standards to draw on then. It is an integer only
BASIC and weighs in at 3K. For what it is, it was fairly capable.

It was originally designed as a complete system and was accompanied by a 1K monitor program
which provided I/O drivers for a parallel keyboard, 16x64 memory mapped display and an 8251
serial port. The monitor provides memory dump/edit etc. and an intel-hex format download
capability.

The two were designed to fit into 4K of ROM and require only minimal RAM - our wirewrap
systems typically had a pair of 2716s and a few pairs of 2114s. The video display was designed
by one of the guys, using 8 2102s (1K ram) and all TTL for the controller. I think it has
a 2716 for the character generator as well. [It also had a hardware bug where blanking got
turned on 1/2way through the last character on each line - so the last char would not display
correctly. We never noticed because my video driver also had a bug where it wrapped lines at
63 characters instead of 64. I recall sometime later noticing this and fixing it only to
discover the hardware bug.]


Although it was originally designed as a companaion to the 1K monitor, the BASIC was assembled
as a separate module, and only calls a few subroutines from the monitor (get char, put char,
download record etc.) - It is fairly easy to decouple from the monitor and run stand-
alone in a different environment.

If you want to see it run, I have a version of it (without the monitor) implemented under the
DMF operating system which I wrote for my Altair - you can run DMF on my Altair simulator from
my site, and the 3K BASIC interpreter executable is there on the DMF boot disk image. I also
have the documentation for the BASIC on the DMF documentation disk, and the full source code
(8080 ASM) on one of the DMF source disks - you can look at these under the simulator, or use
the NSI utility to extract the files to PC files which you may find easier to look at.


>    Hey Eric, this is great stuff, thanks for making it available!   
> I'm thinking that I would like to put together a very small Z80-based  
> SBC just for this interpreter.  Do you know if this code is ROMable?

As noted above, my BASIC was designed to go in ROM.

If anyone is interested in looking at the original stand-alone version, I can post the
source and document somewhere. It's quite well commented (and a bit humerous in places),
but do keep in mind that is is some of my earliest code...  It was maintained through
a few following years, and is quite stable/bug-free, and would be a good place to start
if you want a little stand-alone x80 system with BASIC and a monitor.

Here's an extract from the opening comment in the BASIC.ASM file which very briefly
describes the implemented language:

*                      BASIC COMMANDS
*
*  CLEAR,    DATA,     DIM,      END,      EXIT,     FOR,
*  GOSUB,    GOSUB(N), GOTO,     GOTO(N),  IF/THEN,  INPUT,
*  LET,      LIF/THEN, LIST,     LOAD,     NEW,      NEXT,
*  ORDER,    PLOT,     PRINT,    READ,     REM,      RETURN,
*  RUN,      SAVE,     SIZE,     STOP,     USR,      <EDIT>

*                     BASIC OPERATORS
*
* NUMERIC:     + - * % / \ & | ; ( ) < = > == -= <= >=
* CHARACTER:   + = == -=
* OTHER:       : # $ @ ? [ ] ( )

*                      BASIC VARIABLES
*
*     A - Z ......... 16 BIT SIMPLE INTEGER VARIABLES.
*     A$ - Z$ ....... SIMPLE CHARACTER VARIABLES. < 36 CHARS
*     A[N] - Z[N] ... 16 BIT INTEGER ARRAYS.
*     @[N] .......... PSEUDO MEMORY REFERENCE ARRAY.
*     @[N]$ ......... NUMERIC TO CHARACTER CONVERSION.(CHR$)
*     ? ............. PSEUDO RANDOM NUMBER GENERATOR.

*                        MEMORY MAP
*
*    0000-03FF     1K SYSTEM MONITOR (IN ROM).
*    0400-0FFF     3K BASIC INTERPRETER (IN ROM).
*    1000-13FF     1K MEMORY MAPPED 64*16 VIDEO DISPLAY
*    1400-15FF     0.5K POINTERS, STACKS, BUFFERS.
*    1600-19FF     1K VARIABLES AND POINTERS.
*    1A00-FFFF     PROGRAM AND ARRAY STORAGE.

Btw: The memory map shows what we implemented for our systems, but you could
easily adjust the code to accomodate a different layout.

Dave


--
dave06a (at)    Dave Dunfield
dunfield (dot)  Firmware development services & tools: www.dunfield.com
com             Collector of vintage computing equipment:
                http://www.classiccmp.org/dunfield/index.html



More information about the cctech mailing list