Apple ii Battery Charger User Manual


 
For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the
door is open. The following program will print "Intruder Alert" if the door is opened:
10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until
bit 1 (masked or selected by the 2)
becomes a 1. When that happens, we go
to line 20.
20 PRINT "INTRUDER ALERT" Line 20 will output "INTRUDER
ALERT."
However, we can replace statement 10 with a "WAIT" statement, which has exactly the same effect.
10 WAIT 40963,2 This line delays the execution of the
next statement in the program until
bit 1 of location A003 becomes 1. The
WAIT is much faster than the equivalent
IF statement and also takes less bytes
of program storage.
The following is another useful way of using relational operators:
125 A=-(B>C)*B-(B<=C)*C This statement will set the variable A
to MAX(B,C) = the larger of the two
variables B and C.
303 COMMANDS
A BASIC command may be entered when the cursor is displayed. This is called the "Command Level."
Commands may be used as program statements. Certain commands, such as LIST, NEW, and LOAD
will terminate program execution when they finish. Each command may require one or more
arguments in addition to the command statement, as defined in the syntax/function description. An
argument without parenthesis is required to be entered without parenthesis. Arguments contained
within parenthesis are required to be entered with the shown parenthesis. Arguments within brackets
are optional. Optional arguments, if included, must be entered with or without accompanying
parenthesis, however shown.
STATEMENT SYNTAX/FUNCTION EXAMPLE
CLEAR CLEAR CLEAR
Clears all program variables, resets "FOR"
and "GOSUB" state, and restores data.
STATEMENT SYNTAX/FUNCTION EXAMPLE
CONT CONT CONT
Continues program execution after the F1
key or a STOP or INPUT statement termi-
nates execution. You cannot continue after
any error, after modifying your program, or
before your program has been run. One of
the main purposes of CONT is debugging.
Suppose at some point after running your
program, nothing is printed. This may be
because your program is performing some
time consuming calculation, but it may be
because you have fallen into an "infinite
loop." An infinite loop is a series of BASIC
statements from which there is no excape.
BASIC will keep executing the series of
statements over and over; until you inter-
vene or until power to the AIM 65 is
turned off. If you suspect your program
is in an infinite loop, press F1 until the
BREAK message is displayed. The line
number of the statement BASIC was
executing will be displayed. After BASIC
has displayed the cursor, you can use
PRINT to type out some of the values of
your variables. After examining these