Basic interpreters for the 6502

Getting enough memory and bringing up a BASIC interpreter were early goals of many personal computer users back in the 1970s.  While Dr Dobb’s Journal was printing a new small BASIC interpreter for the 8080 almost every month, 6502 users were left out in the cold.  Fortunately, Tom Pittman produced a Tiny BASIC that he charged $5 for.  Microsoft also ported their full floating point BASIC but it was not cheap.

Nowadays the source code for these and other BASIC interpreters are freely available on the internet but usually require the user to jump through some hoops to use them. Ie, setting up a build environment. To make things a bit easier, I’ve put binaries and some sources on this page. These are all quite runnable on a KIM-1 with extra memory. There are no interpreted languages that I am aware of that will run in the 1K KIM-1 although Tiny PILOT from Compute magazine can run in 2K, that’s what I used.

Tom Pittman’s Tiny BASIC

Tom distributed a very small BASIC that needed about 3K to run, and was available on paper tape for $5!!! He has quite a bit about it at:

http://www.ittybittycomputers.com/IttyBitty/TinyBasic/

On there is a KIM-1 version that annoys me a bit. Tom and I worked about 10 years ago to disassemble and produce a really good source code package with a lot of my reverse engineering and his comments about portions of the code he could remember details of. For some reason he put up a poorly commented version Here is the source code, listing, and binary to my disassembly which includes a lot of comments and notes from Tom:

Tiny Basic by Corsham

A ready-to-run binary which loads at $0200 and should have RAM up to $13FF

tinybasic.hex

(see also the Tiny Basic page)

Microsoft 8K BASIC

First, here are complete instructions for building your own version Install the CC65 package, then run the make.sh command, then look at the file tmp/kb9.bin, You’ll need to convert that raw binary image to a file suitable for downloading to the KIM.
Or just use my binary. All of these needs at least 12K of RAM starting at $2000.

(see also the Microsoft Basic page)

Create your own Version of Microsoft BASIC for 6502” — pagetable.com

Binaries

Here is a file suitable for downloading onto a KIM-1. It loads at $2000 but to run it you’ll need to start at $4065. Use the L command in KIM-1’s monitor, then upload the file.  I strongly suggest that you change your terminal emulator so it adds a 200 ms pause at the end of each line.  Once it loads, run it by going to 4065 and running it at $4065 G; To see the easter egg, answer “A” when it asks for memory size.

Original KIM-1 Microsoft BASIC: kb9

This is still experimental but I have a version which uses functions in the xKIM monitor (present on the KIM Clone or on the 60K RAM/EPROM board) to save/load from the SD Card System. It also has a DIR command. This is an Intel HEX file and must be loaded from the xKIM “L” command:

xkim

This loads and runs at $2000.

Bob’s Tiny BASIC

All the early issues of Dr Dobb’s Journal discussed using using an intermediate language (IL) to write a general interpreter, then writing a BASIC interpreter using the IL language.  Nobody used this except for Tom Pittman. I liked the idea and about five years ago wrote my own BASIC using that approach. It is buggy, but the sources are on github so anyone can take them, hopefully debug things, and put fixes back in place. My version also has commands to save/load programs to/from a Corsham Technologies’ SD Card System.

Source code:

Github Corsham

And a binary version that can be run starting at address 0200:

mytb.hex

Versions:
2019 archive
2021 archive

Bob’s_Tiny BASIC