Home Applications & Games
For the Atari 400/800 Personal Computers

By Timothy P. Banse

home applications and games for the Atari 400/800 personal computer book

First published in 1983, this second edition is a faithful reproduction of the original, classic personal computer book that boasts 31 easy to use Atari BASIC programs.

Simply type in the programs and use them to manage your checkbook, or create a database file to keep an inventory of household goods. You can play graphic games, shooting down imaginary MIG fighters, battle the insidious monster Grendel, or one of the evil Ghost Town Vampire girls.

Test your Extra Sensory Perception.

Expand your consciousness with the Color Speak game.

Compose music.

Encrypt or decrypt private files with the codebreaker utility.

What's tantalizing about this book is the way its many computer programs take advantage of all the sophistication of Atari BASIC. Its 6502 Motorola main processor talks to a separate graphics chip which offers great graphics for games, a feature that was unavailable on other home computers of the time. More particularly, in addition to graphics, Atari BASIC supports sound, (SOUND statement), graphics (GRAPHICS, SETCOLOR, COLOR, PLOT and DRAWTO) and peripheral units like joysticks (STICK, STRIG) and paddles (PADDLE, PTRIG). Other home computer users were often left with cryptic PEEKs and POKEs for such programming. As such, this book's litany of programs provides a self teaching guide to all the nuances of Atari BASIC.

What You Should Know About ATASCII

Computers don't understand English. Their native language consists of numbers which they use to communicate and compute at nearly the speed of light. Your Atari Computer even uses numbers to tell which key you've pressed, or what it is you want to see displayed on the screen. For example, the comptuer knows the letter A as number 65. The lowly space character, which is printed when you press the space bar, is represented as 32. These number codes are known as: ATASCII, which stands for: Atari ASCII. In turn ASCII which stands for American Standard Code for International Interchange, is the code used by most microcomputers to internally represent letters, numbers and punctuation. In Atari BASIC, the letters of the alphabet (both lower and upper case), the digits from 0 to 9, special characters like the comma, quote marks question marks and graphics characters are all assigned ATASCII/ASCII values.

If for example when you program PRINT CHR$(65) the screen displays an uppercase letter A. Similarly PRINT CHR$(32) prints a space and PRINT CHR$(97) causes a lower case letter A to display. Great. But how can I put this system to work? Well, if you've ever tried to display quote marks like this:

100 PRINT ""Quote me""

Then you already know that won't work. But this will:

100 PRINT CHR$(34);"Quote me";CHR$(34)

In case you hadn't already guessed the number 34 is the ATASCII value for a quote mark.

Besides these rather tame offerings there are some hot items that can make a program sit up and roar: Here's one of them. Let's say you have written program that asks for a particular tidbit of information. For instance you'll be driving 2000 miles and paying $2.40 a gallon for gas, so you write a program that lets you enter the mileage of various cars you might drive, and then calculates the total cost of the journey. Sounds simple enough. But what if you've gone to a great deal of work formatting the screen display? Rather than blanking the entire screen each time you want to enter another car's mileage, why not simply blank out the previous entry and nothing else? Well you can, and it's as easy as printing a single ATASCII character.

All you need to do is situate the cursor with the POSITION command at the beginning of the line you want to erase and then execute: PRINT CHR$(156),the ATASCII code for line delete. Here then are some more useful ATASCI code numbers that, when used in conjunction with POSITION, lend the programmer complete control over the screen display. Simply insert the code number for the desired function between the parentheses in the PRINT CHR$ statement.

ATASCII Code Functions

254 Delete a character
255 Insert a characters
156 Delete a line
157 Insert a line
125 Clear the screen
253 Beep the speaker

Here's a short program that reveals the ATASCII value of any key pressed. Press the [Break] key to end the program.

100 REM *** KEYBOARD, ATASCII PEEK ***
110 OPEN #1,4,0,"K:"
120 GET #1,CHAR
130 PRINT CHAR 140 GOTO 120

How to Make Programs Easier to Read

Ever try to read and understand a program that seem to be nothing more than a purposefully constructed maze of PEEK, POKE and GOSUB statements? No matter how hard you try, the program's logic doesn't make any sense at all. One way to prevent that kind of mind-numbing puzzlement in your own program lies in the careful selection of the string and numeric variables. With Atari BASIC it's legal to use variables up to 128 characters in length. That pays big dividends in readability. Instead of using plain old X, Y, and L, you can label a variable: MONEY. INTEREST, or even EMBEZZLE and JAIL. The only penalty you'll pay is that longer variables take up more memory.

Create a Program Trace

Sometimes programs seem to crash for no good reason. Soon our eyes are burning and our minds have grown tired from the toil of scrutinizing line after line of code and still our mind's eye remains blind to the problem. Sigh. If only BASIC had a TRACE function. An example of this sort of problem is when you've got a PRINT Z7 when you want PRINT ZZ or a PRINT B0 when you really mean PRINT BO With a TRACE utility you can run the program and at least know if it even executed to a particular line number before it died with a whimper. In lieu of a built-in TRACE function, here's one you can program. Whi1e it's not needed with most programs, it can be a real time and frustration saver when it's needed. Here's how to do it.

Imbed PRINT statements within the program that simply print the number of the line 1ast executed. You don't have to type in a PRINT 100 or PRINT 110 after each line. Just every two or three lines of code, and then probably, only to keep track of the statements you feel are the ones giving you the trouble. Here's an example:

100 INTEREST = 20
110 PRINT INTEREST
115 PRINT 110
120 INTEREST = INTEREST + 100
125 PRINT 120
130 PRINT INTEREST
140 GOT0 100

This way, every time the program executes lines 110 and 120, the appropriate line number will be displayed on the screen, if said program just isn't working, and you can't find the problem, imbed print commands within the currently executing program line. Patiently work your way through the suspected line numbers monitoring all of the information until you find the bug. However, once it's up and running, you'll want to remove all the extra program statements to limit the memory the program is taking up.

How to Save Time Typing in Programs

Even professional typists shudder at the thought of typing in computer programs. The experience can be a tedious, boring experience and the sooner it's over the better. Thankfully, due to the design of the wondrous Atari, there is a shortcut, Its screen is live. That means you can type in a program line that's similar to a few others and use the cursor positioning key to change only the line number. Here's what we mean:

100 PRINT
can easily become:
120 PRINT
or any of the following:
200 PRINT
320 PRINT A
200 PRINT LOOP

Changing existing program lines is just as easy. LIST the appropriate line number and use the cursor positioning keys to maneuver around the screen in order to type over whatever it is you desire to modify.

How to Keep a Program from Being Listed

The day may come when you 4don't want one of your programs listed to the screen or the printed. Whatever the reason, you can protect it by branding it a RUN only file. if you do, you can LOAD or ENTER the program, but you cannot LIST it The only way to Use the program is via RUN "C:" or to RUN "D:Secrets". When you're ready to protect a sensitive program, enter its last line as:

32767 POKE PEEK(138) + 256 * PEEK (139) + 2,0: SAVE “D:FILENAME":NEW

Then enter GOTO 32767. Doing so will save the program in its protected form. Similarly, Cassette users will use:


32767 POKE PEEK(138) + 256 * PEEK(l39)+ 2,0:SAVE'C:":NEW

Just as before, enter GOTO 32767 to save the program in protected form. Naturally you'll need to have a tape ready to go and the play/record buttons pressed. To avoid having your program accidentally encounter line 32767 you might want to add another line:

32766 STOP

One word of caution. You may an to hide an unprotected version of the program in case you decide Later to modify it.

Lightning Fast Programming

All too often typing in programs is a tedious and mind-numbing experience. But there is a form of salvation that can greatly reduce the number of keystrokes you need to apply. Almost all of the BASIC commands boast a one, two, or three letter abbreviation. For example, these abbreviations allow typing POS. or a ? (a question mark) in place of PRINT. With some programs you can eliminate anywhere from thirty- to 60-percent of the typing. Once one of these abbreviations is entered, it will be listed as the full command and not as the abbreviation you keyed. One exception to this is the previously mentioned ? which means PRINT. Use the question mark shortcut and that's what you'll see in place of the PRINT when you list the program.

ATARI BASIC Abbreviations

You've probably noticed some of the abbreviations are as long as the commands they're supposed to shorten. Naturally, you won't save time and would probably end up losing time either memorizing the useless little whelps or having to look them up every time you code a program Line. The obvious answer is memorize only the abbreviations for long commands such as POSITION/POS and LPRINT/LP.

Command - Abbreviation * Command - Abbreviation
BYE B. LPRINT LP.
CLOAD CLOA. NEXT N.
CLOSE CL. NOTE NO.
COLOR C. PLOT PL.
CSAVE CS. POINT P.
DATA D. POKE POK.
DEG D. POSITION POS.
DIM DI. PRINT PR. or ?
DOS DO. PUT PU.
DRAWTO DR. READ REA.
ENTER E. REM R. or .
FOR F. RESTORE RES.
GET GE. RETURN RET.
GOSUB GOS. RUN RU.
GOTO G. SAVE S.
GRAPHICS GR. SETCOLOR SE.
INPUT I. SOUND SO.
LET LE. STATUS ST.
LIST L. STOP ST.
LOAD LO. TRAP T.
LOCATE LOC. XIO X.

The author has published several books on BASIC programming, served as an editor on a major computer magazine and written a goodly number of articles for many different computer magazines in the United States and the United Kingdom including: Peanut (PCjr), Personal Computer, Microcomputing, Antic, and Atari Explorer.

Computer Book Details

Trade Paperback: 122 pages
Language: English/Computer BASIC
ISBN 978-0934523-06-6
Dimensions: 8.5 x 11 inches
Shipping Weight: 13.4 ounces