Getting TrueBasic to work on OS X without Windows
Montgomery County Public Schools have standardized middle school computer
science instruction on using True Basic,
which most unfortunately does not have a native Mac OS X version. The last
Mac version ever released was for the Classic Mac OS, which would
no longer work on operating systems OS X 10.5 and newer (fall 2007).
Apple made the switch to Intel processors in 2006. This means that instead
of extremely slow emulation of Windows (e.g., Virtual PC), one has
other, much better options for running Windows applications. One option
is to run full-blown Windows, either shutting down OS X and booting into
Windows via
Boot Camp
or else using a virtual machine environment (e.g.,
Parallels or
VMWare
Fusion, both of which are very good products).
However, you may wish to run just one or two Windows applications and not
need or wish to have the overhead (and attendant security implications) of
running a full Windows operating system. Fortunately, an open source
project called Wine provides an
environment where one can indeed simply run individual Windows
applications.
Thus, using Wine, one can run TrueBasic under OS X on an Intel Mac.
And some packages of wine (such as the one detailed below) will give you a
nice double-clickable application to run from the Finder.
- An Intel Mac
If you are not sure, look at "About this Mac" under the Apple
Menu. If it says "Intel" in the Processor line, you're fine. (If it says
"PowerPC", then I regret that these directions won't work for you.)
- A TrueBasic installation.
You will want my "TrueBasic_items_for_Wine.zip" file, which
is directly based on the True Basic Bronze "setup.exe"
installer. Both are available for download
from
http://mrstreet.tpmsmagnet.com/.
For this Mac installation,
it is easier to use the zip file, and you do not need the
setup.exe at all.
Indeed, unless you have a real Windows
computer handy, you do not want to use this setup.exe
(as explained in the gray box, below).
- A version of Wine.
I used
Wineskin Winery.
This setup was tested with Wineskin Winery 1.1 on Intel Macs running Snow Leopard 10.6.6 and 10.6.7 on a
Core Duo MacBook Pro laptop, a Core 2 Duo iMac, and a Core i7 "Sandy
Bridge" MacBook Pro laptop.
- Download the
Wineskin Winery Latest Update
- Double-click the resulting "Wineskin Winery.app.zip" file to
expand it (if your browser did not already do this for you), which should
leave you with a red icon labelled Wineskin Winery.
- Double-click on Wineskin Winery to start it.
- In the Wineskin Winery window:
- Click the "+" to the left of "New Engine(s) available".
- An "Add Engine" window will appear. Take the default (newest
version) from the pop-up menu and click "Download and Install".
When that finishes, you should be back at the main Wineskin Winery
window.
- A small "File Downloader" window will appear, confirming
what you are about to install.
Click "OK" and watch the progress
bar show the download.
- Install the "wrapper" Wineskin:
- At the bottom right of the main Wineskin Winery window, click
the "Update" button below the "Wrapper version" section.
- A small "File Downloader" window will appear, confirming
what you are about to install.
Click "OK" and watch the progress
bar show the download.
The "Engine" and "Wrapper" are both stored in ~/Library/Application
Support/Wineskin in your home folder.
Leave the Wineskin Winery window open.
Now let's create a "wrapper" for our TrueBasic application in Wineskin.
- Click on "Create New Blank Wrapper". You should give it a name, such
as "TrueBasic Bronze for Mac" or anything else that is meaningful to
you (replacing the default "MyCoolWrapper").
This will be created in ~/Applications/Wineskin (where "~"
indicates your home folder).
You will get three small windows with questions:
- For "Do you want the application "WineskinX11" to accept incoming network
connections?" it is safe to click "Deny". (This has to do with the OS X
network firewall, but there is no reason TrueBasic needs to talk to the
outside world.)
- For the "Wine Gecko Installer" window, it is safe to click "Cancel"
because we don't need any web/HTML rendering in TrueBasic.
- You should get a window which reads "Wrapper Creation Finished". Click
"View wrapper in Finder" (which makes it easier to get to, below).
These are my 'recommended' answers to these questions, but you won't harm
anything if you give the other answer.
You may now click "Quit" to exit Wineskin Winery.
Important background note about TrueBasic installer
The normal way that Wine (and thus Wineskin) expects you to set up an
application is by running an installer, and indeed a setup.exe
file for TrueBasic Bronze is made available on the TPMS web site.
The problem is that this setup.exe is a 16-bit executable
that will lock up the Mac hard, such that the entire
computer freezes (no mouse response, on-screen clock stops, force-quit
won't work) and one has to do a hard shutdown (holding down the power
key) to turn the computer off. Not good! This was true for
at least 3 or 4 different versions and packaging of Wine that I tried.
However, I had a hunch that the actual TrueBasic application was a 32-bit
executable which would run fine in Wine (especially since I had read of
reports that it did indeed work).
So I ran the setup.exe on a real Windows computer, and made
a copy of the "TB Bronze" folder which was created inside the Windows "Program
Files" folder. Later I discovered that TrueBasic had installed two
required dynamically loaded libraries (DLL files) on the Windows computer in
C:\Windows\System which needed to be copied to the Mac.
I have combined all three of these elements into a zip file called
"TrueBasic_items_for_Wine.zip" (827KB) which you can download from
http://mrstreet.tpmsmagnet.com/.
Fortunately, Wine/Wineskin does permit you to simply copy an executable
into place inside a wrapper you have created (so one does not have to run
the installer).
Expanded view of zip file
You thus need three items for a successful install:
- C:\Program Files\TB Bronze (a folder, 1.8MB)
- C:\Windows\System\XNMBA420.DLL [300KB]
- C:\Windows\System\XNMTE420.DLL [60KB]
The easiest way to get these files is to download
"TrueBasic_items_for_Wine.zip" (827KB) from
http://mrstreet.tpmsmagnet.com/.
After downloading, double-click on the zip file to expand it (if your
web browser has not done this for you already). The expanded version
will be in a folder of the same name (with spaces not underscores).
You should now have a folder that looks like the window at right.
We need to copy these files into place, but since the wrapper you created up
above is a Mac double-clickable application, the contents are hidden. Here's the
procedure:
- Open a new window in the Finder (Finder => File menu =>
New Finder Window, or just command-N)
- Navigate to the new wrapper you set up:
In your home folder, double-click on Applications (not the global Applications
folder in the sidebar), and then double-click the Wineskin folder. Your new wrapper
should be there. Single-click on it to select it.
- Do a control-click (or right-click) on the icon of your new wrapper and
select "Show Package Contents".
- Double-click on "drive_c".
- Now open a second new window in the Finder and navigate to the folder
"TrueBasic items for Wine". Move this window so that you can
see both Finder windows clearly.
- Copy "TB Bronze" to "Program Files" in the
"drive_c" window.
- In the "drive_c" window, double-click on the
"windows" folder and then
double-click on the "system" folder found there.
- Copy the two extra libraries ("XNMBA420.DLL" and
"XNMTE420.DLL") to the "system" window you located
in the previous step.
Now, at last, you are ready to double-click on the wrapper icon for the first
time.
- When you do so, you will see a small window with four options (Install
Windows Software, Set Screen Options, Advanced, and Quit).
- Click Advanced.
- In the Configuration tab, click the Browse button to the right of
"Windows EXE".
- A "standard file dialog box" for OS X should appear showing you
"drive_c". Navigate to
Program Files/TB Bronze/tbbronze.exe and click
"Choose".
- Change the Menubar Name field to something meaningful, e.g., "TrueBasic
Bronze"
- [Optional] Click the "+" under Associated Extensions and type "tru" (the
standard TrueBasic file extension) in the box. Click "Save".
- Click "Done".
- Click "Quit".
If you make a mistake or miss something after you have quit out of the above
window, you can get it back easily enough:
- Find your "wrapper" in the Finder. (Look in ~/Applications/Wineskin folder)
- Control-click on its icon and select "Show Package Contents" from
the contextual menu.
- You should see three items here: Contents,
drive_c, and Wineskin.
- Double-click on the red Wineskin icon and you should see
the same four-option small window as described above.
- Fix what you need to fix and then click "Quit".
Finally, you are ready to use your new wrapper!
- Double-click on your wrapper (it is located for now in
~/Applications/Wineskin but you are welcome to move it).
- Two windows should appear: An "Open File" dialog box at the top and a
"Command window" across the bottom of your screen.
- To see a demo file in action, double click on "[TB Demos]" and then
select one of the sample files (barchart.tru will fill your screen nicely
with large graphs). Click Open (or double-click).
- A window with the source code will appear (e.g., barchart.tru).
- Select "Run" from the "Run" menu to execute the program.
To run your own programs from the "Open File" dialog box, go to the "Drives"
pop-up menu in the lower right of the window and select "z:". This is your Mac
hard drive. From there, navigate to the desired file.
You can write your programs in the editor that TrueBasic provides or you can use
a Mac text editor (not a word processor or even Apple's
Textedit) such as the excellent and free
TextWrangler.
Just make sure that the line endings are set to Windows (Find the popup-menu at the
bottom of the TextWrangler window labeled "UNIX (LF)" and change it to "Windows
CRLF").
You can use TextWrangler (or any other editor) to write the programs in the first
place, but it appears you will have to use the built-in editor in TrueBasic to
debug because changes in the file in TextWrangler are not known to an
already-loaded file in TrueBasic.
Hopefully MCPS will switch to a programming language that is more
platform-independent than TrueBasic, but in the mean time, I hope this is helpful
to the Mac users!
David Friedlander
dpfriedlander (at) comcast.net
parent of a TPMS 6th grader
UNIX & Macintosh System Administrator
Astrophysics Science Division
NASA/Goddard Space Flight Center
Greenbelt, MD
7 April 2011