______________________________________
|////////////////////////////////////|
|////////////////////////////////////|
|/SYNDICATE ZMAGAZINE 94 ONLINE NEWS/|
|/----------------------------------/|
|/PUBLISHER/EDITOR|February 22, 1988/|
|/   RON KOVACS   |    Issue #94    /|
|////////////////////////////////////|
|////////////////////////////////////|
|____________________________________|
|Syndicate Publications              |
|Post Office Box 74                  |
|Middlesex, New Jersey 08846-0074    |
|____________________________________|
|Syndicate-ZMAG (201) 968-8148  3/12 |
|XBN-ZMAG       (617) 770-0197  3/12+|
|Stairway-ZMAG  (216) 784-0574  3/12 |
|____________________________________|
|///////////[-CONTENTS-]\\\\\\\\\\\\\|
|____________________________________|
|*|ZMag Newswire  [Atari News Update]|
|*|ZMag Technique [Mr. Goodprobe]    |
|*|Quick Mod      [1200XL Keyboard]  |
|*|ST KeyLock     [Lock up Mod]      |
|*|AtariWriter Plus and SpartaDos    |
|*|ZMag Archives  [From GEnie Atari8]|
|*|Basic Programming Part 7          |
|_|__________________________________|
______________________________________
|*|Editors Desk
______________________________________
by Ron Kovacs

Well, another week has slipped by and
still no due date on the continuing
saga of Kovacs Baby #2.  Doctor said
this past Saturday that he MIGHT have
made a mistake and reset the day two
weeks ahead!  Details as they become
available.

In last weeks ZMag, (#93) I listed the
Stariway to Heaven BBS number very
wrong!!  It turned out to be a voice
line!!  I corrected it above. My
apologies to the party...

The Syndicate BBS has returned to
service. Returning this past weekend,
with FoReM XE and a bare bones system.
I will be updating it in the next few
days. If you get a chance, Please call
and atleast get your access back so
when we are all together, you can get
right into things.  The number is:
(201) 968-8148 300/1200 Ascii/Atascii.

I want to thank Terry at Gateway City
BBS for his assistance with the
software. Give him a call at (314)
647-3290.

Mike Shoenbach of the CompuServe
Atari SIGS mentioned in the CO Sunday
night that there will be a new area
debuting on the SIG this week. Give
it a call this week for details. I
will update you on this next week.

Interesting reading... John Nagy has
alot to say this month in Computer
Shopper.  Please buy it or subscribe
if you dont get it!!

Newsletter info begins next week.

Thanks for reading and hope to see
on the Syndicate BBS!
______________________________________
|*|ZMag Newswire
______________________________________
Atari Update
============

Kyodo reported late last week that
Atari has aquired court injunctions
against six companies for infringing
it's copyrights and patents.

In the court injunction, agents of
Atari seizd over $64,000 worth of
pirated goods.

Kyodo, a Japanese News Service
reported -The six companies were
alleged to have brought in Taiwanese
copies of the Atari 200 video games
and software game cartridges.-

Apple Computer took the same legal
action earlier in conjunction with a
new copyright law in Singapore.

Kyodo is part of NewsNet which can be
accessed through Compuserve and the
IQuest area.  IQuest reviewed in 1986
in ZMagazine.
______________________________________
ZMag Technique
______________________________________
A Review of...
-Your Atari 8 Bit Comes Alive-

by Mr. Goodprobe

Your faithful hardware addict had the
privilege of hearing the following
short story recently:

The fruit pickers down in good ole
Florida decided to employ the services
of some newfangled computerized robots
to help them in the often tedious
chore of picking scrumptious Florida
oranges from the tress in which they
are perched. But...an unforseen
problem caused the project to grind to
a screeching halt! It seems that in a
cost cutting measure these
-programmable pea-pickers- as I call
em, were equipped with black and white
video scanners. Needless to say, to a
robot with a black and white scanner
for video purposes, somehow a bright
shiny orange ready for the pickin' and
fluffy clouds bear a remarkable
similarity! Thus on numerous occasions
the robots were found -locked up- 
with their robotic arms waving towards
the heavens in a futile attempt to
pluck -cumulus- oranges from the sky!
My oh my, what a sight that must have
been.

Anyone even remotely involved in the
computer industry today cannot help
but be excited and enthralled with the
advent of so many new and exciting
advancements in hardware design and
development, and software versatility.
Faster and more powerful are the
keywords of today's computer
revolution. But it is this very same
computer revolution that is causing
consternation in the hearts of many
computer owners as they begin to feel
left out by all the progress that is
going on round about them. The very
same computers which they hold near to
their hearts (and had placed a severe
load on their wallets in the past),
are now -slow ancestors- to the
-miracle micro's- of today. The news
we see today is that these computers,
like the Atari 8 bit series, will soon
be a forgotten, but pleasant memory.
Atari has made it known, that with the
exception of the XE game system, this
is the last year for their support of
the 8 bit line. And Commodore too
expects to sell its 8 bit line of
computers only 2 more years, and hopes
to push its Amiga into the forefront,
and indeed it already accounts for 40%
of its sales in the last few months.
But, I wish to go on record by firmly
stating that I do not feel these
computer manufacturers are in tune
with the facts as the presently exist.
As in the case of the Atari 8 bit
series, this user base contains some
of the most knowledgable programmers,
hardware enthusiasts, and general
computer addicts known on this fine
planet of ours.

New applications, hardware, and ideas
will continue to flow forth that will
continue to keep these computers alive
and well for all computerdom to see.
One such item is a new disk/book
combination called your -Your Atari 8
Bit Comes Alive-, written by Richard
Leinekecker, and edited by David
Leinecker. These are the same fine
folk that previously released -Your St
Comes Alive-  and -The Scientific ST-.
These previous 2 volumes were reviewed
by me in earlier issues of Zmag, and
all are available from Midtown Tv (see
bottom of this article) and from
selected software stores across this
fine land of ours.

Like its predecessors, it is chock-
full of hardware projects that the
user can build and run from his own
computer. An accompanying disk is
filled to the brim with programs that
are used to run the projects you
build. The programs are admittedly
bare-bones as described by the author,
and this is to encourage enhancement
by the users themselves. Although they
are in this fashion, they do the job
well, and are the proud product of
careful planning and many hours of
debugging and enhancing.

The first 3 chapters of this volume
break the necessary ground you need to
cover in order to understand these
pertinent topics:

1.> The use of breadboards, and the
    etching of PC-boards to be used in
    the construction of these and
    other hardware projects.

2.> Construction of a 1.2 to 37 volt
    power supply for use with these
    projects and others you care to
    build in the future.

3.> The basics behind resistors,
    capacitors, diodes, transistors,
    IC's, and voltage regulators.

4.> A quick run-through of the binary
    number system, and hexidecimal
    operations.

5.> Programming tips that touch on:

    a.] Hardware specific peeks and
        pokes...

    b.] Graphics modes...

    c.] Useful memory locations...

    d.] Machine language routines from
        Basic...

    e.] Display lists...

    f.] Overlays...

    g.] Display list interrupts...

    h.] Vertical Blank interrupts...

After breaking you in gently by
guiding the user through the
construction of 2 relatively simple
projects using the joystick ports
(reading data from them), and switch
projects (like a computerized
stopwatch), he then proceeds to
unleash a barrage of fantastic
hardware based goodies!

Feast your eyes on these!:

1.> Door alarms (could even have 255
    of them operational at the same
    time!)

2.> Visible light detectors

3.> Infrared light detectors

4.> Touch switches

5.> Speed detectors

6.> Frequency detectors

7.> Data encoders (as in encoded
    keypads)

8.> Light pens

9.> External device control

A.> Data decoders

B.> Serial data (teaches you how to
    build an infrared system capable
    of sending serial data via
    infrared light!!!). This project
    alone was worth the price of the
    book.

C.> Data selectors

D.> Analog data devices

E.> Audio synthesizers

F.> Tone decoders

G.> Networking devices

H.> Display lighting

With the facts you will pick up from
this fine volume, and the fun you will
have building the projects contained
within, you may finally be able to
convince your wife that this computer
you bought really was for
-educational- purposes.....Nah!!!!

-Your Atari 8 Bit Comes Alive-
-Your ST Comes Alive-
-The Scientific ST- are all written by
and the exclusive property of Richard
Leinecker.

Keep those Atari's hummin!
Mr.Goodprobe

(on lend from)
Midtown TV 27 Midway Plaza Tallmadge,
Oh 44278 Atari 8/16 Repair/Sales
Also:Commodore 8/16 Repair

Many items have flat repair rate, call
for prices!
Zmag Midwest Headquaters bbs is:
Stairway To Heaven 216-784-0574
300/1200 24 hours
Featuring Zmag, 25 on-line games and
Public Domain downloads for Atari 8
bit, ST, and Amiga computers!
______________________________________
Quick Mod
______________________________________
Captured from CompuServe Atari 8

To modify a 1200XL keyboard to work on
other models of Atari computers remove
the 15 conductor cable, ic chips,
capacitors and resistors from the
board and connect wires from the 22pin
keyboard connector in the computer to
the locations shown in the following
diagram.

I have done this modification to a 400
and think it will work with all
models. I believe that the
programmable function keys should
operate properly on XL/XE computers
but the OS in the 400/800 does not
recognise them.

 2       8           10      14      
1+ + + + + + + +8   1+ + + + + + + +8
   3   5               11  13        

     1   7               15  17      
16+ + + + + + +     16+ + + + + + + +
   4   6               12  16        
      19  21                    
15+ + + + + + + + + + + + + + +1
    22  20  18                9 

15 pin connector/left ic pad/right ic pad
______________________________________
Lock and Key for the ST
______________________________________
By R. Flashman [the Flash]
Reprinted from Nybbles & Bytes, 9/87

I was walking by Radio Shack today,
and in I went. Under the alarm
section, I saw they sell a round key
lock like the ones used on an IBM AT.
Since it is for an alarm, it has the
contact on one side, all read for an
electrical wire.  Hmmm, I thought.  I
am always getting annoyed by people
who play with my ST at a show or
meeting when I am busy doing something
else...

I bought it... And I found space right
over my joystick ports (520) on top of
the RF shielding, and now I have an AT
style lock and key on my ST!  Looks
very good, was dead cheap, and in the
off position, you cannot turn on the
ST!

Actually, so simple it is disgusting.
(Lock cost $9.99)  I haven't tried a
1040 yet, so not sure about location.
I found two locations on the 520; on
top of the unit, t othe back and left,
directly above the cartridge port.
Turn your 520 upside down and you will
see how much space there is.  I am
hoping that the 1040 has the same
space.

The other, which is the one I used, is
right above the second joystick port.
(The one you DON'T plug the mouse
into.)  There is enought space, and it
lies right above the RF shielding, it
is also next to the power supply, so
not much cable is needed.

The switch has two connectors on its
end. I connected two wires to it, and
then opened up the RF shielding.  You
will notice that the power switch has
three legs coming out of it.  The one
you want to get is the smallest one. 
(This is the one closest to the back
of the ST.)  I cut it right where it
meets the main board.  (Now that took
guts!)  Then I soldered one of my
wires to it.  I then connected the
other wire to one of the wires that
comes up from the board to that funny
round magnet that is to the left of
the power switch (and about an inch
into the board).  The wire that it
gets wired to is the one closest to
the mouse port.  If you don't believe
me, look under the board and you will
see that originally that wire was
connected to the leg that we just cut
off the power switch.  You NOW have a
switch to the power switch.  Turn the
key off and the power switch becomes
useless.

This will void your warranty.  But it
works like a beauty.  WE are now
offering it as an option for our STs
at the store!
______________________________________
Atariwriter + and SpartaDos
______________________________________
by Glenn K. Smith (70357,1136)

This documentation covers how to make
ATARIWRITER+ use the ramdisk of a 256k
computer.  You must have a Newell,
Rambo or some other memory upgrade
that gives you at least 256k.

First, make a copy of the original
disk, then put the original away, you
won't need it.  Next, you have to
rename a couple of files.  Rename
AUTORUN.SYS to AWXE.COM, and AP.OBJ
to A.OBJ.

Now comes the fun part.  Boot some
sort of disk editor. I prefer using
Disk Master found in DL 3 for making
quick changes.  The following
procedure is for my version of the
program.  There may be other version
that Atari has put out, so you might
have to search the disk for these
values.  Also, these changes may work
for the non-XE version of ATARIWRITER,
but you'll have to find the correct
sectors for the changes.

Patchs:

First change all the instances of
D:AP.OBJ to Dn:A.OBJ (n is your drive
number, I prefer 2).  These are found
on sectors 84, 315, 525, and 526.

Next change the two instances of
D1:AP.OBJ to Dn:A.OBJ (this will make
the filename read Dn:A.OBJJ. Replace
the second J with a $9B(EOL)).  You'll
find this on sectors 467.  On sector
469 you'll see D1:AP.OBJ and on sector
204 you'll see AP.OBJ. Change the
AP.OBJ to some other letters.  Invalid
DOS characters such as the double
quote, dollar sign work well.  These
are the two checks the program makes
to see you are trying to get a
directory of the original ATARTIWRITER
disk.  They don't affect the SpartaDOS
copy because you have to rename the
AP.OBJ file to A.OBJ.

To allow ATARTWRITER+ to use both the
PROOFREADER and MAIL MERGE programs
from the ramdisk, change the D1:MM.OBJ
on sector 188 to Dn:MM.OBJ.  Change
D1:PROOF on sector 181 to Dn:PROOF.

You must also make a few program
changes to complete the process. First
find the start of the AUTORUN.SYS file
(now called AWXE.COM).  Locate the
bytes $AD $1F $D0 $C9 $05 $D0 $03 $4C
$35 $22 and replace them ALL with $EA.
These should be on the first or second
line of your editors display.  This
change will disable the -RUN PD-
option.  Since you'll need a batch
file to copy all the stuff over to the
ramdisk, this option wouldn't work.

To enable all the programs to use the
ramdisk, you must disable the -CHECK
DISK- routine.  This routine checks to
see if you have the correct disk in
the drive.  Since you are using a
ramdisk, this option will cause
problems.  To fix this, find all the
occurences of $C9 $C6.  On my disk
these are found on sectors 428, 448,
and 516.  A few bytes before those
two, you should see $20 $53 $E4.  You
want to change the $20 $53 $E4 to $EA
$EA $EA.  On sector 516, you'll need
to make one additional change.  Find
the bytes $4C $77 $E4 and change them
to $F0 $03 $EA.

There, now all you have to do is copy
the files to a SpartaDOS disk.  The
batch file you'll want use will look
similar to this:

BASIC OFF <--No BASIC
RD D2: /E <--Ramdisk with 64k reserved
COPY A.OBJ D2: <--Copy Program
COPY PROOF. D2:<--Copy PROOFREADER
COPY MM.OBJ D2:<--Copy Mail Merge
COPY GEMINI. D2:<--Copy a printer drvr
COPY *.DCT D2:<--Copy supplimental
                 dictionaries
AWXE      <--Run the program

If you have problems or questions,
please leave me a message and I'll try
and answer them as soon as possible.
If anyone is interested, I have also
gotten Visicalc and other programs to
work with SpartaDOS.
______________________________________
ZMagazine Archives
______________________________________
by Ron Kovacs

Many people ask me each week about
reading the older issues of ZMagazine.
I decided the best way was to show you
what is available is by capturing the
listings from GEnie and CompuServe.

This week GEnie is spotlighted and
next week we will update you on CIS.

Not every issue is available, but if
you are missing a few issues and want
them, you might find them here.

Zmag Issues numbers were changed at
the end of the 1986 calender year.
We originally published the date as
part of the filename. (Ex:ZMAG0527)

This example would mean it was from
May 27th, 1986.  Since the change to
a new year, a conflict might appear
in filename.  So, started the popular
issue number as the filename. 
(Ex:ZMAG93)

This example tells you it is Issue #93
of a regular edition. Special issues
and feature releases may not have a
issue number attached.

If an issue contains (ZMAG59A) a 
letter after the issue number, this
means it was updated or re-editted
after the release of the original.
A document or header in the issue
should explain the reason for a 
change.

I hope this fills you in on the
filenames. Now the GEnie ZMag File
Directory.

No.  File Name   Address  YYMMDD Bytes
======================================
2873 FIX1050.TXT R.KOVACS 880130 6300
2875 REVIEWS.TXT R.KOVACS 880130 23940
2874 SPARTADOS.TXT KOVACS 880130 18900
2886 ZINDEX87.ARC  KHK    880205 10080
1126 ZMAGJULY 15,JEFFWILL 860727 27720
1125 ZMAGJULY 22,JEFFWILL 860727 30240
2224 ZMAG#001.TXT  KOVACS 870713 2520
1137 ZMAG0708.TXTJEFFWILL 860728 17640
1321 ZMAG0920.TXT  KHK    860924 34020
1363 ZMAG1003      KHK    861005 22680
1377 ZMAG1011      KHK    861011 23940
1407 ZMAG1018.TXT  KHK    861018 23940
1422 ZMAG1025      KHK    861025 28980
1431 ZMAG1101.TXT  KHK    861101 30240
1442 ZMAG1108.TXT  KHK    861109 30240
1459 ZMAG1115.TXT  KHK    861116 31500
1483 ZMAG1122.TXT  KHK    861123 28980
1499 ZMAG1129.TXT  KHK    861130 31500
1505 ZMAG1206.TXT  KHK    861206 37800
1532 ZMAG1215.TXT  KHK    861214 18900
1610 ZMAG33.TXT    KHK    870110 28980
1614 ZMAG34.TXT    KHK    870113 25200
1651 ZMAG35.TXT    KHK    870119 26460
1693 ZMAG36.TXT    KHK    870127 26460
1714 ZMAG37.TXT    KHK    870203 26460
1735 ZMAG38.TXT    KHK    870209 27720
1756 ZMAG39.TXT    KHK    870216 25200
1792 ZMAG40.TXT    KHK    870225 31500
1802 ZMAG41.TXT    KHK    870303 23940
1819 ZMAG42.TXT    KHK    870311 25200
1829 ZMAG43.TXT    KHK    870316 34020
1852 ZMAG44.TXT    KHK    870323 37800
1922 ZMAG45.TXT    KHK    870330 23940
1949 ZMAG46.TXT    KHK    870406 22680
1964 ZMAG47.TXT    KHK    870413 22680
1970 ZMAG48.TXT    KHK    870420 21420
2003 ZMAG49.TXT    KHK    870428 23940
2029 ZMAG50.TXT    KHK    870504 22680
2059 ZMAG51.TXT    KHK    870511 21420
2077 ZMAG52.TXT    KHK    870518 32760
2085 ZMAG53.TXT   KOVACS  870524 23940
2114 ZMAG54.TXT    KHK    870601 35280
2120 ZMAG55.TXT  SLOW-K   870605 31500
2129 ZMAG56.TXT    KHK    870608 23940
2154 ZMAG57.TXT    KHK    870616 30240
2175 ZMAG58.TXT    KHK    870622 23940
2225 ZMAG59A.TXT  KOVACS  870713 28980
2207 ZMAG60.ARC    KHK    870706 17640
2212 ZMAG61.TXT    KHK    870710 23940
2234 ZMAG62.TXT    KHK    870717 23940
2251 ZMAG63.TXT    KHK    870725 22680
2270 ZMAG64.ARC    KHK    870731 20160
2297 ZMAG65.ARC    KHK    870807 17640
2308 ZMAG66.ARC    KHK    870814 22680
2322 ZMAG67.ARC    KHK    870821 18900
2343 ZMAG68.ARC    KHK    870829 15120
2377 ZMAG69.ARC    KHK    870905 20160
2399 ZMAG70.ARC    KHK    870911 16380
2426 ZMAG71.ARC    KHK    870919 13860
2450 ZMAG72.ARC    KHK    870925 16380
2501 ZMAG74.ARC    KHK    871009 16380
2511 ZMAG75.ARC    KHK    871017 18900
2535 ZMAG76.ARC    KHK    871023 17640
2568 ZMAG77.ARC    KHK    871030 17640
2604 ZMAG78.ARC    KHK    871106 20160
2634 ZMAG79.ARC    KHK    871113 22680
2667 ZMAG80.ARC    KHK    871120 16380
2695 ZMAG81.ARC    KHK    871128 12600
2724 ZMAG82.ARC    KHK    871205 11340
2731 ZMAG83.ARC    KHK    871211 20160
2770 ZMAG84.ARC    KHK    871223 16380
2797 ZMAG86.ARC    KHK    871230 30240
2808 ZMAG87.ARC    KHK    880104 17640
2837 ZMAG88.ARC    KHK    880111 21420
2857 ZMAG90.TXT   KOVACS  880124 32760
2884 ZMAG91.TXT   KOVACS  880131 36540
2896 ZMAG92.ARC    KHK    880208 20160
1349 ZMAG927.TXT   KHK    860928 20160
2926 ZMAG93.ARC   KOVACS  880217 25200
2848 ZMAG89.TXT   KOVACS  880119 42840
2002 ZPRINT.ARC  SCHWARTZ 870427 13860
2323 ZPRINT23.BAS KOVACS  870822  6300
2407 ZPRINT24.BAS KOVACS  870913  6300
1870 ZPRINT4.OBJ  KOVACS  870325  7560
1869 ZPRINT7.BAS  KOVACS  870325  3780
1892 ZREAD31.XLB  KOVACS  870328  8820
______________________________________
Programming in Atari Basic
Part 7 of a series
______________________________________
Part 7  LESSON 4     Version 1.07

Testing, Branching and Counters

(C) COPYRIGHT 1987 by Jackson Beebe

------------------------------------
More on LOOPING:
------------------------------------
In the Part 6 we learned the powerful
technique of sending program control
back through previous lines of code,
called LOOPING. As we said in Lesson
3, this is a prime feature that
separates computers from calculators.
The program can be sent back through a
pile of source code lines, by using a
FOR-NEXT or a simple GOTO statement,
as:

10 DIM NAME$(15)
20 PRINT -Hello. Who are you?  -;
30 INPUT NAME$
40 PRINT:PRINT:PRINT
50 PRINT -Hi there -;NAME$
60 PRINT:PRINT:PRINT
70 GOTO 20

-----------------------------------
TESTING:
-----------------------------------
The process that unleashes the power
of looping is TESTING.  This gives us
the ability to make decisions each
time we fall through the code, as
-should we continue?-; -should we
quit?-; -is the input numerical?-; -is
X > 42?-; etc.  We can write lines of
code that accomplish some purpose as
guessing the Lotto number, and loop
through multiple times.  If we do
that, we need to test on each pass for
things like, -should we quit?-;
-should output go to screen and/or
printer?-; etc. This is accomplished
by placing lines in the routine's
code, usually at the beginning or the
end, that test before or after
execution.

A test at the beginning of a loop is
called a Top Test, and usually tests
whether to go through the loop or not.
A test at the end is called a Bottom
Test, done after the loop is
completed.  This usually tests whether
to loop back or not.  For example:

* *   TOP  TEST   * *

10 X = 0
20 IF X > 10 THEN END
30 X = X + 1
40 PRINT X
50 GOTO 20

   or

10 X = 0
20 X = X + 1
30 PRINT X
40 IF X < 10 THEN 20
50 END

* *    BOTTOM  TEST   * *

Tests for various conditions and
instructions may be grouped together
in one location in a program, into
-piles- of IF-THEN statements.  I
prefer this approach, as a pile of
lines makes it easy to find and debug
tests.  IF-THEN statements execute
pretty fast, but you'll notice some
slowing when using a large number.

------------------------------------
BRANCHING:
------------------------------------
Testing, coupled with looping, gives
us the ability to make decisions as we
loop.  An additional ability we have
in programming, is BRANCHING.
Branching is simply WHERE we send
control from one of our tests. If our
test asked -should I quit?-, and got a
YES response, we would probably send
control to the line that had the END
statement, ending the program.

Possibilities begin to unfold like
petals of a flower, as you -grok- the
concept of lines of code with multiple
tests for multiple things, sending
control to multiple possible places,
where multiple things may happen, and
on and on and on.  Wow! Now THAT'S
programming. That's what you've been
waiting for, right?  Now, how do we
code these tests?  These CONDITIONAL
TRANSFER OF CONTROL statements?  They
are the IF-THEN statements.

------------------------------------
IF-THEN statement:
------------------------------------
This statement takes the basic form
of:

line#   IF (some test) THEN (some
        statement)
------------------------------------
RELATIONAL Operators:
------------------------------------
We can test for standard mathematical
relationships with the RELATIONAL
Operators which are:

=    equal to
<    less than
>    greater than
<=   less than or equal to
>=   greater than or equal to
<>   not equal to

Some examples:

15 IF X > 89 THEN GRADE$ = -A-
95 IF A <> B THEN C = A + B
135 IF NUM = 99 THEN ? -Bye-:END

20 IF X > 14 THEN 1200

10 IF NAME$ = -JACKSON- THEN 135

Characters may be tested for
alphabetical order, equal to, greater
than etc.
------------------------------------
LOGICAL Operators:
------------------------------------
Tests may be combined, or substituted
using the LOGICAL Operators:

   AND    and    OR

For example:

110 IF X >14 AND DAY$ = -M- THEN 1200

We can test for a range of numbers as:

15 IF X > 0 AND X < 100 THEN 100

25 IF X < 0 OR X > 100 THEN END

Line 15 above, accepts numerical input
to the variable X, that is between 0
and 99.999+.  Line 25 rejects input
OUTSIDE the range of 0 to 100 (same
thing.)

Although it looks easy, knowing when
to use AND and when to use OR in your
tests, will be very confusing. As you
reason out the logic of multiple
tests, you will make the wrong choice
many, many times. Be mistrustful of
your tests, until they are proven
correct by trying good and bad data
for input.  Always check the use of OR
and AND when debugging programs that
don't work right. Try numbers on each
side of the limits, to make absolutely
sure you've got it coded right.

These really get confusing when we
string tests together as:

70 IF (X> 0 AND X< 10 AND FLAG = 1)
THEN FLAG = 0

This line tests for three conditions,
and if True, sets FLAG = 0.  Note
parenthesis used between the IF and
THEN portion of the statement. These
are often required to keep things
straight, and always allowable. Note
the code following the THEN in this
case, is not a GOTO, but simply an
instruction. Here's a test to Quit:

80 etc
90 DIM KEYIN$ (1)
100 ? -QUIT  (Y/N) ?  -;
110 INPUT KEYIN$
120 IF KEYIN$=-Y- or KEYIN$=-y- THEN ?
CHR$(125):END
130 etc

This code dimensions a one character
string variable KEYIN$ for input. It
tests for both an upper and lower case
y, clears the screen and ends the
program if found. Testing for both
upper and lower case is the best idea,
as the program will work, regardless
of how the user has the upper/lower
case toggled. This is an example of
error checking the input, a process
that bulletproofs a program against
incorrect input causing a crash.  This
is often a factor that separates
smooth professional programs from
rough hacks. We will expand on this
process as we learn.

Note the quotes around alphabetic
characters being tested for, and that
Atari BASIC is forgiving about whether
you use spaces before and after the
relational operators, and variables,
etc. Also note we MUST restate the
variable when using AND and OR. Here's
WRONG code that WON'T work:

(wrong)  10 IF A<6 AND >10 THEN END

(right)  10 IF A<6 AND A>10 THEN END

The syntax checker in the built-in
BASIC editor will catch this error.

Multiple statements may be hung on the
end of an IF-THEN, separated by
colons.  The code following the THEN
will be executed when the IF-THEN
statement tests TRUE.  All code past
the THEN will be executed up to the
permissible maximum line length of
three screen lines. The code following
the THEN is never executed if the
statement tests False. For example:

10 FOR X = 1 TO 25
20 IF X>=6 AND X<=10 THEN ? X
30 NEXT X
40 END

This program prints:

  6
  7
  8
  9
 10

The equal sign tests for EXACTLY equal
to, and 5.9999 is NOT equal to 6. This
can be tricky.  It is common practice
to use < and > to test for numbers, or
<= and >= when possible, to avoid
numeric errors resulting from
multiplication or division causing
slight inequality. Strings may be
tested, and < and > will test for
alphabetical order of the first
letters of strings.

Again, don't trust your eyes and brain
to know whether you've arranged your
AND's and OR's, parentheses and logic
correctly. It always LOOKS right. Use
correct and incorrect input, and make
sure by trial and error that
everything is correct.

Some BASIC's support an ELSE addition
to the IF-THEN statement, but Atari
BASIC does not.  Don't worry, we don't
really need it. You can always arrange
code to achieve the effect you want. 
When an IF-THEN statement is False,
execution resumes at the very next
line, and the IF-THEN is NOT executed.

The opportunities, and combinations
are endless, and knowing a few good
-hacks- is what separates new from
experienced programmers.  We will
continue to learn about IF-THEN
statements for a long time.
______________________________________
ZMagazine Issue #94  February 22, 1988
(c)1988 SPC/Ron Kovacs
______________________________________
