!!!Atari BASIC

!Background
Atari BASIC is the "standard" BASIC dialect for the 8-bit series. It was originally sold separately as a (relatively expensive) 8k ROM cartridge. Starting with the 1200XL, the ROMs were included inside the machine. There are three versions, the original version, retroactively known as Revision A, and the updated Revision B and C which fixed various bugs.

Atari originally licensed the 6502-assembler code for Microsoft BASIC, which was about 9k in size. The Atari design limited cartridges to 8k, and the Atari programmers struggled to cut the MS code down enough to fit in a cart. That was bad enough of its own, but they really wanted to add additional instructions to take advantage of the Atari's graphics and sound as well. Eventually they gave up and went looking for a 3rd party to do it for them, and eventually chose Shepardson Microsystems.

Shepardson, or SMI for short, won the contract. They proposed cutting some features and adding others to provide access to the capabilities of the new machine. The result required about 10k, so to cross the remaining gap to 8k, some of the core libraries were moved out of the language and into the operating system ROMs. This had the side-effect of allowing any other language on the Atari to use these routines as well.

By the time SMI was hired, Atari was in something of a rush to get the BASIC. They were planning to show the machines in January 1979, and the contract required SMI to deliver the final version by April of that year. SMI completed it well in advance of the deadline, in October 1978, so Atari took an early version of the code with them to the CES show in January. To SMI's surprise, they learned that Atari had begun burning that version to ROM, even though it had several known bugs. SMI offered an updated version, but Atari didn't bother using it, shipping the buggy version for years.

Among the code moved to the OS ROMs was the floating point system, which was based on a 6-byte format. The 9k version of MS BASIC also used this format, while the much more common 11k version (used by Commodore and others) used an expanded 9-byte format. This meant the Atari has somewhat less accuracy, although in practice this meant little (the IBM PC had even less). In contrast, a very real issue was that the Shepardson floating point code was terribly slow, and this had a significant performance impact on almost all programs.

Generally, Atari BASIC was among the slowest BASICs of its era, both due to the math code and two problems involving loops. The performance issues led to a profusion of 3rd party BASICs, some of which continue to be developed to this day. By replacing the math libraries and fixing these two loop issues, speed improves on the order of 3 to 5 times in most programs, and this is a common feature of 3rd party BASICs like [TURBO-BASIC XL] and [FastBasic].

!Design notes
Atari BASIC has some key differences with the more common MS-derived BASICs found on most contemporary machines. This included the 6-byte vs. 9-byte math, but also included numerous syntax changes as well.

Generally, one can describe Atari BASIC's design philosophy as "orthogonal", in that any command could be used anywhere (there was no difference between "immediate mode" other than the lack of a line number) and every output had a corresponding input. For instance, all BASICs include a LIST command that outputs the source in text form to the screen or another device. Atari BASIC added an ENTER command which did the reverse, taking text from a device and putting it into the program. This opened up a number of possible overlay techniques that other versions lacked.

The most noticable difference between Atari BASIC and MS-derived versions is the string handling. Atari BASIC used a greatly simplified system of character-arrays instead of the dynamic strings in MS. This meant that all strings had to be predefined using DIM, and their length could not be changed during run-time. There are a number of advantages to this approach, notably speed, but memory handling is more difficult and conversion of standard programs from MS listings is more difficult.

!What's missing
In addition to differences like string handling, Atari BASIC also lacked some of the less-used features found in MS BASIC. Among these are...

* TAB and SPC, for formatting output
* PRINT USING, which formatted output
* INPUT "prompt", A$, which printed the prompt and placed the cursor at the end
* DEF FN, which defines mathematical functions
* ON X GOTO/GOSUB, similar to C's switch construct

Most 3rd party BASICs add many of these features, and more.

!What's new
To allow BASIC programmers access to the advanced features of the system, Atari BASIC added commands for defining the GRAPHICS, changing COLORs, MOVEing and drawing a LINETO, playing SOUND, and others.

!! Books

* [The Atari BASIC source book|The Atari Basic Source Book], contains the complete source code for Atari BASIC, fully described. Useful for anyone interested in interpreter design.
* [Atari Basic Rev C Reference Manual]
* [ATARI Basic Leitfaden.pdf]
* [Atari BASIC Quick Reference Guide-Gilbert Held.pdf]
* [ATARI BASIC-Handbuch für Selbststudium und Praxis-BOB ALBRECHT, Le Roy Finkel, JERALD BROWN-Screen.pdf] 214 Doppelseiten, OCR, 44,8 MB

!! CAR-Images

* [Basic Rev. C.car]
* [The Monkey Wrench.car] Tool for better editing Basic programs, version I
* [The Monkey Wrench II.car] Tool for better editing Basic programs, version II

!! ROM-Images

* [Atari Basic Rev. A.rom]
* [Atari Basic Rev. B.rom]
* [Atari Basic Rev. C.rom]

!! Atari Basic Course: An Invitation to Programming 1-3

* [An Invitation to Programming 1 CX4101]
* [An Invitation to Programming 2 CX4106]
* [An Invitation to Programming 3 CX4117]

!! Kurs 1: Programmieren leicht gemacht-Lernen Sie BASIC mit Dagmar Berghoff-TXG4110

* [Programmieren leicht gemacht TXG4110]

!! Kurs 2: Noch mehr BASIC-Lernen Sie BASIC mit Dagmar Berghoff-RXG 55007

* [Noch mehr BASIC RXG 55007]

!! Kurs 3: BASIC für Fortgeschrittene-Lernen Sie BASIC mit Dagmar Berghoff

* [BASIC für Fortgeschrittene]

!! Source and Tools

* [Atari BASIC Article in Wikipedia|http://en.wikipedia.org/wiki/ATARI_BASIC]
* [Atari Basic vs. Commodore C64 Basic vs. Apple II Basic]
* [Atari BASIC: the good, the bad and the ugly|http://archive.li/njp7N]
* [RPM810] Program to measure 810 disk speed
* [Infoline] Infoline for BASIC and ACTION!
* [ST Mouse Driver for Basic]
* [Boolean Logic in BASIC]
* [Atari Basic Special Clear Screen] (german)
* [How to find the revision number of Atari Basic]
* [Basic Fast Stack and Fast Jump]
* [BASIC on-off from DOS XL commandline]
* [Page Flip Routine for Basic]
* [RAM Move Routine for Basic]
* [Basic Program Lister]
* [UUDecoder]
* [Create Data-Statements from binary load files]
* [Schnelle Player Bewegung in Basic] (german)
* [REV.B TO REV.C CONVERTER.txt] Atari Basic Rev. B to Rev. C Converter as TXT file
* [RevB2C.atr] Atari Basic Rev. B to Rev. C Converter as ATR-image