History of Basicode
Java was not the first standard that
offered portable interpreted programs. BASICODE existed much earlier. When I
wrote this text initially, a web search on the word BASICODE gave no hits, but
it's getting better. But there's still reason to post some more info about that
forgotten piece of history. The university library still has the Basicode 1 and
Basicode 2 books and cassettes somewhere in its storage but for how long?
The beginning
During the late seventies a new
phenomenon appeared in
It must be 1979 or 1980 that the NOS (the
Dutch radio) started transmitting computer programs over the radio in the
program 'Hobbyscoop'. First these programs were for specific machines, such as
the TRS-80, the Commodore PET, the Apple-2 or the Exidy Sorcerer. This had two
big drawbacks: you had to transmit every program four times and some of the
cassette formats didn't survive radio transmission very well.
In 1982 they got the idea to invent a
standard cassette format to transmit BASIC programs over the air. This was
called BASICODE. Each computer needed a so-called translation program to read
the Basicode signal from cassette and to translate the ASCII representation to
the native (tokenized) BASIC representation in memory. Most translation
programs could also convert the program in memory back to ASCII and save it on
cassette as Basicode. The translation programs were transmitted over the air
and you could purchase them from the NOS.
The Basicode format was basically a
1200BPS RS232-like signal that was FSK modulated with 1200 and 2400Hz tones,
essentially the native cassette modulation format of Acorn BBC computers (but
not divided into small blocks). It was a `synchronous' FSK format. A 0 bit was
represented by a single period of a 1200Hz tone and a 1 bit was represented by
two periods of a 2400Hz tone. This feature made the signal easy to decode and
generate with software on a single I/O line. It could also be done using a
simple tone decoder/encoder and a standard UART. Most home computers could be
made to send or read Basicode on their existing cassette port. Each byte
consisted of one start bit, 7 data bits and 2 stop bits (or as the spec said: 8
data bits, the most significant had to be 1, and 1 stop bit. Is there a
difference?). FSK had a fair chance of surviving radio transmission and
cassette taping despite the comparatively high baud rate. The bytes sent with
Basicode were an ASCII representation of the BASIC program. The first byte was
ASCII 2 (STX) and the final byte was ASCII 3 (ETX), followed by a bitwise
exclusive or checksum. Lines were terminated with ASCII 13 (CR). The whole
program was transmitted as one large block with 5 seconds 2400Hz leaders and
trailers.
This was what the bits looked like:
|_____|~~~~~|__|~~|__|~~|
zero bit. one bit.
This was what the whole program looked
like:
2400Hz leader STX CR Lines
of the program ETX CHECK 2400Hz trailer.
BASICODE 2.
While Basicode made it possible to
exchange programs on cassette among different computers and to transmit them on
the air, it offered little in the way of portability. Programmers were just
encouraged to use no special features of their BASIC dialect. In 1984 the
so-called Basicode 2 standard emerged. The cassette format stayed just the
same, but a subroutine library was added. The lines below 1000 were reserved
for the subroutine library and the BASIC program could not contain them.
Further it was exactly defined which BASIC statements, functions and operators
were and were not allowed in Basicode programs.
The following subroutines were available:
The following commands were allowed:
PRINT, INPUT, GOTO, GOSUB, RETURN, FOR..TO..STEP, NEXT, IF..THEN (no else),
ON..GOTO, RUN, ON..GOSUB, STOP, END, DIM, READ, DATA, RESTORE, REM,
assignments. (No DEF FN!)
The following functions were allowed: TAB
(only in print statement), ABS, SGN, INT, SQR, SIN,
The following operators were allowed:
AND, OR, + (also with strings), -, *, /, ^ (exponentiation), <, =, >,
<=, <>, >=
Variable names had a maximum length of 2
characters and a bunch of them were forbidden (IF, FN, GR, AT etc.) and those
starting with O were reserved for internal use in the subroutine library.
Arrays had a maximum of 2 dimensions. String arrays of variable length strings
were allowed. Lines were limited to a length of 60 characters.
A Basicode program had to indicate the
reserved space for strings in the variable A on the first line. The start of a
program looked as follows:
1000 A=1000:GOTO20
1020 REM The first line of
the program.
There was a convention to use the line
numbers in the following way:
For the following computers a Basicode 2
translation program existed: Exidy Sorcerer, DAI, Color Genie, Commodore PET,
VIC-20, C64, Amiga, Sinclair ZX81, ZX-Spectrum, QL, Philips P2000T, Acorn Atom,
BBC, Electron, Tandy TRS80, MSX, Oric Atmos, Newbrain, Amstrad CPC 464, IBM PC
and most compatibles, Apple II series, Texas Instruments TI-99/4A, Mattel
Aquarius and others.
Most of these computers had a BASIC
dialect that was a superset of the dialect specified by BASICODE and the
translation program was very short. Others had a deviant BASIC dialect and the
translation program contained half a BASIC interpreter to provide some of the
semantics (ZX Spectrum) or you simply got an incomplete translation (ZX81). It
was assumed that the screen contained at least 24 lines and 40 columns. On
machines like the ZX Spectrum the translation program also contained a screen
device driver to get that many characters. Some machines didn't have a cassette
port (PC compatibles manufactured after 1983) and you needed a little adapter
on the parallel port.
So what could be done with BASICODE 2?
You could do animated games but most were so slow that they were unplayable on
many machines. You could do comparatively nice screen formatting using the
cursor positioning commands. The following programs existed:
They even made
an audio CD "Best of Basicode" with the stuff.
Most of the BASICODE transmissions were
in fact what they called 'beeldkrant' (screen bulletin?). These consisted of a
sophisticated BASIC program to format the text in the data lines for screen
viewing or printing. Of course the message was in the data lines, the program
was just overhead. It contained a summary of the news items in the
"Hobbyscoop" program, radio amateur and space news and the schedule
of the HCC (Hobby Computer Club) events. Transmissions continued to about 1991.
I still have one of those critters on-line, but it's not in its original
formatting. There used to be no spaces between keywords and what followed
"GOTO20" instead of "GOTO 20". This one was transmitted on
So you can get it here.
BASICODE 3
In 1986 it was
time for a new revision of BASICODE. In BASICODE 3 the subroutine library was
extended with the following types of subroutines:
The NOS did not want to adopt this
standard because the makers didn't want the translation programs transmitted
over the radio. The TROS (one of the other broadcasters) did transmit BASICODE
3 programs and sold cassettes of them. The NOS continued to use BASICODE 2.
Some programs I remember:
BASICODE was even used in the GDR (
Now that we have the Internet and every
modern machine can read and write 3.5 inch MS-DOS diskettes (the reliability
and quality of which are rapidly declining!), BASICODE does not seem a
significant achievement. But back in the olden days not every microcomputer had
an RS232 port and modems were not as affordable and reliable as today.
Different computers simply could not read each other's cassettes and disks.
BASICODE was often the only way to transfer a program from one machine
to another one, short of retyping it.
Downloaded from http://www.xs4all.nl/~lennartb/basicode.html