Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 10, NO. 12 / DECEMBER 1984 / PAGE 223

IBM images; Better Basic - it really is. (evaluation) Susan Glinert-Cole.

Every once in a great while a product comes along that is so amaxing that superlatives fail miserably (and also sound pretty corny) when trying to frame a capsule description. Let me just string a few in here for the record: BetterBasic, from Summit Software, is *WONDERFUL*, !MARVELOUS!, FANTASIC . I am sorry that they chose to use the word Basic in the handle, because Basic haters may be reluctant to try it out. They will be missing a good, nay, great, thing if their (not unreasonable) prejudices cause them to pass BetterBasic by.

BetterBasic combines all the best features of interpreted Basic, Pascal, and Forth, with a few lagniappes from C and assembly language thrown in for good measure. While it appears to the user as an interpreted language, in fact it is incrementally compiled. As statements are entered, they are converted to an intermediate pseudo-code, which is then interpreted by the run-time interpreter. Before you gag on the concept of p-code, I suggest you refer to the benchmark table (Table I). BetterBasic was only a second slower than compiled Microsoft Basic.

BetterBasic requires an IBM PC, PC/XT, or a "100% compatible" computer. It can run in 128K, but 192K is recommended. It needs only single sided drive and will operate under PC-DOS 1.1 and up. It was designed to be compatible with Microsoft Basic, although there are some differences that might necessitate a bit of editing. Program conversion is thoroughly covered in an appendix. Some of the dissimilarities will gladden your heart, for example:

* BetterBasic does not need to do garbage collection, so FRE is replaced by SIZE, which gets the amount of free memory.

* Random record manipulation is simplified considerably in BetterBasic. THUS MKIS and friends, FIELD, GET, and PUT are all replaced by READ RECORD and WRITE RECORD.

* DEF FN is not needed; there are much more powerful function facilities available.

On the down side, the joystick and light pen are not supported; neither are active or visual pages. Procedures

Procedures and functions are supported in the manner of Pascal and C, with local variables and parameter passing by value or address. The language is extensible; functions and procedures defined by the user can be incorporated into BetterBasic and used just like the built-in commands a 1a Forth. Programs, and/or procedures and/or functions can be converted to self-contained, separately compiled packages called modules. Modules can contain entire application programs. Both programs and modules can be converted to executable. COM files.

The module is central to BetterBasic, and the kernel system comes fleshed out with several standard one (graphics, sound, and even trapping among others). Additional modules are offered at extra cost. There include support for windows, 8087 support, an advanced programming package (direct support for assembly language), and a run-time module for making commercial application packages.

Purchasers of the latter module will be licensed to sell applications without any additional royalties. They are working on a module that will permit interrupt calls along the same lines as Borland's Turbo Pascal method.

BetterBasic supports the full complement of memory for the PC (640K). The main program can be only 64K in size, but each procedure and function can also occupy 64K, making the program size limited only by memory. The data space for the main program can be another 64K, and each module can have 64K of data space all to itself. A 64K stack can also be allocated.

The documentation is handsomely presented in a fat, half-height binder and contains a table of contents and an index. The sections are separated with sturdy, plastic-coated tabs--a thoughtful touch that IBM manuals unfortunately lack. Besides being nice to look at, the manual is well organized, informative and complete. The first section is a tutorial, and while it touches on only a few of the more exotic bells and whistles of BetterBasic, it does a good job of acclimating the new user. Full Screen Editor

The full screen editor is a pleasure to use, especially after struggling with the minimal line editor of MegaBasic. There is full, dynamic syntax checking (with meaningful error messages) when a line of code is entered. There is also a CHECK command that checks the logical structure of a program and optionally ascertains if sufficient memory exists for arrays, records, and other memory-hungry structures. There is an automatic listing formatter built into the editor. Listings 2 and 4 show complete print-outs, including procedure and function definitions, with keywords capitalized and block structures nearly indented by the formatter. I would prefer several blan lines between the main program and the rest of the stuff, but that is getting a bit picky.

There is a cross-reference command that will generate a symbol cross-reference listing for the current workspace (e.g. main program, function, or procedure). It can also take an optional single identifier and list only referces pertaining to it. The listing can be saved to a file or device if desired.

An extensive variety of data types is supported: byte, integer, real, string (32,767 characters), pointer (of any type), record, array, and array of arrays. Alas, there is no double length integer type, something I missed when running the Sieve. Real numbers are Binary Coded Decimal, which I guess is becoming fashionable in these days of financial crisis. You can choose your own precision; any number between 6 and 24 digits is acceptable.

Pointer variables are declared as any other data types e.g.: BYTE PTRD: namelist STRING PTR: namelist and so on. The procedure: SET pointer = variable initializes a pointer variable to point to an actual variable. Pointers can be directed at a variable subrange such as a substring, an array element, on a record field.

The declaration STRUCTURE is similar to the RECORD declaration in Pascal, and pointers can be aimed at structures as well. To make things really interesting, you can use another set of declarations to associate a name with the structure of an array rather than the structure itself. Thus the structure name can be used to declare actual arrays, array pointers, array fields in records, or arrays of arrays. Commands

There is a rich set of commands, statements, procedures, and functions incorporated into BetterBasic. First of all, conditional execution of code blocks can be directed with any of the following statements: DO (unconditionally) DO IF DO x TIMES DO UNTIL WHILE . . DO FOR . . NEXT END DO REPEAT REPEAT IF EXIT EXIT x LEVELS

GOTO and GOSUB are implemented, but unncessary in light of the above list.

Character manipulation has a few extras as well.

READCHAR (#token) A$ (,x) will read characters from a file device, or string into A$, where #token denotes an optional integer previously associated with an input device or a file, and x is the (optional) number of characters to read. Similarly,

READCHR FROM A$, B$, x reads x characters from A$ and puts them in B$.

Saving and restoring screens in BetterBasic is simple. The statements: AVE SCREEN minrow, mincol, maxrow, maxcol, Bytearray RESTORE SCREEN minrow, mincol, maxrow, maxcol, Bytearray are self-explanatory. They are useful when used in conjunction with a series of window manipulation procedures. A window is defined as follows: DEFINE WINDOW #, minrow, mincol, maxrow, maxcol, (color), (, ON background) (BLINK) where # is the window number. Foreground and background colors, as well as blink can be optionally set. A title can be displayed (in any color) at the top of a window with HEADER. Frames can be drawn anywhere on the screen with the procedure:

FRAME color, minrow, mincol, maxrow, maxcol and the prcedure FRAME WINDOW x, (colore draws a frame around window x. All window parameters can be saved into an array and later recalled with SAVE PAR/RESTORE PAR procedures.

PEEK and POKE are augmented with several functions/selectors. The function: A = WOR [seg:offset] return the word at the specified memory location. WOR [seg:offset] = A stores the value of A in memory. PRINT WOR [seg:offset] prints the value of the word at the specified location. BYT is the 8-bit counter-part of WOR. there are also logical and arithmetic shift, and rotate functions.

The interface to assembly language at this writing is slightly complicated, but well explained in an appendix. There are several examples given as well, which is very helpful. The IBM PC-DOS DEBUG.COM can be invoked from within BetterBasic to trace through an assembly language procedure.

Listings 1 through 4 will give you some idea what a Basic program can look like. I emphasize "can," because if your preference runs to listings like 1 and 3, you can write them that way instead of taking advantage of BetterBasic. Listings 1 and 2 are the IBM Basic and Betterbasic versions respectively of an entertaining little graphics show. Listings 3 and 4 are the Sieve again. Table I shows the cumulative benchmarks of Basics I have tested so far. Summary

BetterBasic is as robust as they come; in the four months I have been using it, it has never crashed or done anything odd. end user support is outstanding. The folks at Summit Software fall all over themselves in an effort to solve your problems (I might add that the only problems I had were of my own doing).

I do have a few complaints, all of them relatively trivial. The compiler is very greedy when it comes to disgorging variables, procedures, and functions that are no longer wanted. If you make a mistake entering them, they are there forever and cannot be thrown out. This includes the minor, but irritating, fact that they cannot be renamed if declared external. So if, like me, you accidentally had the Caps Lock key on and typed the function names as fARKLES instead of the comlier Farkles, you are stuck with it.

Along the same lines, arguments must be declare before any code is placed into that subroutine. If you decide to pass two parameters instead of one at some later time, you can't declare it. The only recourse is to set up another procedure, with, alas, another name if the original version is declared external. While this discourages the practice of al fresco coding, it is hard lines on several of us who, from time to time, have been known to make mistakes. Brief Notes

Framework, from Aston-Tate, is an exquisitely designed product. It embodies the entire gamut of fasionable hyphenated buzz words: user-friendly, context-sensitive on-line help, windowing, pop-up (or is it pull-down?) menus, integrated, idea processing, integrated spreadsheet/word processor/data base management personal productivity tool. Sorry guys, no mouse. I have been using it for a week and, despite iths terrible copy protection scheme, the cluster formerly occupied by my spreadsheet have been heartlessly deallocated, and I now use my word processor only for fancy formatting. More details next months.

Products: Better Basic (computer program)