This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Turbo-BASIC XL" – news ·newspapers ·books ·scholar ·JSTOR(April 2020) (Learn how and when to remove this message) |
![]() Version 1.5 startup screen | |
Original author(s) | Frank Ostrowski |
---|---|
Initial release | December 1985; 39 years ago (1985-12) |
Written in | 6502 assembly |
Platform | Atari 8-bit |
Turbo-BASIC XL is an enhanced version of theBASIC programming language forAtari 8-bit computers. It is a compatible superset of theAtari BASIC that shipped with the Atari 8-bit systems. Turbo-Basic XL was developed byFrank Ostrowski and published in the December 1985 issue ofGermancomputer magazineHappy Computer. A version for the 400/800 models was released shortly after asFrost Basic 1.4. Several modified versions working with different DOS systems have been released by other authors.
Turbo-Basic XL greatly improves execution over Atari BASIC. An Atari BASIC program loaded into Turbo-BASIC, with no changes made, would generally run about three times as fast. A Turbo-Basic XLcompiler created binaryexecutables, further speeding up program performance to about ten times faster than Atari BASIC. Turbo-Basic XL also includes an expanded editor, support for named procedures,WHILE...ENDWHILE
and similar block constructs, and added access to the underlying hardware, which, among other things, allowed operation of attachedfloppy drives without exiting toDOS.
Ostrowski soon got a job withGFA Systemtechnik GmbH (at the time known asIntegral Hydraulik) where he adapted Turbo-Basic XL intoGFA BASIC for theAtari ST, which became one of the more popular BASICs on that platform.
Since their release in 1979, the8-bit family normally shipped with a version of Atari BASIC on aROM cartridge, or built into the internalROMs on 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. It was notoriously slow, appearing at the very bottom of the list ofmicrocomputer BASICs in the original version of David Ahl'sCreative Computing benchmark.[1]
The poor performance of the official Atari BASIC led to a market for 3rd partyBASIC interpreters with better performance or more commands. Among them was an official port ofMicrosoft BASIC sold by Atari, several improved versions released byOptimized Systems Software, who had written the original Atari BASIC under contract, and many others. There were also several Atari BASIC compilers from a variety of vendors.
Turbo-Basic XL was a late entry to this list, first published in December 1985 astype-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 toAtari DOS 2.0.
The internal disk-related commands were tied to particular versions of DOS. A number of ports to different versions of DOS became available.
![]() | This sectionpossibly containsoriginal research. Pleaseimprove it byverifying the claims made and addinginline citations. Statements consisting only of original research should be removed.(May 2021) (Learn how and when to remove this message) |
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 the speed advantage improved 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. In MS-derived BASICs the line numbers were stored as 16-bitintegers and numeric constants in the code in their originalASCII format. When a line likeGOTO 1000
was encountered, the interpreter would use special code to convert the "1000" into 16-bit format and then search for it. Atari BASIC worked differently, converting all numeric constants to a 6-bytefloating-point format when the line was entered. This meant the "1000" was no longer in ASCII format and had to be converted from floating-point to integer format. The code for doing so was not well optimized and could take over 2 ms (average 1-1.5 ms).
FOR...NEXT loops are another common construct in BASIC programs. In most BASICs, when the FOR portion was encountered at runtime, its memory location in thesource code was pushed onto acall stack so it could easily return to that location when the associated NEXT was encountered. For unknown reasons, Atari BASIC pushed the line number of the FOR onto the stack and then looked through the entire code for that line when it encountered the NEXT. For programs that did significant looping, which is often the case in BASIC, this could cause a dramatic performance hit.
Turbo-Basic implemented itsFOR loops using the address, as was the case in MS BASIC, and thus ran loops with roughly the same performance as MS. It then went further and greatly improved GOTO performance as well. Line numbers were sent into ahash function that broke them into 256-line chunks. As the program was entered, the address of the first of each of these chunks was stored in a 128-value table. At runtime, when a line number lookup was needed, it would first pick the nearest-but-lower value in the table, retrieve the address, and then begin scanning for the line from that point on. The improvement was most notable in larger programs where the scanning time was increasingly expensive, which is why Turbo-Basic could hit a 5-times increase in larger programs.
The other major source of poor performance in Atari BASIC was its very slowbinary-coded decimal (BCD)floating point code. Thelibrary, contained in a separate 2K ROM and considered part of theoperating system as opposed to BASIC itself, had been written in a hurry and never optimized. Some of the routines, notably the multiply and exponents functions, were far slower than they could be.
Turbo-Basic fixed this by including its own complete 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 performance improvements, sending the Atari from near the bottom of theCreative Computing Benchmark lists to near the top, beating a number of machines that were much faster in hardware.
Among the extra features of Turbo-Basic XL, added to Atari BASIC, are the following: