This month Peter Phillips gets to grips with HiSoft Power
BASIC in the first of his tutorial series on BASIC.
FirST STeps in BASIC
Before you begin to program any computer, it is important to
grasp one fact. THE COMPUTER DOES NOT THINK. No matter how
intelligent your ST may seem at times, it is not an intelligent
system in the same way humans are intelligent. It cannot reach
logical conclusions about anything without being given a precise
series of instructions. The ST may give the impression of thinking
on it's own, but all its really doing is following a series of
instruction - a program.
In order for a computer to be able to do anything, no matter
how simple it may appear to us, the task must be broken down into
a series of precise steps for the computer to follow. Try making a
list of all the steps you would expect to follow when you go to
make a cup of tea. You list should look something like this:
1. Fill Kettle
2. Boil Kettle
3. Put Teabag In Pot
4. Pour On Boiling Water
5. Pour Milk Into Cup
6. Pour The Tea
These six steps are simple enough for a child of a bout six
to follow and make a cup of tea. These instructions only appear
simple to us because we have learned some basic knowledge of the
world around us a s we've been growing up. A computer has no
knowledge at all, so every single step in the tea making process
must be set out, like this:
1. Grasp Kettle By Handle
2. Take Kettle To Sink
3. Grasp And Remove Lid
4. Place Kettle Under Cold Tap
5. Turn On Cold Tap
6. Wait Until Kettle Is Full
7. Turn Off Cold Tap
8. Replace Lid
... and so it would go on, each step carefully laid out. Even
these steps above can be broken down still further in terms of
precise distances and angles of movement, amount of pressure and
volume of water.
Before you Start...
Assuming you haven't already done so, make a copy of which
ever BASIC you intend to use to follow this series. If you're
using the version of PowerBASIC included on the CoverDisk then
copy all the files to a blank disk and de-archive them. This will
give you room to store some of the tutorial files on the same
If you're using another BASIC such as GFA then set up a new
work disk to hold the files from the tutorial series. This will
help to keep them separate from any other work or example files
you may have.
Reboot your ST and load up your chosen BASIC. It doesn't
matter which sort of BASIC you're using since the examples in this
Tutorial have been designed to work with most of the common
programs. However, they are intended to work with the HiSoft BASIC
* FirST BASIC - bundled with may of the newer ST packs such
as the Turbo Pack and the Discovery Pack.
* PowerBASIC - a demo version of this program is included on
the CoverDisk with this issue of ST User.
* HiSoft Basic - the full version of HiSoft's implementation
of the BASIC language.
* ST BASIC - all HiSoft BASIC's are downwardly compatible
with the original ST BASIC supplied on the Language disks
of older machines.
In all the following examples, all the text in bold are BASIC
statements and should be typed exactly as they appear. Remember to
press 'Return' at the end of each line so BASIC will act on the
instruction. If you make a mistake, don't worry about it, just try
In Directmode, type the following, and see what the ST does
PRINT "Hello World!"
What you have just done is to issue a direct command to the
computer. The PRINT statement is a BASIC 'keyword' or a word that
instructs BASIC to perform a particular action. PRINT tells the
machine to print what every follows to the screen. Now try:
PRINT "The ST"
PRINT "is the best computer available"
You'll see that the sentence has been split over two lines,
in exactly the same way as it was typed with the keywords. This
happens because when BASIC reaches the closing quote as any PRINT
statement, it automatically goes to the start of the next line. If
you want it to continue on the same line, you have to add a semi-
colon (;) after the end quotes, like this:
PRINT "The ST ";
PRINT "is the best computer available"
Note that an extra space has been added at the end of the
first line. This is because BASIC will print exactly what it finds
so if the space wasn't there, BASIC wouldn't put a space between
the words 'ST' and 'is'. Try the line again but without the extra
space, just to see what happens.
Marko, Suomen Atari-sivut / ArkiSTo 2003