starting out
NEW OWNERS' COLUMN
Get started programming your Atari
by David PlotkinLESSON ONE
New Owners Column is for Antic readers who want to learn how to program
their brand-new Atari 800XL or 130XE computers-or for those who have owned
their Ataris awhile but only used them to run commercial software.
Programming is the ultimate challenge for computer users.
As we start these lessons, I won't assume you know anything about your
computer except how to hook it up. Before we are done, you should be fairly
familiar with programming. I hope you enjoy the trip.
BUILT-IN LANGUAGE
In order to tell your computer to perform specific tasks, you need
a programming language. You can't simply type English words into
your computer and expect it to understand such an illogical vocabulary.
Computers are very literal-minded (annoyingly so) and demand extremely
precise and consistent communications.
Your Atari computer comes with a built-in programming
language called BASIC which is quite powerful, comparatively easy
to learn and widely used by non-professional programmers. Most Antic
listings are written in BASIC.
Like a foreign language, BASIC has its own words, called
commands.
These commands tell BASIC what you want it to do. Fortunately, there aren't
very many commands to learn-and you can get going without knowing every
command. Learning to program in BASIC consists of learning the commands
and how to use them, plus becoming familiar with some of the special powerful
features of your Atari computer.
LOADING & SAVING
BASIC is automatically turned on when you turn on your computer. The
word READY appears on the screen telling you that BASIC is present.
One of the first essentials you must learn is how to move
programs between your computer and your storage disks-you don't want to
retype the whole program every time you use it. BASIC makes it very easy
to perform these operations with the SAVE and LOAD commands.
To SAVE a program you have entered (typed into
the computer) just type:
SAVE "D:FILENAME" [RETURN]
The square brackets [] around the word RETURN are used
by Antic to show that you should press the key marked RETURN. We'll
use the same [ ] symbol to indicate other special keys on the Atari keyboard.
Don't type in the brackets.
To LOAD a program you previously
SAVEd, just type:
LOAD "D:FILENAME" [RETURN]
Type these (and any other) commands exactly as shown! In
this case, you must include the two sets of quotation marks ["] and the
colon [:], and type entirely in capital letters. However, in Antic
the word FILENAME always just stands for whatever name you give your file,
so use the name of your choice instead of FILENAME.
An Atari filename can have up to eight letters. If you
wish, you can also add a period and a three-letter extender- "D:QQQQQQQQ.EEE"
could be a filename. The filename can have less than 8 letters, and the
extender is not required.
TALKING TO COMPUTERS
In order to tell your computer what to do, you will use the keyboard
to enter commands. The keyboard of your Atari looks quite a bit like a
typewriter, but there are some important differences. Set off from the
rest of your keyboard are a series of function keys (labeled [HELP]
,[START], etc.). Many commercial programs use these keys, and I will teach
you how to use them in your own programs.
During the programming process, the only function key
that actually does anything is marked [RESET]. This key clears your screen
if you are programming and will stop a program which is running. The [RETURN]
key at the right of your keyboard is used for telling the computer you
have finished entering a comand or a line of commands.
For example, to make a BASIC program which you have LOADed
from the disk start to RUN, you would type RUN and press the [RETURN] key.
When entering (typing in) a BASIC program, such as the one included with
this column, you would press the [RETURN] key at the end of every line.
A program line is a series of instructions that begins with a line number.
Another key you won't find on the typewriter is the [BREAK]
key in the upper right corner. This key will normally stop a running program.
It will also move the white square on the screen (called a cursor)
down the screen without entering the command or line the cursor is on-
pressing the [RETURN] key would enter the command or line.
The [INVERSE VIDEO] key is in the lower right corner of
your keyboard, marked with a small two-color square. It prints characters
on your screen in inverse (dark characters against a light background).
EDITING ON SCREEN
Whatever you type on your keyboard while you are programming will show
up on the screen. The next letter you type will show up where the white
cursor block is located. Some special keys on your keyboard allow you to
move the cursor around the screen, so that you may type anywhere. This
is especially helpful when you are editing a program you have written,
and need to get to a particular place on the screen to change something.
Four keys to the right of the keyboard are marked with
arrows. The cursor will move in the direction indicated by these arrows
when you hold down the [CONTROL] key and at the same time press
an [ARROW] key. Three additional editing keys are in the upper right corner
of your keyboard, alongside the [BREAK] key.
The [CLEAR] key will blank the screen if you press it
while the [CONTROL] or [SHIFT] keys are held down. This does not erase
your program, it only clears the screen. The [INSERT] key will insert a
space if used with the [CONTROL] key, and will insert a line when used
with the [SHIFT] key.
Finally, the [DELETE BACK SPACE] key will move the cursor
one space to the left, erasing whatever was in that space. But when you
use this key while holding down [CONTROL], it deletes whatever is under
the cursor-and everything on the right moves one space leftward. To delete
the whole line the cursor is on, hold down the [SHIFT] key while pressing
the [DELETE] key.
ERROR MESSAGES
Whenever possible, your Atari tries to help you learn to program by
pointing out when you make errors. These error messages are essentially
of two types. The first type of message occurs when you are entering a
program and make a mistake so the computer doesn't understand what you
want. This is called a syntax error because it indicates that some
is wrong in the syntax (grammar) of your program line.
For example, suppose you typed PRONT instead of PRINT.
After you press [RETURN], the computer will reprint the line with the word
ERROR. And it highlights the point at which it couldn't understand your
commands. You may either retype the entire line carefully, or use the editing
keys described above to delete the word ERROR, correct the mistake, and
then press [RETURN] again.
The second type of error occurs when you are actually
running a program. Naturally enough, it is called a programming error.
The program will stop and display a numbered error message on the screen.
You will then have to go to your manual to figure out what the message
means and what went wrong. This is often difficult and is known as "debugging".
For our purposes right now, if the program stops and gives
you a numbered error message, the thing to do is check and make sure that
the program was typed in exactly as printed. To start this check, type
LIST and press [RETURN]. To pause the listing as it scrolls (goes
by) on the screen, press [CONTROL] and the [1] key at the same time. Press
them again to resume the scrolling movement.
HELLO PROGRAM
Included in this issue's Software Library pages is "My Hello Program."
Type it in carefully and SAVE it to disk before you RUN it. At the
end of each of the numbered lines press [RETURN], to enter that line's
information into the computer memory. Take care of any errors as outlined
above. For now, don't try to use the TYPO II automatic program-checker.
When you are finished typing it in, SAVE it to disk by typing "D:MYHELLO.BAS"
and then pressing the [RETURN] key. This process ensures that if your computer's
memory is erased by an accidental power outage, you can simply turn the
Atari back on and LOAD your program back into memory from disk, as described
above.
Now, type RUN and again press [RETURN]. You may not understand
the way this program works yet, but before long you will.
(New Atari owners will find additional details about topics covered by this series in Lon Poole's excellent book, Your Atari Computer ($17.95), Osborne/McGraw-Hill Publishing Berkeley CA. -ANTIC ED)
David Plotkin is a chemical engineer and a longtime Antic author/programmer.
Listing 1 MYHELLO.BAS Download