Classic Computer Magazine Archive ANTIC VOL. 4, NO. 9 / JANUARY 1986

FEATURE REVIEW

BASIC XE FROM O.S.S.

Ultimate BASIC for 8-bit Atari

by Christopher Chabris

When Atari shipped the 130XE computer in April 1985, Optimized Systems Software (OSS) seized the opportunity to create the first programming language designed for the expanded 128K memory of the XE. The result is cartridge/disk BASIC XE, the fastest and most powerful BASIC available for 8-hit Atari XL and XE computers. NOTE: BASIC XE will not run on Atari 400 or 800 models. Users of these earlier computers still have BASIC XL available from OSS.

Optimized Systems Software was the first independent company to write software for Atari personal computers. Bill Wilkinson and his programmers created the disk file management system of DOS 1.0, 2.0 and 2.5, as well as Atari BASIC and the Atari Assembler Editor cartridge. But they didn't stop with software just for Atari to bundle with its computers. OSS went on to publish the best line of Atari programming languages and tools including MAC/65, ACTION! and BASIC XL.

BASIC A+ was the first OSS enhanced version of Atari BASIC. Unlike the Microsoft JBASIC released by Atari, BASIC A+ was compatible with source code that ran under Atari BASIC, except for a few minor exceptions. BASIC A + was available only on disk, but the subsequent, improved BASIC XL came in super-cartridge form, using the technique of bank selection to cram 16K of ROM code into 8K of address space and save 8K for programs.

Now comes BASIC XE, one of the largest programming languages for the 8-bit Atari computers. Its 27K of code is divided between a 16K supercartridge and 11K of extensions that can be loaded from disk when the cartridge is booted. If these optional extensions are not present on the boot disk, BASIC XE still functions – but without some of its extra features. With or without the extensions, the language occupies 8K of address space.

CUSTOMIZED STATEMENTS

BASIC XE is rich in commands and functions, with 140 built-in keywords. I say "built-in" because the language makes it possible for programmers to create named procedures that accept parameters – in effect, adding statements to the language. This enhancement completes the evolution of Atari BASIC into a tool for modern programming. The IF:ELSE:ENDIF and WHILE:ENDWHILE constructs (introduced in BASIC A +) allow for Pascal-like structured programming style, and the new PROCEDURE:LOCAL:EXIT trio coupled with CALL give the programmer modular design and recursion capabilities in an interpreted language.

It is now possible to create libraries of often used PROCEDUREs quite simply. Before BASIC XE, the programmer had to precisely define which variables contained values to be passed to a subroutine, which variables would change during its execution, and which variables would contain values returned from the subroutine. A chore, and difficult to debug! Here's a sample PROCEDURE definition and execution in BASIC XE:

30000 Rem CALCULATE F(X) WHERE F IS A POLYNOMIAL WITH COEFFICIENTS IN P()
30010 Procedure "EVALPOLY" Using Degree, !P(),X:Local E,V
30020 For E=Degree To 0 Step -1
30030 V=V+(X^E)*P(E)
30040 Next E
30050 Exit V

These lines would fall near the end of the program, usually beyond the END statement. They define a new procedure named EvalPoly (Evaluate Polynomial) which receives three arguments: Degree, the degree of the function; P( ), an array containing the coefficients in ascending order; and X, the value at which to evaluate P. Note that non-scalar parameters are preceded by an exclamation point.

LOCAL creates tbe following variables as temporary scalars. Other variables with the same names are not affected, and the local variables disappear when an EXIT is encountered. The EXIT statement causes the procedure to return V (making the procedure really a function!). EvalPoly could be called as follows:

CALL "EvalPoly" USING 4,IF(),2.5 TO Y

This statement would evaluate the fourth degree polynomial represented in array F at the value 2.5 and store the result in variable Y. The beauty of this parameter passing and returning scheme is that it is totally independent of line numbers and variable names. It is portable like Pascal procedures or C functions.

I forsee the availability of specialized libraries to add capabilities to BASIC XE. For example, you could collect procedures to do matrix algebra or create various graphics objects. Since LOCAL can only create scalar floating point variables, BAS IC XE is particularly suited to mathematical applications.

SPEED TO SPARE

This brings us to another new feature of BASIC XE – its fast mathematics routines which replace these built into the XL/XE Operating System, when the extensions are loaded. According to OSS, these routines are more accurate and twice as fast as those in the FastChip from Newell Industries, which are supposed to be 30% faster than Atari's built-in routines.

BASIC XE also features the semi-compiled mode of operation introduced in BASIC XL. When the FAST command is encountered at the beginning of a RUNning program, all line number references are converted into absolute addresses, eliminating many time-consuming searches through the program. OSS claims that these two enhancements make BASIC XE run two to six times faster than Atari BASIC.

To test BASIC XE's speed, I used the off-the-shelf Atari BASIC software B/Graph, from Batteries Included. Among B/Graph's statistical capabilities is a program to do regression analyses. I felt this to be a good test because it uses extensive iterations and floating point caculations – BASIC XE's strengths. Using the sample datafile PLANET, I followed the instructions on pages 113-114 of the B/Graph Manual and obtained the following completion times for different versions of BASIC:

Atari BASIC, rev. C     30 seconds
BASIC XL, vl.03         12 seconds
BASIC XE, v4.10          7 seconds

The first was tested under Atari DOS 2.05, the others under OSS DOS XL 2.30p. BASIC XE without the extensions loaded performed similarly to BASIC XL, and using EXTENDed mode made no difference in any case.

So BASIC XE does offer significant improvements in speed when running Atari BASIC programs. Exercising its features from start to finish in the program development process should yield shorter, inore elegant and readable, and still faster code than possible with any other BASIC for the Atari. And it will take less time to write the program because BASIC XE's powerful commands take the place of many machine-language subroutines. All this is possible on either the 1200XL, 600XL with 64K, or 800XL computers. But with the 130XE, you can do even more.

130XE SPECIALS

The new EXTEND command instructs BASIC XE to utilize the extra 64K memory available in the 130XE's secondary bank. Your program itself is relocated into this space. Main memory is reserved for variables, the stack, and other related items. (Page Six is always available for user purposes.) In EXTENDED mode, depending on your Disk Operating System, there will be approximately 63K available for program and 32K available for data.

In this way, BASIC XE lets you take full advantage of your l30XE's memory without worrying about the nity-gritty details of memory management. However, if you want to use your extra 64K in another way besides a RAM-disk, BASIC XE allows you to specify an optional bank number in the POKE, DPOKE, PEEK, DPEEK, MOVE, BGET and BPUT commands. When referring to an address in the range $4000-$7FFF, the secondary bank's "access window", banks 0-3 are within that bank and the default bank 4 indicates main memory. This makes memory management convenient compared to twiddling the PIA PortB bits.

BASIC XE's other advanced features are, as they say, too numerous to even list here completely. They include, among others, commands to sort arrays into ascending or descending order, Microsoft BASIC string handling, OSS's classic file manipulation and Player/Missile graphics commands, bit-manipulation operators, hexadecimal numeric support, and program development aids like disk directory, renumbering, and cross-referencing.

What should he added to BASIC XE? Well, using the 5K remaining in my wished-for 32K cartridge, OSS could add the REPEAT:UNTIL construct, integer variables, dynamic memory allocation, and advanced sound control – to name just a few possibilities. And of course, some sort of run-time library or compiler would be nice.

BASIC XE is an excellent product. It's the language that should have been built into the 130XE. OSS is a company that has always supplied the highest quality systems software for all Atari computers, but they have outdone themselves with this one. One can only wonder how they will top BASIC XE. I hear they are developing for the ST machines.

BASIC XE
Optimized Systems Software
1221B Kentwood Avenue
San Jose, CA 95129
(408) 446-3099
For XE/XL Ataris
Cartridge plus disk
$79.