TweetFollow Us on Twitter

BASIC Wars
Volume Number:2
Issue Number:8
Column Tag:Basic School

BASIC Wars - A First Look

By Dave Kelly, Editorial Board

They've arrived! It's been a long wait but they're here. The Macintosh now has several new BASIC development tools to work with. I hope to bring you some kind of quick overview of the features (both good and bad) of these new products:

Z Basic™ (version 3.01) Zedcor

True BASIC™ (version 1.1) True Basic Inc.

PCMacBASIC (version 1.60) Pterodactyl

I'll also try to bring you a re-run in the way of comparison of Softworks BASIC and MS BASIC. Believe me, it's still not easy to pick any one version as my favorite. They all have their pluses and their minuses. I hope to present an accurate view of each. Please keep in mind that the vendors are working hard to correct last minute bugs or deficiencies and that a follow-up article will report on how successful these efforts have been.

Before we get into any of the features, here is the first benchmark that we use for our comparison. This is the same benchmark that was presented in the May 1986 MacTutor.

Accuracy Benchmark

(See Table 1)

40 time1=TIMER    :REM  Use TIME for Softworks Basic
50 s=0
100 x=0
200 FOR n=1 TO 1000
300 s=s+x*x
400 x=x+.00123
500 NEXT n
600 PRINT s,x
700 time2=TIMER
800 Totaltime=time2-time1
900 PRINT "Elapsed Time =",Totaltime,"Seconds."

This same benchmark has been run on various desk top computers to compare their speed and accuracy in engineering or scientific applications. Most desk top computers convert real numbers to their binary equivalent before performing software math operations. This introduces an error depending on the precision of the math routines that can propagate through many math operations, producing a considerable error in the final result. This benchmark program, developed by R. Broucke at the University of Texas, Austin, tests for this error propagation. See Table 1 for the results on different computers.

Accuracy in these computers is a function of the number of bytes used to represent the mantissa. A three byte mantissa is used in most versions of Microsoft BASIC (single precision). This is illustrated by the systems that give 503.545 for an answer. The TRS-80, Altair 8800, Osborne MBASIC and IBM personal computer are typical of this version of Microsoft BASIC. Those versions of Microsoft BASIC implemented on a 6502 microprocessor typically use a four-byte mantissa, giving 503.543832 or something similar as the answer. Note that only those computers NOT using a Microsoft version of BASIC come up with the right answer (with the exception of the decimal version of Macintosh MS BASIC). The HP 9836 uses 6.5 bytes or 52 bits to represent the mantissa, and 11 bits to represent a 3 digit exponent! This is why the HP 9836 has such a high precision compared to the other desk top computers.

The speed of each computer is related to the efficiency of it's BASIC interpreter and the clock speed of the computer. Most of the 6502 based systems run at 1 mHz, while the Z-80 systems typically run between 2 and 4 mHz. The reason there is not more of a difference between the running speeds of the 6502 and the Z-80 is because the 6502 is very efficient in addressing memory, and hence the BASIC interpreters on the 6502 machines are much more efficient than the Z-80 based interpreters. This difference is particularly true for the APPLE II versus the TRS-80 model II, which runs at more than twice the clock speed of the APPLE, yet is nearly identical in the accuracy bench mark speed. The Macintosh runs at 7.8336 mHz, one of the fastest on the list. The difference between an interpreter and a compiler is shown by the fact that the HP 9836 PASCAL runs twice as fast as the HP 9836 BASIC for this bench mark. This is also evident from the comparison of compiled Basics and interpreted Basics on the Macintosh.

Remember that any benchmark test only checks specific attributes of the language. Other areas may have strengths or weaknesses which the benchmark cannot address. Of the Macintosh Basics available, it appears that True BASIC is fastest of those languages giving the correct answer, with Z Basic, PCMacBASIC and MS Basic (d) being the only other Basics to give a correct answer. True Basic's math routines are impressive in accuracy, speed, and breadth.

The Sieve of Erastothenes benchmark results shown in TABLE 2 indicate that Z Basic overall is the fastest BASIC available. That is reasonable since Z Basic is compiled. True Basic has very good results for being an interpreted language. One glaring result is the PCMacBASIC time on the Sieve is 66 seconds, significantly slower than Z Basic. The reason for the apparent slow time is that PCMacBASIC uses dynamic arrays, which can be re-dimensioned and even spooled to disk as virtual arrays. The extra overhead of keeping track of the dynamic array size when addressing elements in the array is magnified by this benchmark and accounts for the time difference between it and Z Basic, which uses standard fixed arrays. This is a powerful feature, but one that has a trade-off in execution time when a lot of array addressing is involved as in the Seive.

Sieve Benchmark

(See Table 2)

DEFINT a-s
10 DIM FLAGS(8191)
20 PRINT "10 iterations"
22 T=TIMER
30 FOR M = 1 TO 10
40 COUNT = 0
50 FOR i = 1 TO 8191
60 FLAGS(i) = 1
70 NEXT i
80 FOR i = 1 TO 8191
90 IF FLAGS(i) = 0 GOTO 170
100 PRIME = i + i + 3
105 REM PRINT PRIME
110 K = i + PRIME
120 IF K <= 8190 THEN 
 FLAGS(K) = 0:K = K + PRIME:GOTO 120
160 COUNT = COUNT + 1
170 NEXT i
180 NEXT M
181 T2=TIMER
190 PRINT COUNT;"primes";T2-T;"Sec."
200 FOR i=1 TO 10:BEEP:NEXT i:END

The Basics Compared

The decision of which version of BASIC is the best is a tough one. I've tried to determine which attributes I would like to see most. For the Macintosh there are also some considerations that don't apply to the average computer. (After all that's why the Mac isn't your average computer!) A few of the attributes that I feel are important are (not necessarily in this order):

1. Support of the Macintosh Standard User Interface including proper implementation of Menus, Windows, Controls, etc.

2. Compatibility with HFS.

3. Access to the Macintosh Toolbox routines.

4. Ease of use. (Editing, documentation, etc.)

5. Speed

6. Reliability (How much does it BOMB?)

7. Price

Of a lesser importance is: Compatibility with versions of Basic on other computers. In most cases the major impact of this is to help sales of BASIC. Most Macintosh programmers (99% of them) want to write toolbox programs, which by their very nature, will not be compatible with other computers anyway. The only place where compatibility counts is when it helps make programming easier because the BASIC commands are similar, such as compatibility with MS Basic on the Mac.

Both Z Basic and True Basic have taken great pains to present a family of compatible Basics for different machines. Z Basic is available on several other computers including Apple //, MS-DOS based systems, and Z-80 based systems. True BASIC on the Mac is compatible with True BASIC on the IBM and the Amiga. Z Basic appears to have done the best job of not crippling the Mac version for the sake of this compatibility. Toolbox support is available both by direct calls to the toolbox and by Basic statements similar to MS Basic which greatly simplify the coding of the Mac interface. True Basic, on the other hand, requires a greater separation between it's normal environment, which it tries to keep compatible to versions on other machines, and the Mac interface. This separation means more work on the programmer's part to implement a true Mac like program, since everything must be done at the toolbox level of detail. Of the two, Z Basic is the most compatible with MS Basic on the Mac and in fact, is the closest to being an MS Basic compiler. But True Basic is very compatible in syntax with HP 9836 Basic and includes a very fine set of matrix commands no other Basic outside of HP has.

PCMacBASIC, as the name implies is compatible with IBM PC BasicA and programs written for the IBM can be easily ported over to PCMacBASIC and run on the Mac. Again, the Mac interface access is not crippled by this compatibility, as complete toolbox access is provided for, both as Basic commands and direct toolbox calls. This feature might be important if there are IBM PC programs you wish to port over to the Mac, that were done in BasicA.

Compatibility is really a secondary issue. Most of us only have one kind of computer anyway. Even if a ported program did run, it wouldn't follow any Macintosh standards which means they would have to be modified, and toolbox calls added to make them "Mac-like". Why bother? It would be much better to design the program from the ground up for the Mac in the first place, in which case, you wouldn't care that your code was compatible with XYZ's computer.

HFS Issues

The use of the Macintosh standard interface is an attribute that is a must for any language. Show me a program that supports the Standard User Interface and I'll show you one that is easy to learn to use. It's the Macintosh way! UNFORTUNATELY, there are some programmers out there that don't follow it very well. We've all seen the results of this when HFS was released. Those programs that don't conform to the standard have had to be modified to work with HFS (i.e. software updates). Some of the programs still exist without modifications, indicating to me that the programmers just don't care if it follows the standard or not. Well, I care! In fact, one of my first questions that I ask before buying any new software is "Is it HFS compatible?", and "Does it follow the Mac Standard User Interface?". That's dangerous though, because some of the incompatibility is subjective. For example, MS Basic is useable with HFS, but depending on the program, you may have to have things located on the root directory. (Take heed Microsoft, MS BASIC is NOT 100% HFS compatible.) Some software packages claim to be compatible with HFS when in fact this only means that it can be made to work around HFS. As it turns out, some files (usually support files, help files or similar type files) must be on the root volume or in the same folder as the application. I'm not so sure if this can really be called HFS compatibility or not.

HFS compatibility should mean a program can find it's own working files no matter where the user chooses to put them! We have already published an HFS Lost File Finder DA. A similar tree search subroutine can be added to any application to search the directories for it's working files. Developers simply have been too lazy to implement this properly. At the very least, a simple standard file dialog box can be called up to ask the user where he put the needed intermediate file. Recently some programs have been taking this approach (Spellswell for its dictionary file) and we think this is much better than artificially confining the needed file to a certain folder or disk.

All the versions of BASIC claim to work with HFS. PCMacBASIC needs certain .REL files (included in a runtime folder) to be on the same disk as the object being compiled, and in the same folder as the user's compiled object file, which is not what you would expect. A dialog box is presented which allows the user to select through the standard file dialog, where his source, resource, listing and object files are located. This works nicely, but having to place the system's ".REL" files in the folder with the user's object file is unwieldy. The reason it was done this way was to get around HFS incompatibilities with the MDS and McAssembly assemblers and linkers. The McAssembly assembler and linker are built into PCMacBASIC, which assembles and links the Basic source into a stand alone application. So HFS problems strike home in round about ways. This Basic also provides HFS commands for your programs so they can create and access folders correctly. None of the other Basics yet consider the HFS compatibility requirements of the user's programs.

The Basics that require the use of the MDS editor already have some problems because the MDS editor itself is not yet HFS compatible. There are other commercial editors available which will work just fine, such as QUED. These HFS incompatibilities are not fatal to the use of the products involved. We can suffer with it till updates are provided. Z Basic has some problems with HFS in the command mode which Zedcor tells me they are working on fixing for the next release. Otherwise, during program execution there doesn't seem to be a problem. We have already reported on how MS Basic must be in the same folder as it's library files and source program.

Mac User Interface

When the implementation of menus, windows and controls etc. in each of the BASIC versions are compared, differences become apparent. All of the versions reviewed seem to make use of menus. Menus should give access to desk accessories and at least have the File and Edit menus as standard. Controls that are in windows should work. That is, if there is a go-away box, size box, buttons, and/or scroll bars, they should work. Although you can define your own windows with Z Basic, the default window (appears when no window has been opened) has a go-away and size box that won't work unless your program is checking for it. Because Z Basic is compiled, there is some responsibility for the programmer to see that the functions all work. Most of the time the default window is used for quick programs that you don't want to spent a lot of time developing the output. I suggested to Zedcor that they use a default window with no go-away or size box so that they would not be present unless the user wanted to program them. (To do otherwise, violates the standard interface guidelines by having controls present which are not implemented.) They indicated they would check into that possibility. Windows and controls in Z Basic are accessed with commands almost the same as MS BASIC (some MS Basic programs may run with no modification in Z Basic). However, there are some differences. First of all, even though event trapping is done similarly to MS BASIC, they won't function correctly unless you flush out the queue occasionally. Events are stored on the queue as they occur (each mouse click and menu selection for example). This will be discussed in a future column involving Z Basic. One item that seems to show a problem involves the use of windows. In Z Basic when multiple document type windows are used, selecting the title bar of the document window should make the window active. Well, it doesn't. You have to select inside the window content region (everywhere except the title bar) to make the window active, another violation of the interface guidelines. These little bugs are being chased out of all the Basics reviewed here, and is one reason why there is no clear cut winner yet.

Z Basic Tops But Still a Few Bugs

Z Basic is my favorite for speed of execution. It is nice in that it supports the same MENU, Window, and control functions as MS BASIC. If you know MS BASIC, you already know many of Z Basic's commands. The manual is my favorite too. It is well written, in a reference style that makes finding things very easy. The breadth of instructions in this Basic is amazing. Even Appletalk access is provided for. Everyone wants double-clickable applications. Z Basic is an easy way to get fast compiled programs which are double-clickable, with very good MS Basic compatibility. But beware that there may be some strange bugs, like the one mentioned above with windows, that we don't know about. There were at least a couple of routines that didn't work properly (Eject and DIR). I was told these would be fixed in a future version. Another problem occurred when I tried to transfer to MDS Edit from the Edit menu. The System crashed with an error 26. Also, smooth scrolling is not implemented in the Z Basic Edit window. The screen "jumps" up and re-paints itself instead.

Line Numbers

One annoying thing is that in all of the other "modern" versions of BASIC line numbers are optional. In Z Basic they are required by the compiler. Zedcor told me that this was so that the compiler could keep track of which line was being compiled and that when errors occurred you could get feedback as to which line has the error. This doesn't have to be a big problem because you can use the MDS (or equivalent) editor without line numbers to write your program, then load it into Z Basic and compile it. The Z Basic editor automatically adds the line numbers. Also, you may save the program with or without line numbers so that it could be re-edited if desired. So, if you are using MDS Edit, you can act as if there were no line numbers, since they are only inserted when you load and compile the program.

PCMacBASIC also requires line numbers for GOTO's and GOSUB's. This is the only Basic in which line labels are not allowed. Boo!

toolbox Support Important

It is a "must" to have access to the toolbox. I've talked about this in the past when reviewing Softworks BASIC. I like the ease of use of MS BASIC to set up menus and windows quickly. All of the new Basics reviewed here support the toolbox. The implementation and documentation available becomes the issue here. MS BASIC, as you know, can only call the toolbox through library routines. Very few routines are included in the language. Independent vendors (like CLR) have provided for this omission by providing a more complete set of library routines to access the Mac ROMS.

Toolbox access has been provided for in True BASIC through subroutines that can be called from your program (This support appears to be very complete). However, True Basic forces a complete separation of the toolbox and True Basic environments. If you use the toolbox for windows, as we did in our example, you have to pass control of the Mac to your program and do everything in toolbox syntax. This means you are really writing a Pascal or Assembly program using Basic syntax, because of the amount of detail you must deal with at the toolbox level. Look at the True Basic example and you'll see how much more detailed (even to the point of calling System Click) the program is, and how much longer as well. Yet, for all your flexibility in writing real toolbox programs, your still programming in an interpretive environment so no double-clickable application despite the Mac like code. A runtime package is available but we think that should be a part of the standard language so full compilation can be obtained any time you want it.

You may use direct toolbox calls using Z BASIC (a complete list of calls is found in the manual, but no examples), Softworks BASIC (see May 1986 MacTutor) and PCMacBASIC. The method of implementation is important because if new toolbox routines are added, will the Basic be able to call them or will the user need a new interface file from the vendor? In this regard, PCMacBASIC probably has the most powerful toolbox interface of all. It allows the user to call virtually every toolbox trap in existence, and even those not in existence, since the user defines the interface himself by using the MDS trap equates file and the USER function. This approach will also appeal to old Apple II users who liked to extend Basic by calling custom assembly routines. You have complete freedom to reach any toolbox routine in the Mac.

Documentation support for the toolbox is lacking in all the versions reviewed except True Basic. Z BASIC and Softworks Basic provides a list of Toolbox calls in an appendix of the manual. Zedcor has told me they plan to release a manual on programming with the toolbox, but I don't know when or how much that will be. The manual for Z Basic is the nicest of the bunch so I expect the Toolbox manual to be very well done. They devote a 115 page section on Z Basic on the Mac (the next largest section is 56 pages for MS-DOS). True Basic provides very complete documentation on a "Toolbox" disk. PCMacBASIC's manual has a very very limited section on how to call some of the quickdraw routines (same routines as MS BASIC), but documentation is so incomplete or hard to understand that I couldn't fully implement the toolbox routines. A revised manual is currently being prepared that will correct this.

Why Standardize?

You may be interested to know what the American National Standards Institute (ANSI) committee X3J2 has been doing lately. Thomas E. Kurtz, one of the authors of True Basic is chairman of that committee. He is also co-author of the original, "Dartmouth" BASIC. The ANSI committee has proposed a standard for the advanced features of BASIC. This standard was the result of many years of deliberations, and it sets the stage for implementing the same version of BASIC on all the leading personal computers. The committee believed that the original basic concepts of Basic had been corrupted and it was their duty to mankind to give Basic an overhaul. True BASIC is the only version that closely conforms to the ANSI Standard. If anything should be a standard, I think it ought to be the ANSI Standard. In addition to the older GOTO and GOSUB statements, True BASIC provides control structures like IF-THEN-ELSE, SELECT-CASE (not found on any other Macintosh BASIC), DO-WHILE (also not on any other version), DO-UNTIL (also not on any other version). The instruction set in general is very close to HP 9836 Basic and is the nicest implementation of all the Basics, considering just the traditional Basic commands. True BASIC provides window and graphics commands, however some of the Macintosh input and output features (for example, windows and menus) are incompatible with True BASIC input and output (for example, INPUT and PRINT). The graphics routines are mostly compatible, that is, your program can use the ROM routines for special graphics and True BASIC for everything else. This means that to make your programs "Mac-like" you may have to do more through the Toolbox subroutines than you would in Z Basic or MS BASIC. It should also be noted that in order to really use the Toolbox well in any of the languages, you have to abandon many of the quickie implementations of the Toolbox (like MENU, WINDOW, DIALOG etc.). You can't mix windows created by Z Basic or True Basic with the windows created by the Toolbox! The solution is to use the Toolbox for as much as you can. The same work (using "Inside Macintosh") would have to go into a program in PCMacBASIC or Softworks BASIC also. True Basic comes with two disks. One is the program disk with programs and examples. The other is the Toolbox disk which contains 13 libraries of subroutines and functions that let you access the Macintosh ROM routines (except on 128k Mac due to space limitations). There is a little bit of documentation on the Toolbox disk, but most of what you will need to know is in "Inside Macintosh".

This still doesn't explain why all these different versions of Basic need to "standardize". Most statements implemented in MS BASIC are somewhat standard in other versions of MS BASIC making it easy to convert programs from one computer to another. In fact, most Z Basic commands match MS BASIC commands in form, fit, and function (with some exceptions). I'm still not sure that any one standard will ever be accepted either. It may take awhile for ANSI to invade the MS BASIC "standard" especially if there is no way to create stand alone applications without investing a fortune. It appears that when writing a program you have to decide right from the start if you want to use menus, windows, dialogs etc. If you do, don't bother with the "standard" implementation, but just use the Toolbox for the entire program, but then you give up the ease of use of a Basic language in the first place. This is particularly frustrating with True Basic. It's a nice thought to think that all Basics in the world could be compatible with each other, but if you really want to make a good professional looking program you'll want to follow the Macintosh Standard User Interface by writing your program with the Toolbox.

I'd like to mention that since True Basic is interpreted, you have to load the interpreter to run your program. Double clicking on a True Basic document from the Finder loads True Basic and then the document, but doesn't run the document. What we really want is True Basic compiled double-clickable applications! True Basic has a compiled mode for the programs which makes them non-listable, but still interpreted although it may run slightly faster than non-compiled and you don't have to worry about linking library subroutines to the "compiled" versions. True Basic only compiles to an intermediate code. Note that the two main complaints with True Basic of not being a compiler and the extreme separation of toolbox mode from True Basic mode, act to reinforce each other, making the problem even more exasperating.

PCMacBASIC is ".REL" File Compatible!

The PCMacBASIC compiler compiles your program into double-clickable applications, linkable object (.REL file), McAssembly source, or MDS source. Now that's what programmers want! The ".REL" file icon for PCMacBASIC programs is identical to the icon produced by the McAssembler (which is convertible to MDS ".REL" file format). The latest version also supports MDS ".REL" file formats directly, in addition to the McAssembly format and conversion utility. If only the execution speed were faster. The use of both dynamically dimensioned arrays and Apple's 80-bit SANE routines combine to make floating point operations significantly slower than Z Basic by our tests. SANE is very accurate, but very slow. This could be an important minus if your application requires heavy floating point processing. Z Basic is just as accurate as PCMacBASIC, but considerably faster in executing double precision arithmetic.

PCMacBASIC programs are written on an editor such as the MDS editor. A resource file is also necessary to give information about the resources used in the program. Menus, windows, controls, alerts, and dialogs are all done as resources. This may be somewhat intimidating to a new Basic programmer, but probably more familiar for an experienced programmer since if follows the "traditional" Mac development cycle. In fact, this Basic is more like Pascal or assembly development on the Mac than any of the others, a distinct plus if you are familiar with Mac programming.

Toolbox routines and assembly language may be programmed within PCMacBASIC through use of the USER function (Example: USER ".word $A888" or USER _TextFace(FONT%) will call the Textface ROM routine). Note that the MDS toolbox equates file may be included in your source to provide a symbolic trap interface, and that this can be extended by the user to new traps or custom routines. In other words, this Basic allows 100% toolbox compatibility now and in future machines, since you are not dependent on a vendor supplied glue file. You can also mix Basic and assembly by placing each line of assembly code in quotes and using the USER function. This allows you to call register based traps from Basic by coding in line a simple assembly routine to pull the Basic variables off the stack, set the register values, call the trap, and restore the stack upon returning to Basic. You can also use the CALL statement and link assembly routines to your Basic program in the traditional compiler/linker approach. Assembly language programming from within Basic is not provided by any other version of Basic. This is a definite plus for PCMacBASIC and one that makes it a strong contender, if the documentation is improved.

The McAssembly resource compiler is built into the PCMacBASIC compiler to compile the resource file. PCMacBASIC also provides a way to convert function keys from the IBM PC (if used in the program you port from the IBM) to menu items. This feature may please those hard core IBM groupies, but probably is of little interest to most Mac people. Like True Basic, toolbox access is an all or nothing affair. All menus, windows, dialogs, and controls have to be implemented in resources. There are no MENU or WINDOW commands like MS BASIC to define your own windows etc. The MENU and WINDOW commands included in PCMacBASIC are for calling the resources created at compile time. This can be interpreted as a plus or a minus depending on your orientation.

Presently, the manual is inadequate to figure out how to implement much of the toolbox. An improved manual is being written which may show their implementation to be highly desirable so keep your eye on this one. The method they chose to implement toolbox calls with the USER function, may be good or bad depending on what you are used to. It requires that you have an understanding of Assembly language in order to define your own USER functions for the Toolbox. We think this is an asset, but the next version will provide a complete file of toolbox USER interfaces and example programs for beginners unfamiliar with trap calls from assembly. Of all the products, this one is most dependent on which way the documentation goes. A good set of predefined Toolbox calls provided on disk along with examples and docs could make this a top notch product because of it's close association with assembly development on the Mac.

A few little funnies were found in version 1.6 and 1.65: it seems when you exit a program, somebody paints an annoying small black rectangle in your window before exiting to the desktop. I'm told this box is the cursor in reverse field, indicating that an invisible cursor is being carried about as an IBM PC compatibility holdover. We'd like to see the cursor go away. Another little bug is a dialog box that comes up when you identify your source and resource files. The dialog box nicely warns you of the HFS restrictions that your files have to be in a certain place, but the bug is the dialog box shows up twice in succession when you click OK before going away for good. This is being fixed.

If you want to try to compile your MS Basic programs, then Softworks, PCMacBASIC or Z Basic is your only choice at the present time. Z Basic offers the most syntax compatibility. PCMacBASIC is slower, but may give you some flexibility if you want to link to other languages because of its compatibility with the .REL format. MacTutor is a #1 supporter of the .REL format, and is encouraging Apple to provide conversion routines from the .REL format to MPW so that object code can be linked with the new Apple development system without re-compilation. (This addition to MPW is being debated at Apple. Contact Paul Zemlin at 408- 973-3711 and voice your opinion on this issue.)

The True Basic manual is printed nicely and spiral bound by Addison-Wesley, but both PCMacBASIC and True Basic manuals are not easy to use as reference manuals. True Basic is the only one with a User Manual (tutorial with Mac specific information) and a Reference manual (common to all versions of True Basic), but the reference manual is not what you would expect. The Z Basic manual is a true reference manual in the spirit of HP manuals. The True Basic reference is again written like an instruction manual similar to the User manual and it is not clear what rightly belongs in each manual. It would have been nice to have another manual for Toolbox calls too. True Basic has done a nice job of writing subroutines for all the libraries. The problem is that you have to print off another whole book worth of documentation from the disk in order to have a reference for the Toolbox. Overall, the True Basic documentation on disk (for the toolbox) is still the best of all the versions reviewed here, which is another way of saying how far we have to go to figure out how to deal with the incredible amount of information required by the "toolbox language".

Now for the my biggest complaint about True Basic: The language is interpreted and not suited for creating applications without the run time package. They want $500 for the run time package to compile to stand alone applications. We at MacTutor feel that the run time capability should be included in the price of the interpreted True Basic. It is clear to us that our readers want to be able to create stand alone applications. All of the competition (Z Basic, Softworks, PCMacBASIC) have provided stand alone (double-clickable) capability with their basic price. Maybe with a few of your comments (cards/letters not phone calls) they might realize just how important it is to be able to create independent applications (hint, hint!!)

The Z Basic manual is Laser printed, soft cover bound (same manual for all versions of Z Basic) with an excellent format (very easy to find information in this one). The manual is the main reason why Z Basic has to rate a slight edge at the present time, despite the bug chasing. It is simply a very well done manual.

The PCMacBASIC manual is the only one that had information about using HFS directories in your programs. Commands are provided for your Basic program to make or change an HFS directory (folder), an indication of HFS compatibility (even supports Zoom Window!). This is an important point that all the other Basics should take note of. Not only does the compiler need to be HFS friendly, but the user's programs also have to be HFS friendly. Interestingly enough, PCMacBASIC itself needs a better HFS design. Vendors: try your product on a Mac Plus. Just how compatible is it? Does it still work if you move things around or add folders or change file names? If you can't make it fully HFS compatible, then do the next best thing and fully explain to the user what the HFS restrictions are. Not enough attention has been given to the HFS issue in any of these Basic products.

BOTTOM LINE: What's the best?

What's the best BASIC? That has a very subjective answer. At the present time, I'm not going to endorse any one version of BASIC over another, although Z Basic seems to have a very slight lead. You might say the votes are not all counted. Z Basic seems to be the fastest and a very interesting language, but still has a few bugs. PCMacBASIC has the ability to create .REL files, but needs a new manual, with better toolbox coverage and is slow. True Basic supports the ANSI standard and seems to be a solid program, but completely separates toolbox mode from True Basic mode and is not compiled. MS Basic has the best implementation of the Macintosh user interface, but has limited toolbox access and is very slow. Softworks Basic has structured declared variables making it somewhat easier to use Inside Mac when designing your program, but the declared variables are not part of any "standard" implementation of Basic, making programs look much different from anything else. In conclusion, each product has a plus and a minus, so that they all equal out. The next level of revisions and updates should be very interesting as we see who gets the most minuses out while retaining the most pluses.

It has been the intent of this column to give you a general overview of each of these new products so as to wet your appetite for the future, and to encourage the vendors to move their products in certain directions. It is too early to tell for sure which one will meet your particular needs until the next level of revisions come out. I feel what we've really done is pointed out how each product has disappointing shortcomings at this time. I'd be very interested to know what your own opinions are concerning the Basics we've discussed. In the months to come, we will find out more about these new versions of Basic as we study how they work and how to program with them. Send in your votes as to which one you would like to see more MacTutor coverage of. In the meantime, you can expect somewhat equal time for each of them. I have flipped my opinion of each of the Basics back and forth several times while doing this review. I have compiled a comparison chart showing some of the major items that are important for each version.

Code Examples of Each Basic

For comparison I have written a Menu/Window demo in each of the Basics reviewed here. The Softworks example appears in the May 1986 MacTutor. A few changes had to be made to some versions to even come close to the MS BASIC (original version).

To implement the demo in Z Basic required placing quotes around labels, add the WINDOW COORDINATE statement (for Macintosh screen coordinates) and replace the Textface,Textfont, Textmode calls with the TEXT statement (for use with Z Basic defined windows and graphics). The system configuration must be set for Locate y,x (ON). It is not necessary to remove old menus as we did in MS BASIC so a few lines may be deleted for that. Be sure that the New York font is on your disk. I tried to implement the demo in Z Basic with all Toolbox calls, but I ran into problems with incompatibilities between the Z Basic commands (for windows, menus) and the Toolbox calls. It is difficult (or impossible) to mix Toolbox and Z Basic windows and menus.

Before I could implement the True Basic version, I had to print out all the Toolbox documentation (about a one inch thick stack of computer paper). During the printing process (using Imagewriter 2.3, System 3.2) I had several system bombs (the only ones I ever had with True Basic). Using the example programs provided, it was very easy to create the demo program with mostly all toolbox commands. Notice that True Basic even has a command to give control of the Mac to your program (TAKEMAC) or return it back to True Basic (GIVEMAC). This is to separate the True Basic implementation with the Toolbox commands. The program worked great with no real pain. By the way, Toolbox commands don't work on a 128k Mac, not enough memory. Too bad it doesn't compile to a stand alone application. All comments in True Basic must use the exclamation point instead of the single quote used in Z Basic and MS BASIC (also supported by PCMacBASIC).

The PCMacBASIC implementation was a custom implementation to match the PC BasicA translation. Documentation wasn't clear about how to set up menus or how to call the toolbox. This was the hardest version to implement. A lot of work needs to be put into the documentation.

If you recall, the Softworks Basic demo in May also showed how to load the fonts and sizes into menus. This was not implemented on this demo, however it should be noted that implementation of the font menu would be most difficult in PCMacBASIC, without the new manual. It would be somewhat awkward to implement in Z Basic, unless you are using Toolbox calls for everything. In True Basic, you have to be committed to using Toolbox commands in order to implement any menus at all.

In conclusion, I hope that my review here will help to bring about improvements in all of the versions of BASIC presented here. As I said before, I can't say any one is better than another one yet. With the right kinds of changes it is possible that any one of them could jump way ahead of the the others in usefulness. More to come next month.

MS Basic Demo

Here is our sample toolbox program to display a window and menu selection. We use this program to see how well each Basic can implement the basic Mac event loop, display a window and allow the user to make choices in a menu. Look over this familar MS Basic version, then compare this with the equivalent code of the other three Basics to see how they differ.

' Menu/Window Demo
' MS BASIC(b) or MS BASIC (d) version
' by Dave Kelly
' ©1986 MacTutor

' No control of Desk accessory menu
' Clear old menus & set up new menus
MENU 1,0,1,"File"
MENU 1,1,1,"Quit"
MENU 3,0,1,"Sample Menu"
MENU 3,1,1,"Item 1"
MENU 3,2,1,"Item 2"
MENU 3,3,1,"Item 3"
MENU 4,0,0,""
MENU 5,0,0,""
ON DIALOG GOSUB HandleAct:DIALOG ON

start:
' open sample window
WINDOW 1,"",(100,100)-(400,225),2
GOSUB Setupwindow

ON MENU GOSUB menuevent
MENU ON

loop:
GOTO loop

HandleAct:MENU STOP:MOUSE STOP
    ACT=DIALOG(0)
    IF ACT=5 THEN GOSUB Setupwindow
    MENU ON: MOUSE ON
RETURN

menuevent:
    menunumber=MENU(0)
    menuitem=MENU(1):MENU
    ON menunumber GOSUB menu1,menu2,menu3
    RETURN

menu1:
    IF menuitem=1 THEN Quit
    RETURN
    
menu2:
'This is the Edit menu
'use it for DA's only
RETURN

menu3:
LOCATE 3,1
PRINT"You have selected menu item";menuitem
RETURN

Setupwindow:
CLS
CALL TEXTFONT(2):CALL TEXTSIZE(12)
CALL TEXTFACE(1)
PRINT "MacTutor shows you how it works!"
CALL TEXTFACE(0)
LOCATE 5,1:PRINT"MS BASIC Version 2.1 demo"
Activity=0
RETURN

Quit:
    MENU RESET
    WINDOW CLOSE 1
    END

Z Basic Demo

Note that this version is very similar in syntax to the MS Basic program. In fact, Z Basic comes the closest to being a full MS Basic compiler, with the added benefit of complete toolbox support. Not only that, but the instruction set is very impressive. There is even AppleTalk support built into the Basic! Only some nagging bugs keep this from being the front runner.

' Menu/Window Demo
' ZBASIC version
' by Dave Kelly
' ©1986 MacTutor
' Zbasic configuration as follows-
'       dbl, sgl, float = 16,14,12;default=I;Locate Y,X

COORDINATE WINDOW:' set to Macintosh window coord

' Clear old menus & set up new menus
MENU 1,0,1,"File"
MENU 1,1,1,"Quit"
MENU 2,0,1,"Edit"
MENU 2,1,1,"/XCut"
MENU 2,2,1,"/CCopy"
MENU 2,3,1,"/VPaste"
MENU 2,4,1,"Clear"
MENU 3,0,1,"Sample Menu"
MENU 3,1,1,"Item 1"
MENU 3,2,1,"Item 2"
MENU 3,3,1,"Item 3"
ON DIALOG GOSUB "HandleAct":DIALOG ON

"start":
' open sample window
WINDOW 1,"",(100,100)-(400,225),2
GOSUB "Setupwindow"

ON MENU GOSUB "menuevent"
MENU ON

"loop":
GOTO "loop"

"HandleAct":MENU STOP:MOUSE STOP
    ACT=DIALOG(0)
    IF ACT=5 THEN GOSUB "Setupwindow"
    MENU ON: MOUSE ON
RETURN

"menuevent":
    menunumber=MENU(0)
    menuitem=MENU(1):MENU
    ON menunumber GOSUB "menu1","menu2","menu3"
    RETURN

"menu1":
    IF menuitem=1 THEN "Quit"
    RETURN
    
"menu2":
' This is the Edit menu
' use it for DA's only
z = FN SYSTEMEDIT(menuitem+1)
RETURN

"menu3":
LOCATE 3,1
PRINT"You have selected menu item";menuitem
RETURN

"Setupwindow":
CLS
TEXT 2,12,1,0:' TEXT[font][,[size],[face],[mode]]
PRINT "MacTutor shows you how it works!"
TEXT 2,12,0,0
LOCATE 5,1:PRINT"ZBASIC Version 3.01 demo"
Activity=0
RETURN

"Quit":
    MENU RESET
    WINDOW CLOSE 1
    END

PCMac Basic Demo

Our other Basic Compiler is shown below. The documentation is poor in comparison to Z Basic, especially in the area of the toolbox. Note that this Basic uses a resource file (not shown) and a built-in resource editor compatible with McAssembly for window and menu definitions. Note the use of line numbers instead of labels. Complete toolbox access and strong assembly compatibility at the source and object level make this product worth watching.

1     REM Menu/Window Demo
      REM PCMacBASIC version
      REM by Dave Kelly
      REM 1986 MacTutor

10 REM If Sample Menu is selected  
      KEY(1) ON : ON KEY(1) GOSUB 3001
      KEY(2) ON : ON KEY(2) GOSUB 3002
      KEY(3) ON : ON KEY(3) GOSUB 3003
20 GOSUB 2000

 REM IF File Menu is selected
      FILES MENU ON  : ON FILES MENU GOSUB 1100 
 REM IF Edit Menu is selected
      EDIT  MENU ON  : ON EDIT  MENU GOSUB 1200 
      ON WINDOW GOSUB 2000

50 REM Infinite Loop
      GOTO 50

1100  menuitem%=FILES(0)
      IF menuitem%=1 THEN 4000 :REM Quit was selected
      RETURN
1200  REM This is the Edit menu
      REM use it for DA's only
       RETURN

2000  CLS
      SCREEN #"New York",12
      COLOR 10,0
      PRINT "MacTutor shows you how it works!"
      COLOR 2,0
       LOCATE 5,1:PRINT"PCMacBASIC Version 1.60 demo"
       RETURN

3001  menuitem%=1:GOTO 3010
3002   menuitem%=2:GOTO 3010
3003  menuitem%=3:GOTO 3010
3010  LOCATE 3,1
      PRINT"You have selected menu item";menuitem%
       RETURN
4000  END

True Basic Demo

This Basic has to be considered the most bug free and ready for sale Basic of the four. And it has a very good manual from an instructional point of view. From a reference point of view, the Z BAsic manual is much better. Note that this Basic is almost pure toolbox. In fact, the following program could be easily translated into Pascal or Assembly because it is practically ALL toolbox programming. At first this might seem a great asset. And it would be if you got a pure object code file after all the detail of toolbox programming. But what you end up with is more work and less show, since it is interpreted. You might as well have started off in a compiled language if you going to have to deal with this kind of toolbox detail! On the plus side, this Basic has tremendous floating point support. It's accurate, fast, and supports matrix inversion and other math functions found only in HP 9836 Basic. If this were a compiler, it would have to rate number one.

! Menu/Window Demo
! True Basic version
! by Dave Kelly
! ©1986 MacTutor
! Trap calls highlited in bold

LIBRARY ":Toolbox Libraries:menulib*"
LIBRARY ":Toolbox Libraries:windowlib*"
LIBRARY ":Toolbox Libraries:desklib*"
LIBRARY ":Toolbox Libraries:eventlib*"
LIBRARY ":Toolbox Libraries:quicklib*"
LIBRARY ":Toolbox Libraries:datalib*"
LIBRARY ":Toolbox Libraries:maclib*"
LIBRARY ":Toolbox Libraries:addr*"
LIBRARY ":Toolbox Libraries:pass_mac*"
LIBRARY ":Toolbox Libraries:s_trap*"
LIBRARY ":Toolbox Libraries:r_trap*"
LIBRARY ":Toolbox Libraries:tostring*"

Continued - BASIC Wars (Part 2)


 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.