Turbo-Basic XL

This article is about the language for Atari 8-bit computers. Not to be confused with Borland's unrelated Turbo Basic.
Turbo-Basic XL
Turbo-BASIC XL 1.5 startup screen.
Turbo-BASIC XL 1.5 startup screen.
Original author(s) Frank Ostrowski
Initial release December 1985 (1985-12)
Written in Bibo Assembler
Platform Atari 8-bit family

Turbo-Basic XL is an advanced version of BASIC for the Atari 8-bit family of home computers. It is a compatible superset of the Atari BASIC that was built-in to most Atari machines of the era.

Turbo-Basic XL's most notable feature was vastly improved execution speed. An Atari BASIC program loaded into Turbo-BASIC, with no changes made, would generally run about three times as fast. A Turbo-Basic XL compiler was also available that created binary executables, further speeding up program performance to about ten times faster than Atari BASIC.

Turbo-Basic XL was developed by Frank Ostrowski and published in the December 1985 issue of German computer magazine Happy Computer. A version for the 400/800 models was released shortly after, known as Frost Basic 1.4.

Background

Since their release in 1979, the 8-bit family normally shipped with a version of Atari BASIC on a cartridge or built into later machines. This version of BASIC had a number of custom commands that allowed partial access to the system's advanced features like graphics and sound. However, it was also notoriously slow, one of the slowest microcomputer BASICs when running the David Ahl's Creative Computing speed tests.[1]

The poor performance of the official Atari BASIC led to a market for 3rd party BASICs with better performance or more commands. Among them were an official port of Microsoft BASIC sold by Atari, several new versions released by Optimized Systems Software, who had written the original Atari BASIC under contract, and many others. There were also several Atari BASIC compilers.

Turbo-Basic XL was a late entry to this list, first published in December 1985 as type-in program. It was unique in that it came in both interpreter and compiler versions. It included code to take advantage of the expanded memory available on the XL series machines, and later XE series. This meant that it could not run on the original 400/800 systems, which led Ostrowski to make a port known as Frost BASIC (short for "Frank Ostrowski") that was tied to Atari DOS 2.0. A number of ports to different versions of DOS were available.

Speed improvements

The most notable feature of Turbo-Basic was its dramatically improved speed; an unmodified Atari BASIC program loaded into Turbo-Basic would normally run three to five times faster, and this would improve as the program size grew. This was due largely to a series of improvements on well-known problems in the original Atari BASIC code.

In most BASICs, GOTO was handled by reading the associated line number and then searching through the program for that line of code. A simple improvement was to compare the line number to the line it was found in; if the GOTO line number was larger, the interpreter would only search forward from that spot, if it was smaller, it would search from the start of the program (MS BASIC included a pointer to the next instruction, but not previous). Atari BASIC lacked this simple improvement, searching through the code from the start every time.

FOR...NEXT loops are another common construct in BASIC programs. In most BASICs, when the FOR portion was seen, its location in the source code was pushed onto a call stack so it could easily return to the FOR when the associated NEXT was encountered. Atari BASIC lacked this improvement, instead it looked through the entire code for the associated FOR, which took up considerable time. For programs that did significant looping, which is often the case in BASIC, this could represent a dramatic performance hit.

TURBO-BASIC improved on both of these, improving even on the MS model. Instead of any searching or push/pop, TURBO maintained a separate list of pointers for every GOTO, GOSUB or FOR. These were pushed onto the list as they were encountered, so only the first lookup for any given line number required a scan through the code. From then on, the return address was simply looked up in the list. This was most notable in larger programs which generally have more loops and GOTOs, which is why TURBO could hit a 5-times increase on larger programs.

The other major source of poor performance in Atari BASIC was its very slow floating point code. The library, contained in a separate 2k ROM and considered part of the operating system as opposed to BASIC, had been written in a hurry and never optimized. Some of the routines, notably multiply and exponents, were far slower than they could be. TURBO fixed this by including its own entire floating point library, which not only fixed many of these issues but also further optimized the code by unrolling small loops. For programs that used math extensively, the new library resulted in dramatic improvements, sending the Atari from near the bottom of the Ahl benchmark lists to near the top, beating a number of machines that were much faster in hardware.

New Features

Among the extra features of Turbo-Basic XL, added to ATARI BASIC, are the following:

References

  1. Ahl, David (November 1983). "Benchmark comparison test". Creative Computing. p. 260.
  • Fetzer, Ron (1985). Expanded Turbo-BASIC XL Documentation (PDF).
  • Atari 8-bit pages Scans of the Turbo-Basic XL listing and Turbo-Basic XL compiler listing from Happy Computer Magazine. Also lists the new commands added to the language.
  • Turbo-Basic XL Information about Turbo-Basic XL including source code on atariwiki.org.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.