Overview of Liberty BASIC
Overview of Liberty BASIC:

Welcome to our Liberty BASIC overview.  In this chapter we will introduce you to:

The Liberty BASIC Editor
 This is the place where BASIC programs are written and compiled.

Writing your own Programs
 Getting started

Using the Debugger
 How to debug your Liberty BASIC programs

Creating a tokenized file
 Making your programs do more for you

Troubleshooting


Liberty BASIC Editor
The Liberty BASIC Editor:

When you start Liberty BASIC, you will see a window like this:

This is where code is written, and this is where you will spend most of your time when writing Liberty BASIC programs.  Notice the various pull-down menus along the top of the window.  These are for  loading and saving files, editing, running/debugging, setting up configuration, and getting help.

Running an example program:

Let's begin our exploration of Liberty BASIC by running one of the sample programs we've provided.  Pull down the File menu and select the Open item as shown.

You will see a dialog box similar to the one displayed below.  Inside the box titled Files: there is a list of files that you can load.  These are text files containing our example BASIC programs.  Select the item named draw1.bas and click on OK.

Liberty BASIC will load the draw1.bas program you selected.  The result will look like this window.  This is BASIC code for a Windows drawing program.  As you learn to program in Liberty BASIC you will be able to extend this program and the other included samples to do what you want.  But right now let's see how it runs!

Running a Liberty BASIC program is easy.  Select the Run menu and mouse click on the Run item, as illustrated below.

Now Liberty BASIC will take a few seconds to compile and run our drawing program (some computers will take longer than others).  When it is finished compiling, a window belonging to our drawing program will appear:

Let's try drawing a little something with Liberty Draw!

Feel free to play with Liberty Draw, and when you're done close its window.


Troubleshooting

Low memory situtations

Liberty BASIC is a large program, and is a tight fit on 4MB machines (especially using FreeForm).  If you find that you are getting low memory errors, try the following:
- Close other running Windows and DOS applications.
- Reduce the size of your Smartdrive disk cache or eliminate it.
- Increase the size of your Windows swapfile.

General Protection Faults

Most general protection faults under Liberty BASIC are caused by:
- Video drivers.  A major problem with environments like Windows and OS/2, video drivers are often immature and/or incompletely implemented according to spec.  Try to get the most recent version of the Windows drivers for your video card.  If it isn't a showstopper for you, try the standard 16 color drivers that come with Windows.
- Low memory (see above).  If you are getting a general protection fault in VSTUB.EXE, you need either a bigger swapfile, more physical RAM, or both.

Improperly Redrawn Bitmaps

If you write software in Liberty BASIC that draws bitmaps in graphics windows, and you have trouble with improperly redrawn bitmaps (they draw correctly at first, but if the window is covered, and then uncovered, the bitmaps are not redrawn correctly), the video driver is often the trouble.  The author's experience with this problem is that on the same machine, with the same video card, that different results occur just by picking from several different drivers.  Using the standard 16 color VGA driver that comes with Windows, things seem to work correctly.  Some other video drivers work fine, some cause problems.  Always try to get the most up to date drivers for your video card under Windows.

Note: 256 color drivers can give strange results sometimes because Liberty BASIC needs some tweaking in its handling of the Windows pallette.