Classic Computer Magazine Archive START VOL. 3 NO. 12 / JULY 1989

Review

HiSoft BASIC and
HiSoft BASIC Professional

BY DAVID PLOTKIN
START CONTRIBUTING EDITOR


HiSoft Benchmarks Made Easy! File HISBENCH.ARC on your START Disk.

HiSoft BASIC and HiSoft BASIC Professional are a new pair of fast, compiled BASICs from MichTron, Inc. They support many of the ST's special features, but some knowledge of GEM is required to make full use of them. HiSoft BASIC Professional is, according to MichTron, the more advanced package, and this review will focus on it. At the end of this review, I will note those items which are different in HiSoft BASIC.


The Editor

HiSoft BASIC Professional provides a complete programming environment--everything from an editor to libraries of external functions. The editor is used for typing in your program text but, since its output is plain ASCII text, you can use any editor you want. You will, however, give up the interactive nature of the compiler if you don't use the HiSoft editor. The editor functions as a rudimentary word processor with pull-down menus and keyboard shortcuts for most commands. Besides being able to enter, edit, load and save text, the editor includes such functions as search and replace and cut and paste. You can even cut and paste between files. Auto-indent is also supported, which makes it easier to follow any nested loops.

From the editor, you can compile your program to disk or compile it to memory and run it immediately. If you compile it to disk, the result is a stand-alone file which can be run by double-clicking on its icon or name from the Desktop.

Absolutely no syntax checking is done while entering a program in the editor, so errors only appear when you attempt to compile your program. When the compiler finds an error, it stops and displays an error message (some of which aren't especially helpful!). It then gives you the option of continuing with the compile. If you stop, the editor is reloaded and your program appears with the cursor on the offending line. You can then correct the error and attempt to recompile. If you continue the compile when an error is flagged, of course, the final product won't run, but any other errors in the program will be found and flagged. Some of these other errors may not be errors at all, but a result of the compiler becoming confused by your earlier errors. Whichever method you choose, when you reload the editor, the cursor will once again be placed on the line containing the first error, and you can jump to each line containing an error and correct that line.


Features and More

HiSoft BASIC Professional is a fully-featured BASIC that includes many of the features that have come to be expected in modern BASICs. It supports integer, long integer, string and single- and double-precision floating point numbers. Arrays with dimensions limited only by available memory, and string arrays, are also part of the language. These arrays are dynamic--you can re-dimension them (with retention of data, if you want), and erase them, freeing up their memory for other uses. HiSoft BASIC Professional does not require line numbers, although they can be used to maintain compatibility with older BASICs. Labels are available to mark important locations in a program in lieu of line numbers or the two can be combined.

HiSoft BASIC Professional supports FOR/NEXT statements (with an EXIT FOR option to jump out of the FOR loop), WHILE/WEND, DO/LOOP and REPEAT/END REPEAT. The DO/LOOP construct allows the modifiers WHILE and UNTIL at both ends of the loop. If used without modifiers, the DO/LOOP will execute indefinitely, unless an EXIT LOOP statement is encountered. The REPEAT/END REPEAT differs from the norm (REPEAT/UNTIL) since no exit condition can be specified except by using the EXIT option.

HiSoft BASIC Professional also supports powerful decision processes. Both single and multiple line IF statements can be used, along with ELSE, ELSE IF and END IF modifiers. SELECT CASE is also available, so that a series of results can be specified based on the value of a variable. An exact match to the variable, range of values, or a logic test (greater than, less than, etc.) can be used to specify which block of statements to execute. There is even a block which can be executed if none of the other conditions are met (ELSE).


hisoftbasic.jpg
The HiSoft BASIC Editor provides a word processor-like environ-
ment for typing in programs, but there is no syntax checking on
text entry.

Structured Programming

HiSoft BASIC Professional includes elements of structured programming. Subprograms are separate portions of the program with their own variables to which parameters can be passed either by value or by reference. If a parameter is passed by reference, then the value of the actual variable used in the subprogram may be modified by the subprogram. Variables from the main program can only be used in the subprogram if they are declared as SHARED. Variables within a subprogram can be either LOCAL (initialized every time the subprogram is called) or STATIC (retain their value between calls to the subprogram).

Subprograms can call other subprograms and can even call themselves. A subprogram must be declared before it is used, either by placing the subprogram itself in the code before it is called, or by using the DECLARE statement to let the compiler know that the subprogram is going to be defined further along. Subprograms can be called either with the CALL command or just by stating their names as a command.

User-defined functions are quite similar to subprograms, except that they return a value and can be used in an equation, just like system functions such as SIN (sine) and COS (cosine). The value you want returned by the function is equated to the function name within the function definition. This is very powerful, because decisions can be made within the function code.


Graphics and Mouse Support

Graphic support includes lines, boxes, circles, filled shapes and flood fill, plus the ability to set the palette colors. Direct support of user-defined fill patterns, line styles and end styles is not available except through the VDI library (see below), nor are polymarkers. POINT returns the color of the specified pixel, and single pixels can be turned on individually with the PSET and PRESET commands.

The mouse position, condition of both mouse buttons, the joystick position and the fire button condition can all be read, but the mouse must be turned off before the stick can be read. The mouse can be changed to one of the predefined shapes (hand, bee, arrow, etc.), but user-defined mouse shapes are not directly supported. Nor is there any direct support for menus, alert boxes or dialog boxes except through the AES libraries (see below). A set of commands which allow opening, closing and moving windows are provided, including commands to read and set the current information about the windows. All regular "gadgets" (close box, sliders, arrows, etc.) can be specified, but strangely, there isn't any direct way for the user to modify the window (such as clicking on the size box or moving sliders) without using the AES functions.

HiSoft BASIC Professional also doesn't support the ability to jump to a particular subroutine when an event (such as menu selection, mouse button, or key press) occurs, a la GFA BASICs ON MENU.


File Handling and Libraries

HiSoft BASIC Professional handles both random access and sequential files. For random access files, all input and output to the disk must be in string format, but a full set of functions is provided to convert numbers to strings and back again. Direct access to memory (via forms of PEEK and POKE) is available, although protected memory can only be accessed via a clumsy DEF SEG statement coupled with PEEK and POKE. SOUND and WAVE commands are virtually identical to ST BASIC--and are not explained very well in the manual.

HiSoft BASIC Professional includes libraries for directly calling BIOS, XBIOS, VDI and AES functions. In the case of VDI and AES functions, these tend to be simplified calls, since HiSoft BASIC Professional handles most references to "handles," freeing the programmer from worrying about such things. The VDI library includes the graphics functions, making it possible to do such things as define your own fill pattern or mouse shape (left out of "standard" HiSoft BASIC). You will need a good book on GEM, because the manual does not provide the "legal" values for the function parameters, and you are totally on your own when attempting to use the VDI block move operations such as vro_cpyfm.

The AES libraries include such functions as the rubber-band boxes (for moving and dragging rectangles) and all necessary functions for event polling (menus, messages, windows, keyboard, etc.), setting up and responding to menus, dialog boxes, and objects. The functions which return the list of rectangles for windows which need to be redrawn is also included. Again, a good tutorial book on GEM is required in order to use these items in your own programs.

Menus can be built from a string within HiSoft BASIC Professional, and installed using an AES library function call. Resource files, such as those created by WERCS, MichTron's new Resource Editor, can be loaded and used also. The full implementation of AES is important here, because HiSoft BASIC Professional provides no other way to get at many of the functions which make up a standard GEM program.


More on the Manual

The manual which accompanies the two HiSoft BASICs is very good. It opens with a tutorial, then provides an alphabetical listing of all commands. The appendices list the BIOS, XBIOS, VDI and AES functions, although, as mentioned earlier, they do not provide enough information to fully use these functions. Also listed in the appendices are the error messages, compiler options and a long section on how to set up and use drop-down menus. Sample programs on the disk also provide useful information, although it is not really possible to make use of dialog boxes from the information provided. One minor problem with the manual is that the introductory tutorial uses an exceedingly complex example, the Towers of Hanoi problem.


HiSoft BASIC vs. GFA BASIC 2.0 and 3.0

One question that is bound to be asked is how HiSoft BASIC Professional stacks up against the reigning champion of BASICs, GFA BASIC. HiSoft BASIC Professional has many powerful commands and it is easier to use VDI and AES in HiSoft BASIC Professional than with GFA BASIC 2.0. This is because there is no need to worry about loading a multitude of parameters and using generic VDI and AES calls.

HiSoft BASIC Professional supports direct, simplified calls to the GEM functions. GFA BASIC 2.0 does support "interrupt" programming however, vectoring program execution to the appropriate subroutine when menus are selected or the mouse button clicked, and providing a mechanism for receiving GEM messages directly from GFA BASIC. These operations are more difficult to do in HiSoft BASIC Professional, since you must use GEM functions (and understand how they work). HiSoft BASIC Professional also provides more powerful loop and decision functions.

GFA BASIC 3.0 adds many more commands and makes virtually all GEM functions available in simplified form from within the language, bringing it up to the level of HiSoft BASIC Professional in terms of GEM support, but also keeping the interrupt features. On the other hand, GFA BASIC 3.0 does not have a compiler as yet, and the current manual is unusable, although that is being fixed. Thus, if you require fairly straightforward access to GEM and compiled output, HiSoft BASIC Professional is the clear choice until a compiler arrives for GFA BASIC 3.0. When it does, either of these two languages will be a satisfactory choice for significant programming power.

HiSoft BASIC Professional costs twice as much as HiSoft BASIC. Strangely, there does not seem to be any significant difference between the two languages. According to George Miller, Product Director for MichTron, the two languages are different: HiSoft BASIC Professional supposedly supports more VDI and AES function than HiSoft BASIC, as well as having additional compiler options. However, a comparison of the compiler options showed that they were identical. Also, MichTron was unable to specify exactly which commands were missing from HiSoft BASIC--apparently no one has ever compiled a list! A careful comparison of the two manuals and the quick reference cards provided show that with a single exception, every command is present in both languages, including GEM calls. That single exception is the VDI function for setting the shape of the mouse. This is not important because the equivalent AES function is available.

HiSoft BASIC Professional is capable of having external libraries added to it, while HiSoft BASIC is not, but this is of no interest to you unless you can use assembly language (the libraries must be written in assembly) and own or will buy DevPac ST, a development package from HiSoft. Also, HiSoft BASIC cannot be used to write Desk Accessories. Thus, unless you require assembly language access to HiSoft BASIC, or are well-enough versed in GEM to write Desk Accessories, the less expensive package appears to be a much better buy.


Conclusion

The HiSoft BASICs are fast, efficient languages, graced with well-written manuals and are relatively easy to learn and use. They minimize the awkwardness of compiled languages, since the compiler is fast, although some error (syntax) checking in the editor would be nice. If you are willing to work with GEM and need a fast language, HiSoft BASIC could be an excellent choice.

David Plotkin is a chemical engineer with Chevron USA, a START Contributing Editor and our resident expert on BASICs.


PRODUCTS MENTIONED

HiSoft BASIC Professional $159.95, HiSoft BASIC, $79.95, WERCS, $49.95. MichTron, Inc., 576 South Telegraph, Pontiac MI 48053, (313) 334-5700.


HiSoft Benchmarks

Since HiSoft BASIC was not available at the time of START's BASIC overview in the October 1988 issue here are the results of the same benchmarks we ran on the other BASICs for the ST at that time. The benchmark we ran is on your START disk in the archive file HISBENCH.ARC; un-ARC the file following the Disk Instructions elsewhere in this issue. The file HISBENCH.BAS is in ASCII format; the program HISBENCH.PRG can be run from the Desktop. (Editor's note: This program can produce slight variations on other systems. )

Time to calculate Pi: 15.6 jiffies
Sum of sines: -.127175
Time to calculate sum of sines: 4.2 jiffies
Sum of square roots: 671.463
Time to calculate sum of square roots: 1.8 jiffies
Time to count to 5,000 with floating point numbers: 27 jiffies
Time to count to 5,000 with integer (max safety): 4.2 jiffies
Time to count to 5,000 with integer (max speed * ): 2.4 jiffies
Time to go to a Procedure:1,000 times: 3.3 jiffies
Time to do 512 string manipulations: 7.2 jiffies
Time to do disk access (drive A): 580 jiffies

* Only in counting with integers was there a significant difference between the compiler's "max safety" and "max speed" settings, so both of these results have been listed above.