The History of basicode
Navolgend artikel over de historie van Basicode werd op internet ontdekt via de site van Lennart Benschop:
The Beginning
During the late seventies a new phenomenon appeared in Holland and the rest of the world. This phenomenon was the home computer. A home computer looked like a typewriter without a carriage and it had to be connected to an old, barely working TV set and a ditto cassette recorder.
Those were the days!
The ads promised it to be the thing that you could use for such useful things as word processing, accounting, database management and training yourself with programming. I don’t know whoever really managed a database on cassette tapes or managed to do any useful word processing without a printer. That left very few useful things you could do and games as a useless (but far more interesting) thing. Among the useful things were certain computations that very few people actually needed, education and d.i.y. programming (Dijkstra’s lost BASIC generation).
It must ave been 1979 or 1980 that the NOS (the Dutch broadcaster “Nederlandse Omroep Stichting”) started transmitting computer programs over the radio in the popular hobby program ‘Hobbyscoop’. First these programs were only usable on specific machines, such as the Tandy TRS-80, the Commodore PET, the Apple-2 or the Exidy Sorcerer. The data transmissions in that time had thus two big drawbacks: you had to transmit every program four times and some of the cassette formats didn’t survive radio transmission very well, for example caused by receiving limitations, errors on the tape, etc.
In 1982 the Hobbyscoop people had 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 also purchase them from the NOS.
The Basicode format was basically a 1200BPS RS232-like signal that was FSK modulated with 1200 and 2400 Herz 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:
100 Clear screen.
110 Set cursor to position given by the variables HO and VE.
120 Read cursor position and return it in variables HO and VE.
200 Read key on keyboard and return it in IN$. Return empty string if no key available.
210 Wait and read a key on the keyboard and return it in IN$.
250 Beep.
260 Return random number between 0 and 1 in RV.
270 Return the amount of free memory in FR.
300 Convert number SR to string, returned in SR$
310 Convert number SR to fixed width string, width=CT places after decimal point=CN, returned in SR$,
350 Print SR$ on the printer.
360 Newline on the printer.
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, COS, TAN, ATN, EXP, LOG, ASC, VAL, LEN, CHR$, LEFT$, MID$, RIGHT$ (no STR$, you had to do GOSUB 300).
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:
1000-19999 Main program.
20000-24999 subroutines.
25000-29999 Data lines.
30000-32767 Copyright notice etc.
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:
– An 8085 simulator containing an assembler, a disassembler and simulator (with animated register contents) all in about 25k.
– A text adventure.
– A mini spreadsheet with 5×16 cells or so.
– Computation programs (satellite tracking, electric networks).
– Tax calculation programs.
– Lots of educational programs (instruction and exercising).
– They even made an audio CD “Best of Basicode” with the stuff.
Most of the BASICODE transmissions were in fact what they called ‘beeldkrant’ or ‘Hobbyscoopkrant’ (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. There used to be no spaces between keywords and what followed “GOTO20” instead of “GOTO 20”.
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:
– Simple monochrome bitmapped graphics (points, lines, text).
– File storage (disk and cassette).
– There was also a BASICODE standard format for files (divided into small blocks).
– Sounds (single tone).
– Delay and read a key with timeout.
– Some odds and ends (print a highlighted string, read character from screen, disable break key (for the kids at school)).
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:
– Simple programs to draw figures or play tunes. One of these drew the TV test picture (in monochrome).
– A graph drawing program.
– The usual educational stuff.
– A program to draw the globe (seen from any angle). On some slow machines this could take nearly an hour! Thank goodness we have xearth now.
BASICODE was even used in the GDR (East Germany). By 1989 it was probably so obsolete that no one else was interested anymore.
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.
Een voorbeeld van een Basicode programma vind u hier