Level II BASIC

written by Matthew Reed

Level II BASIC advertisement

Model I Level II BASIC advertisement from the January 1979 issue of BYTE. The price for a 16K Level II Model I dropped to $849.00 in a matter of months.

When the TRS‑80 Model I was introduced on August 3, 1977, it came with Level I BASIC, a 4K BASIC interpreter, in ROM. Level I BASIC was created by Steve Leininger, the designer of the TRS‑80, who based it on the public domain “Palo Alto Tiny BASIC” that Dr. Li-Chen Wang wrote in 1976.

But Radio Shack’s plan was always to upgrade to a more advanced Model I BASIC later. The very first TRS‑80 brochure said that “planned expansion includes an extended Radio Shack Level II BASIC.” It was mentioned again in the first issue of the TRS‑80 Microcomputer News (then known as the Radio Shack Microcomputer Newsletter) in 1977:

A Level II BASIC is now being developed. This will be a 12K BASIC with every feature you ever imagined — PEEK and POKE, PRINT USING, transcendental functions, advanced string handling, etc. It should be available on ROM soon.

Extended BASIC

Level II BASIC was written by Microsoft, a company which at the time was only two years old. Microsoft (originally Micro-Soft) got its start writing a 4K BASIC1 for the Altair 8800 in 1975. This original Altair BASIC was written by Bill Gates, Paul Allen, and Monte Davidoff. Microsoft soon expanded Altair BASIC into an 8K version, and then an Extended BASIC.

Level II BASIC for the Model I was based on the same code as Extended BASIC and was remarkably similar. In a 1981 interview with 80-U.S. Journal, Bill Gates described the design of Level II BASIC:

It’s a hybrid, in between Extended and 8K. For example, there are no user defined functions or short error messages; two features typically in Extended. But there are PRINT USING and double precision variables, which aren’t found in 8K BASIC. The additional data types were one of the key things we wanted to get. So we took that as given and pared it down to cram it into the 12K.

He also said that Microsoft’s work on Level II BASIC took “about four weeks from start to finish.”

Features

Level II BASIC retained most Extended BASIC features, such as PRINT USING, double-precision and integer variables2, and IFTHENELSE. Some other features, such as user defined functions, long error messages, and INSTR, were removed but reappeared later in TRSDOS Disk BASIC. Only a few commands, such as ERASE, SWAP, and HEX$, disappeared entirely. Level II BASIC also added some commands, such as SET, RESET, POINT, and INKEY$, that were not present in Extended BASIC.

Here’s a description from a 1979 Radio Shack catalog:

Level II is an advanced or “extended” version of [the] BASIC programming language. It offers vastly increased computing power, faster execution time, faster cassette operation (500 baud), and increased numeric accuracy of up to 16 significant digits (intrinsic functions remain at 6-digit accuracy). In addition, you get formatted printing, program editing (with extensive editing commands), error trapping, named files, multi-dimensional arrays, comprehensive string variable handling, automatic line numbering, tracing, keyboard rollover, and many other features which will delight the advanced programmer. Of course, a detailed 140-page manual is included.

Although Radio Shack had planned to release Level II BASIC in late 1977, it wasn’t actually available until March 1978. The Level II BASIC (ROM) Kit (catalog number 26-1120) cost $120.003. Installation at a Radio Shack store was required, but the installation was included in the price. The Level II ROM would work with both 4K and 16K Model I systems and also systems with a 48K Expansion Interface. Level II BASIC was required to use a disk drive.

Unfortunately, Level II BASIC also introduced the problem of keybounce. There were four revisions of Model I Level II BASIC. The most significant was the version 1.3 revision, which fixed the keybounce problem.

We set the standard

Microsoft’s motto at the time was “We set the standard” and as one 1979 Microsoft advertisement put it: “The largest-selling microcomputer systems use software by Microsoft.” For example, the Commodore PET 2001, the Apple II4, and the Radio Shack TRS‑80 all (eventually) used Microsoft BASIC in ROM. Microsoft BASIC was one of the few standards in the early microcomputer industry and most of the implementations were quite similar. As the introduction to the book Microsoft BASIC Decoded and Other Mysteries (which contained an analysis and disassembly of the Model I ROM) pointed out, “Although you may find that the code is organized differently in your Heath or Sorceror, the routines are, for the most part, identical!”

Disk BASIC

Level II BASIC reserved a number of commands, such as LOAD and OPEN, for future use5. They were implemented by TRSDOS Disk BASIC, which was also written by Microsoft. TRSDOS Disk BASIC was very similar to Altair Disk BASIC and mostly used the same commands, although a few Altair-specific commands, such as MOUNT and UNMOUNT, were not implemented. Not all of the added commands were disk-related. Some of the most useful commands, such as INSTR and expanded MID$, had nothing to do with disk.

Other TRS‑80 operating systems, such as MULTIDOS, DOSPLUS, and LDOS, included their own Disk BASIC interpreters not derived from TRSDOS Disk BASIC. Although mostly compatible, these interpreters added additional features and usually used less memory.

Level III BASIC

Microsoft wrote one other BASIC version for the Model I called Level III BASIC. It was originally sold by GRT Corporation and had the distinction of being the first Microsoft program sold directly to consumers. Level III BASIC was available for cassette and Exatron Stringy Floppy users only, but it served much the same purpose as TRSDOS Disk BASIC.

Model III BASIC

Although some Model III computers were sold with Level I BASIC, the vast majority were sold with Level II BASIC. Radio Shack created their Model III implementation of Level II BASIC using the same code as the Model I version6. It could run almost all Model I Level II programs. For some reason, Radio Shack referred to it in catalogs as “Model III BASIC” rather than “Level II BASIC,” although I don’t know anyone else who used that name.

Model III BASIC was 14K long, 2K longer than the Model I Level II BASIC. The extra 2K was used for a lowercase driver, time and date commands, and several other features.

Model 4 BASIC

The TRS‑80 Model 4 was completely Model III compatible, but also could run its own more advanced version of TRSDOS. The BASIC included with Model 4 TRSDOS was derived from MBASIC, Microsoft’s implementation of BASIC for CP/M. Although both were written by Microsoft, MBASIC differed quite a bit from Altair Extended BASIC. Converting a program from Level II BASIC to Model 4 BASIC was usually not a trivial undertaking.


  1. As a bit of trivia, 4K Altair BASIC was one of the very few Intel 8080 programs that wouldn’t work on the Zilog Z80. 
  2. Some sources state that Level I BASIC had no floating point support, but actually the opposite was true; all it supported was floating point numbers (the equivalent of single-precision in Level II). This is probably due to confusion with Apple II Integer BASIC, which also preceded a Microsoft BASIC (Applesoft). 
  3. The Level II Kit also contained a “Level II Blackjack/Backgammon tape.” 
  4. The Apple version of Microsoft BASIC was named Applesoft. The first version of Applesoft BASIC (Applesoft I) was released on cassette in January 1978. The better remembered Applesoft II, released in May 1978, was eventually available on cassette, disk, and in ROM. 
  5. Invoking one of these commands generated a ?L3 ERROR. The L3 was an abbreviation for Level III BASIC. According to Bill Gates, TRSDOS Disk BASIC was originally going to be called Level III BASIC but the name was changed after Level II BASIC was completed. Microsoft later reused the name for their own product. 
  6. Microsoft had no part in the conversion although, according to John Roach, they received “additional compensation” for its use in the Model III. Bill Gates said that Microsoft received “an on-going yearly fee” for Model III BASIC, further stating that it was “strictly bounded.” 
Categories: Software

Comments

David Sutherland says:

Another good article. Thanks.

I’d never realized Model 4 TRSDOS (Disk) BASIC was substantially different. Are there are commands that are unique to Model 4 TRSDOS BASIC?

I’d like to see a list of commands unique to different BASIC languages — something like a key when looking at a BASIC listing that might help quickly determine which system that BASIC code was designed to run on.

Matthew Reed (TRS-80.org) says:

Model 4 BASIC was a very powerful BASIC. It supported up to 40 character variable names and some nice commands like WHILE/WEND. Unlike Level II BASIC, it required spaces after each keyword. It also required a THEN statement after each IF. It didn’t support SET, RESET, or any of the cassette commands. There were programs sold that could do a simple conversion, but a programmer really needed to do the final steps.

Leave a Comment

All comments are moderated. The name and email fields are required, but your email address will not be published.

Thank you for commenting!