TweetFollow Us on Twitter

Wars and Windows
Volume Number:4
Issue Number:10
Column Tag:Basic School

Basic Wars and True Windows

By Dave Kelly, Editorial Board

Basic Wars Revisited

I promised more information about True Basic. First I would like you to refer back to MacTutor August 1986, February 1987 and March 1987 for the previous episodes of “Basic Wars”. The following table gives True Basic (Version 2.0) data for most of the benchmarks used to compare ZBasic and MS Basic 2.0 the last time I ran the benchmark. Please be aware that the math operations were corrected in the March 1987 issue. From a comparison of the benchmarks we can draw a few conclusions. First, True Basic appears to be faster for all math operations even though True Basic is not truly compiled. Only Microsoft Basic (binary) is comparable in math speed, but does not include the accuracy of True Basic. Graphic operations are slower than the MS Basic interpreter. Array look up was comparable to compiled speeds for MS Basic or ZBasic. String handling approaches ZBasic compiled speeds. True Basic ran the Sieve in less time than the MS Interpreter, but slower than any of the compiled Basics.

Still keep in mind that benchmarks are not the only way to determine the strengths of a language. These results show that True Basic performs very well considering that it is not truly compiled to native machine code. It would be much more of a speed competitor if it was compiled. True Basic’s strengths are in other areas which cannot be measured only by benchmarks. To some people the other capabilities of True Basic are not enough to justify the slow speed. If the only thing you are looking for in a language is speed then you’ll probably be disappointed.

True Basic Benchmark: System 6.0

BENCHMARK Macintosh Plus Macintosh II

FOR Loop 1.6 sec. .388 sec.

Array Lookup 20.67 sec 5.25 sec.

Math Operations

Addition 22.15 sec. 3.8 sec.

Subtraction 23.23 sec. 3.55 sec.

Multiply 25.55 sec. 3.8 sec.

Divide 39.15 sec. 3.78 sec.

String Operations

Concatenation 10.3167 sec. 2.35 sec.

Matching 12.15 sec. 3.12 sec.


Line(Basic statement)

61.25 sec. 15.33 sec.

Horizontal line 38.867 sec. 12.3 sec.

Circle 13.4667 sec. 6.63 sec.

Set Pixel (PLOT) 119.3 sec. 37.83 sec.

File I/O (Floppy disk)

Random READ 24.5 sec. 8.2 sec.

Random WRITE 43.48 sec. 13.7667 sec.

Sequential PRINT #17.0667 sec. 4.3 sec.

Sequential INPUT 17.45 sec. 4.533 sec.

Sieve (1980 primes) 118.917 sec. 29.0333 sec

Accuracy Benchmark

Answer: 503.543802149746 503.5438021499906

1.224999999999966 1.2299999999999960

.88333 sec. .166667 sec.

Some of True Basic’s strength comes from the structured nature of the ANSI committee standard which it closely follows. Rather than go through a blow by blow account of what each command in True Basic does (you can always read the manual to find out that), I’ll tell you what’s new since version 1.0 was released. Mostly True Basic is the same very structured, capable language as before. From a scientific, engineering and educational standpoint True Basic offers the best learning environment. It has all the advanced structures of the latest Basics available such as SELECT CASE, DO/LOOP with WHILE and UNTIL, and multi-line IF/ELSE IF/END IF. True Basic is modular in that you can define your own modules which can be loaded as required. Local and global variables are supported. As discussed last month, True Basic has a full set of matrix algebra statements. Arrays are dynamic and resizable. Line numbers are now optional. Recursion is supported. Optional variables may be declared in CALLs.

The built-in editor works very well (unlike the ZBasic editor). It is not the best editor in the world, but is adequate. You have search and replace (Find and Change) and Include (which inserts a file from disk at the cursor point). The annoying little stop light (version 1.0) has been removed. You may select breakpoints in your program where you want to suspend execution to examine variables or do debugging. There are three windows that are used in the interpreter environment. The source window contains the source code, the output window lets you save output from several runs of the program if you want, and the command window lets you type commands specific to managing the interpreter (Actually, True Basic is compiled to b-code for extra speed, but since it is not true native machine code I hesitate to call it a compiler). You can use almost any True Basic statement in direct mode, that is, directly typed into the command window. A simple help system is available, but I feel that unless you are a beginner, the help system is next to useless.

Script files and DO programs can be set up to configure True Basic or to automate actions. It’s sort of like having a a set of exec files that can be executed as short cuts. Since there may be several folders containing library files used, you will want to configure your disk with a TBStartup file containing an ALIAS statement which references all of the places you want True Basic to look for library files. This is a very awkward way to do things, but once it gets set up you just declare your library and True Basic takes care of things for you. (Sort of reminds me of what I don’t like about MSDOS). DO programs are used for things such as formatting the source code, getting a cross reference list of variables, or tracing a programs variables. Since you can always write your own DO program you can set it up however you wish.

True Basic supports the 68881 coprocessor which speeds up calculations quite a bit. We’ve already seen samples of True Basic color capabilities in previous issues of MacTutor.

Macintosh Goodies

Macintosh people want their applications to look right and feel right for the Macintosh user. True Basic provides a library “MacTools*” which contains most of the simple graphics calls:

call MacPenSize (width, height)
call MacPenMode (mode)
call MacTextFont (font)
call MacTextFace (style$)
call MacTextMode (mode)
call MacTextSize (size)
call MacTextBox (left, right, bottom, top, s$, just$)
call MacSpaceExtra (extra)
let n = MacStringWidth (s$)
call MacGetFontInfo (ascent, descent,widmax, leading)
call MacInvertRect (left,right,bottom,top)
call MacPaintOval (left,right,bottom,top)
call MacInvertOval (left,right,bottom,top)
call MacFrameRoundRect (left,right,bottom,top,x,y)
call MacPaintRoundRect (left,right,bottom,top,x,y)
call MacInvertRoundRect (left,right,bottom,top,x,y)
let name$=MacGetFile$(h,v,type$,button$)
let name$=MacPutFile$(h,v,pr$,iname$,button$)
call MacSysBeep (duration)
call copy_clipboard
call copy_done
call copy_pictfile (filename$)  supports PICT2 format
call copy_printer(1)
call draw_clipboard(1)
call Read_clipboard(type$,s$)
call Write_clipboard(type$,s$)
call Read_pictfile(filename$,s$)
call Write_pictfile(filename$,s$)
call Draw_string(s$,fit)

These are basically the same sort of commands available to MS Basic users as built in statements. Other statements for printer control are also included in “MacTools*” library. True Basic file handling is done using the file names with colons separating the volume names. If the more preferred method of using volume numbers is desired then you should plan on using Mac ROM calls.

The Macintosh Developer’s ToolKit supplies the rest of the Macintosh interface. The libraries included in the ToolKit include:

TrueWindows* True Windows

ExecLib* Semi-portable system routines

HexLib* Integer arithmetic aids

System* Low-level interface to System

MacLib* Trap interfaces for other libraries

DataLib* Data conversion for ToolKit routines

ColorLib* Color manager

PickerLib* Color picker package

ControlLib* Control manager

DeskLib* Desk accessory manager

DialogLib* Dialog manager

DiskLib* Disk driver

DiskInitLib* Disk initialization package

EventLib* Toolbox/System event managers

FileLib* File manager

FontLib* Font manager

ListLib* List manager

MenuLib* Menu manager

PackageLib* Package manager

PaletteLib* Palette manager

QuickLib* Quickdraw

ResourceLib* Resource manager

ScrapLib* Scrap manager

SFPlib* Standard file package

SoundLib* Sound manager

SystemLib* System utilities

TextEditLib* Text edit

ToolboxLib* Toolbox utilities

WindowLib* Window manager

As in version 1.0, some calls cannot be mixed with some True Basic commands (especially graphics) very easily. However, this is really not to bad considering the problems we’ve run into with ZBasic and keeping Macintosh events separate from ZBasic events. Also, the Developer’s ToolKit now provides some easy menu and window statements for simple applications. They call this set of routines, TrueWindows.


At first it doesn’t seem to make a lot of sense to even have the TRUE WINDOWS library available, but in a pinch when you need a quick and dirty application (what Basic is used for the most often), it is good to not have to set up the GetNextEvent Loop. True Windows gives you access to menu, dialog and alert, event handling and window routines. An example using True Windows is included with this column.

True Windows menu statements are set up with DATA statements. The MAT statement makes it easy to read in the entire menu in one statement. The array containing the menu is dimensioned as DIM menu$(0:menus, 0:items) where menus is the number of menus and items is the max number of menu items in any one menu. This set up is fairly simple and easy to use.

A set of 5-6 types of dialog/alert boxes are available. You can also set a timeout for the dialog box so that if there is no user response the program will continue. Using that function is not recommended by the Macintosh user interface guidelines because it allows something to happen which the user has no control over and does not expect to happen.

A True Windows event handler returns menu,refresh, window selection, close box events, window move events, window resize events, up, down, left, right, pageup, pagedown, pageleft, pageright, vscroll, hscroll, single click, double click, triple click and mouse down events as only as often as you ask for them. True Windows or True Basic does not go out and do a GetNextEvent just for the fun of it which in turn messes up your own event handling.

While it is true that True Windows does not do everything, it is a way to get Macintosh looking interfaces without a lot of extra work. If it doesn’t handle the job then the rest of the Developer’s Toolkit is sufficient to handle any other jobs that might come up that require the Mac ROM routines. And if Apple comes out with a new call some day it is very simple to go in and add the call yourself just by examining the source code for the Toolkit libraries. The copy of Developer’s Toolkit that I have is a prerelease copy, but it appears to be complete in every way.

The hardest thing about using any library is to know the routines that need to be declared in the DECLARE DEF statement so that they can be used in your program. All external functions must be declared. However, the LOAD statement could be used to make the library become a part of the Basic language and thus the DECLARE statement would not be necessary.

Ok, so we know that True Basic can do all this stuff, should I use it for my development project? The answer to this has to be answered yourself, but you should ask your self the following questions:

1. Does my program need to run fast? True Basic speed is satisfactory for many needs, but there are some things that must run faster.

2. Do I care if my application program is greater than 73K? The runtime package uses 73K of disk space. About 35 K of that is in the resource fork of the file and may be shared by more than one application by cutting the resources from the application and pasting into the system file. This is not the preferred method, but could be done if necessary.

3. Do I have a lot of math operations to perform? True Basic is extremely strong in its math support. This is especially true on the Mac II which also includes 68881 math coprocessor support.

4. Do I want full access to the entire Macintosh ROM routines? The Developer’s Toolkit does a great job of supporting all of the ROM routines in a way that can be understood. It is easy to add new ROM calls as they are added in the future. You won’t have to wait for True Basic’s next upgrade to have support of the new features. It would be nice if the ROM support was built into True Basic, but by loading the Library into memory it can become a part of True Basic. Besides, even Lightspeed Pascal requires that Libraries be declared (in the project window) in order to use them.

In my opinion, True Basic has come a long ways by including the runtime package with the Basic system. I would like to see the Developer’s Toolkit bundled with the language system, though the price would certainly be near the same price anyway. Currently, the True Basic language system, including Runtime is $99.95. True Basic libraries are $69.95. This makes the combined package cost $169.90. There are only two areas that I wish could be improved upon with True Basic. One would be to have a true compiler that produces real machine code instead of the b-code stuff. I realize that the b-code is designed to be able to transfer applications in True Basic to other computers. As a matter of fact, True Windows routines are supposed to be transferable to other computers such as the Amiga (gasp) which use a window approach. The other area that could improve is in the code size of the runtime package. Some of the size problem could be eliminated if a ‘true’ compiler were available, that is if it compiled the code efficiently.

!Color Picker Demo
!Demonstrates True Basic’s True Windows and
!illustrates use of the Color Picker routine
!©1988 MacTutor
!By Dave Kelly

LIBRARY “TrueWindows*”,”QuickLib*”,”PickerLib*”
LIBRARY “datalib*”, “maclib*”, “system*”

DECLARE DEF H,V,GetColor$,UnpackEnvirons$,RGB$
DIM menu$(0:1,0:2)
LET false=0
LET true=1
LET Done=false
CALL tw_init(“COLOR”)
! Color isn’t supported yet, but I’m ready for it!
! Find out what kind of computer this is
CALL SysEnvirons(sysEnvRec$,status)
CALL UnpackEnvirons(sysEnvRec$,envversion,machine,sysversion, processor, 
hasFPU,hasColorQD,keyboardtype,atversion, sysvrefnum)
IF hasColorQD<>1 then
   ! we gotta quit, this isn’t a Mac II
   LET done=true
   CALL tw_dwarn(3,”Color Quickdraw is not available!
   Sorry, but you can’t run this     !”,”OK”,1,result)
IF done<> true then
   MAT READ menu$
   DATA “”,About MacTutor Picker Demo...,””
   DATA File,Get Picker...,Quit
   CALL tw_menu_set(menu$)        ! Set up the menu

      CALL tw_event(maxnum,type$,window,menunumber,menuitem)
      SELECT CASE type$
      CASE “MENU”
           SELECT CASE menunumber
           CASE 0
                CALL About
           CASE 1
                CALL file(menuitem,done,inrgb$)
           CASE ELSE
           END SELECT
   LOOP Until Done=true
   CALL tw_menu_clear
! Get rid of the menus
CALL tw_cleanup
! clean up all the TrueWindows stuff

SUB about
    ! Set up the About dialog box.
    CALL tw_dwarn(0,”MacTutor Picker Demo|©1988 MacTutor|By Dave Kelly”,”OK”,1,Result)

SUB file(menuitem,done,inrgb$)
    SELECT CASE menuitem
    CASE 1
         ! Set up the upper corner of picker dialog
         CALL SetPt(Point$,0,0)
         ! do picker dialog
         CALL GetColor(point$,”Pick a color, just for fun!”,inrgb$,outrgb$,okflag)
         ! select the color
         IF okflag=1 then LET inrgb$=outrgb$
         CALL unpackRGB(inrgb$,r,g,b)
         LET string$=”Color selected was:|r=”&str$(r)&”|g=”&str$(g)&”|b=”&str$(b)
         ! Display the color in rgb coordinates
         CALL tw_dwarn(1,string$,”OK”,1,result)
    CASE 2
         LET done=1

Community Search:
MacTech Search:

Software Updates via MacUpdate

Adobe InCopy CC 2018 - Create...
InCopy CC 2018 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous InCopy customer). Adobe InCopy CC 2018, ideal for large team projects... Read more
MacFamilyTree 8.2.5 - Create and explore...
MacFamilyTree gives genealogy a facelift: modern, interactive, convenient and fast. Explore your family tree and your family history in a way generations of chroniclers before you would have loved.... Read more
Hopper Disassembler 4.3.2- - Binary disa...
Hopper Disassembler is a binary disassembler, decompiler, and debugger for 32- and 64-bit executables. It will let you disassemble any binary you want, and provide you all the information about its... Read more
MacFamilyTree 8.2.5 - Create and explore...
MacFamilyTree gives genealogy a facelift: modern, interactive, convenient and fast. Explore your family tree and your family history in a way generations of chroniclers before you would have loved.... Read more
Hopper Disassembler 4.3.2- - Binary disa...
Hopper Disassembler is a binary disassembler, decompiler, and debugger for 32- and 64-bit executables. It will let you disassemble any binary you want, and provide you all the information about its... Read more
GraphicConverter 10.5.1 - $39.95
GraphicConverter is an all-purpose image-editing program that can import 200 different graphic-based formats, edit the image, and export it to any of 80 available file formats. The high-end editing... Read more
Delicious Library 3.7 - Import, browse a...
Delicious Library allows you to import, browse, and share all your books, movies, music, and video games with Delicious Library. Run your very own library from your home or office using our... Read more
Adobe Animate CC 2017 - Anima...
Animate CC 2018 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous Flash Professional customer). Animate CC 2018 (was Flash CC) lets you... Read more
Adobe After Effects CC 2018 15.0 - Creat...
After Effects CC 2018 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous After Effects customer). The new, more connected After Effects CC... Read more
Adobe Premiere Pro CC 2018 12.0.0 - Digi...
Premiere Pro CC 2018 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous Premiere Pro customer). Adobe Premiere Pro CC 2018 lets you edit... Read more

Darts of Fury guide - how to rise in the...
Darts of Fury is a new, immensely absorbing darts game from indie studio Yakuto. It's darts in its purest form, but collectible darts and other upgrades give this game an addictive edge that's hard to shake. As your progress out of the beginner... | Read more »
ICEY (Games)
ICEY 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: ICEY is a 2D side-scrolling action game. As you follow the narrator's omnipresent voice, you will see through ICEY's eyes and learn the... | Read more »
The best new games we played this week -...
We've made it, folks. Another weekend is upon us. It's time to sit back and relax with the best new releases of the week. Puzzles, strategy RPGs, and arcade games abound this week. There's a lot of quality stuff to unpack this week, so let's hop... | Read more »
Wheels of Aurelia (Games)
Wheels of Aurelia 1.0.1 Device: iOS Universal Category: Games Price: $3.99, Version: 1.0.1 (iTunes) Description: | Read more »
Halcyon 6: Starbase Commander guide - ti...
Halcyon 6 is a well-loved indie RPG with stellar tactical combat and some pretty good writing, too. It's now landed on the App Store, so mobile fans, if you're itching for a good intergalactic adventure, here's your game. Being a strategy RPG, the... | Read more »
Game of Thrones: Conquest guide - how to...
Fans of base building games might be excited to know that yet another entry in the genre has materialized - Game of Thrones: Conquest. Yes, you can now join the many kingdoms of the famed book series, or create your own, as you try to conquer... | Read more »
Halcyon 6: Starbase Commander (Games)
Halcyon 6: Starbase Commander Device: iOS Universal Category: Games Price: $6.99, Version: (iTunes) Description: An epic space strategy RPG with base building, deep tactical combat, crew management, alien diplomacy,... | Read more »
Legacy of Discord celebrates its 1 year...
It’s been a thrilling first year for fans of Legacy of Discord, the stunning PvP dungeon-crawling ARPG from YOOZOO Games, and now it’s time to celebrate the game’s first anniversary. The developers are amping up the festivities with some exciting... | Read more »
3 reasons to play Thunder Armada - the n...
The bygone days of the Battleship board game might have past, but naval combat simulators still find an audience on mobile. Thunder Armada is Chinese developer Chyogames latest entry into the genre, drawing inspiration from the explosive exchanges... | Read more »
Experience a full 3D fantasy MMORPG, as...
Those hoping to sink their teeth into a meaty hack and slash RPG that encourages you to fight with others might want to check out EZFun’s new Eternity Guardians. Available to download for iOS and Android, Eternity Guardians is an MMORPG that lets... | Read more »

Price Scanner via

27″ 3.4GHz iMac on sale for $1699, save $100
Amazon has the 27″ 3.4GHz iMac (MNE92LL/A) on sale today for $1699 including free shipping. Their price is $100 off MSRP, and it’s the lowest price available for this model (except for Apple’s $1529... Read more
Clearance 2016 15″ MacBook Pros available for...
B&H Photo has leftover 2016 15″ MacBook Pros available for up to $700 off original MSRP. Shipping is free, and B&H charges NY & NJ sales tax only: – 15″ 2.7GHz Touch Bar MacBook Pro Space... Read more
Save $100 on 13″ MacBook Airs, prices start a...
Adorama has 2017 13″ MacBook Airs on sale today for $100 off MSRP including free shipping. Adorama charges NY & NJ sales tax only: – 13″ 1.8GHz/128GB MacBook Air (MQD32LL/A): $899, $100 off MSRP... Read more
1.4GHz Mac mini available for $399, $100 off...
TigerDirect has the 1.4GHz Mac mini on sale today for $399 including free shipping. Their price is $100 off MSRP, and it’s the lowest price available for this model. Although currently out of stock,... Read more
21″ 2.3GHz iMac on sale for $999, save $100
MacMall has the 21″ 2.3GHz iMac (MMQA2LL/A) on sale today for $999 including free shipping. Their price is $100 off MSRP, and it’s the lowest price available for this model. Read more
12″ iPad Pros on sale for $50 off MSRP, no ta...
Adorama has 12″ iPad Pros on sale today for $50 off MSRP. Shipping is free, and Adorama charges sales tax in NY & NJ only: – 12″ 64GB iPad Pro: $749, save $50 – 12″ 256GB iPad Pro: $899, save $50... Read more
9″ iPads on sale for $30 off, starting at $29...
MacMall has 9″ iPads on sale for $30 off including free shipping: – 9″ 32GB iPad: $299 – 9″ 128GB iPad: $399 Read more
Apple restocks full line of refurbished 13″ M...
Apple has restocked a full line of Apple Certified Refurbished 2017 13″ MacBook Pros for $200-$300 off MSRP. A standard Apple one-year warranty is included with each MacBook, and shipping is free.... Read more
13″ 3.1GHz/256GB MacBook Pro on sale for $167...
Amazon has the 2017 13″ 3.1GHz/256GB Space Gray MacBook Pro on sale today for $121 off MSRP including free shipping: – 13″ 3.1GHz/256GB Space Gray MacBook Pro (MPXV2LL/A): $1678 $121 off MSRP Keep an... Read more
13″ MacBook Pros on sale for up to $120 off M...
B&H Photo has 2017 13″ MacBook Pros in stock today and on sale for up to $120 off MSRP, each including free shipping plus NY & NJ sales tax only: – 13-inch 2.3GHz/128GB Space Gray MacBook... Read more

Jobs Board

Project Engineer, *Apple* Education Profess...
Project Engineer, Apple Education Professional Services Job Number: 113143353New York City, New York, United StatesPosted: Oct. 17, 2017Weekly Hours: 40.00 Job Read more
Commerce Software Engineer, *Apple* Media P...
Commerce Software Engineer, Apple Media Products Job Number: 113092072New York City, New York, United StatesPosted: Oct. 19, 2017Weekly Hours: 40.00 Job Summary With Read more
Engineering Manager, *Apple* Retail Enginee...
# Engineering Manager, Apple Retail Engineering Job Number: 58139948 Santa Clara Valley, California, United States Posted: 20-Oct-2017 Weekly Hours: 40.00 **Job Read more
*Apple* Retail - Multiple Positions - Apple,...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Commerce Engineer, *Apple* Media Products -...
Commerce Engineer, Apple Media Products (New York City) Job Number: 113028813New York City, New York, United StatesPosted: Sep. 20, 2017Weekly Hours: 40.00 Job Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.