Datasoft BASIC Compiler
- Medium
- Disk
- Year
- 1983
- Publisher
- Datasoft
- Type
- Language
- Category
- Atari BASIC to 6502 machine-code compiler
- Developer
- Special Software Systems (Phillip Dennis)
- Language
- 6502 machine language
- Requirements
- 48K Atari 400/800/1200XL with disk drive (two drives recommended); Atari DOS 2.0S
Overview
The BASIC Compiler from Datasoft was one of the first three BASIC compilers for the Atari. It appeared in 1983 alongside Monarch's ABC and Computer Alliance's BASM, at $99.95 on a 48K disk. It was written by Special Software Systems (programmer Phillip Dennis). Unlike ABC, which produces interpreted P-code, it turns an Atari BASIC program into true 6502 machine code. Datasoft claimed programs ran 5 to 20 times faster.
The same compiler was later sold by MMG Micro Software as the MMG BASIC Compiler (1984), which became the better-known version (see that entry). Versions 1.4 and 1.4A of the Datasoft release are known.
How it works
The compiler does not generate machine code directly. It writes assembly-language source and then runs its own assembler:
- You SAVE your program from the BASIC cartridge, boot the compiler disk without cartridges, and give source and object file names.
- You choose integer or floating-point arithmetic. The matching run-time package is linked into the result: about 3.6K for integer and 4K for floating point.
- Pass 1 translates BASIC into a series of assembler files (
ASSEM.SGA,ASSEM.SGBand so on) on disk. - A three-pass assembler (
ASM.OBJ) then assembles them into a binary DOS load file, which can also be namedAUTORUN.SYS.
Because the intermediate files are plain assembler, hackers could modify the generated code with Datasoft's separate DATASM editor/assembler. A Line Reference Map lists the machine address of each BASIC line on screen, printer or disk. If a compiled program crashes, it prints the standard Atari error number and the failing address, so with the map you can find the guilty BASIC line and even restart the program at a new address.
Speed
In ANALOG Computing #11 (1983), Brian Moriarty timed a benchmark that fills a GRAPHICS 24 screen with nested FOR/NEXT loops and POKEs:
| Run-time environment | Jiffies | Seconds |
|---|---|---|
| Atari BASIC cartridge | 4,160 | 69.3 |
| Atari Microsoft BASIC (disk) | 3,348 | 55.8 |
| OSS BASIC A+ 3.05 | 2,717 | 45.3 |
| Datasoft compiler, floating-point mode | 2,435 | 40.6 |
| Monarch ABC | 565 | 9.4 |
| Datasoft compiler, integer mode | 218 | 3.6 |
Integer mode was about 19 times faster than the cartridge and comfortably beat ABC. The floating-point mode was only a modest gain. Graphics commands such as PLOT, DRAWTO and FILL barely speed up under any compiler, because they call the same OS routines the cartridge uses.
The catch
The Datasoft compiler was much stricter about source code than ABC:
- Integer mode limits numbers to ±32,767 (addresses for PEEK and POKE excepted) and rejects ATN, CLOG, COS, EXP, LOG, SIN and SQR. Both modes support
RND(). - GOTO, GOSUB and RESTORE need constant line numbers. The manual didn't mention RESTORE, which Moriarty found the hard way.
- DATA statements must all sit at the end of the program, after an END, STOP or GOTO, and DIM sizes cannot be variables.
RUNworks only without a filespec. LOAD, SAVE, ENTER, LIST, CONT, NEW, BYE, CLOAD and CSAVE are not allowed, and LIST takes on a special meaning (see the MMG entry).
Disk space was the other problem. The assembler files need about five times the space of the BASIC source and always go to drive 1. That limits a single-drive user to about 100 sectors of BASIC, and around 144 sectors even with more drives. Moriarty's 99-sector adventure filled the disk until he moved the assembler alongside it, and the result was 214 sectors, twice the original size. He also reported bugs in the first release with TRAP, VAL, strings and numeric arrays. His verdict: it was unbeatable for raw speed and for tinkering with the output, but greedy with disk and RAM, and buyers should make sure they got a fixed version.
No licence fee was charged for selling compiled programs, provided the documentation credited the compiler.
Using it today
Disk images of the Datasoft release are hard to find, but the code lives on as the MMG BASIC Compiler. That version's manual also covers double-density drives, which ease the disk-space limit. In an emulator, put the compiler on drive 1 and your program, along with copies of SYSEQU.ABC, the run-time library and ASM.OBJ, on drive 2. Large virtual disks remove most of the original pain. Forum users still use it to compile Atari BASIC; the most common gotcha is a GOSUB to a variable, which it will not accept. Rewrite those as ON X GOSUB.
Credits
- Picture: The Datasoft box, marked for Atari 400/800/1200XL, 48K diskette. — Box front scan from AtariMania (basic_compiler_d7.jpg) (Box art © Datasoft 1983 — used for identification/commentary)
- ANALOG Computing #11 (May 1983) — BASIC Compilers for the Atari: A Comparative Review, Brian Moriarty — Internet Archive, 1983
- AtariMania — BASIC Compiler (Datasoft) — Box front scan from AtariMania (basic_compiler_d7.jpg) (Box art © Datasoft 1983 — used for identification/commentary)
- MMG BASIC Compiler manual (same compiler, 1984) — Internet Archive — Internet Archive, 1984
- Antic Vol. 2 No. 8 — I/O Board (two compilers for Atari BASIC: Datasoft and Monarch) — AtariMagazines.com (Kevin Savetz)
- AtariAge forum — BASIC/compiler list ('MMG Compiler (essentially the same as Datasoft)') — AtariAge forum members
- AtariAge forum — using the Datasoft compiler (GOSUB with a variable not allowed) — AtariAge forum members
