Apple ii Battery Charger User Manual


 
* Although the ATN function is not included in AIM 65 BASIC,
the ATN command is recognized (see Appendix H).
202 DIRECT AND INDIRECT COMMANDS
DIRECT COMMANDS
Try typing in the following:
PRINT 10-4 (end with RETURN)
BASIC will immediately print:
6
The print statement you typed in was executed as soon as you hit the RETURN key. This is called
a direct command. BASIC evaluated the formula after the "PRINT" and then typed out its value,
in this case "6".
Now try typing in this:
PRINT 1/2,3*10 ("*" means multiply, "/" means divide)
BASIC will print:
.5 30
As you can see, BASIC can do division and multiplication as well as subtraction. Note how a ","
(comma) was used in the print command to print two values instead of just one. The command
divides a line into 10-character-wide columns. The comma causes BASIC to skip to the next
10-column field on the terminal, where the value 30 is printed.
INDIRECT COMMANDS
There is another type of command called an Indirect Command. Every Indirect command begins
with a Line Number. A Line Number is any integer from 0 to 63999.
Try typing in these lines:
10 PRINT 2+3
20 PRINT 2-3
A sequence of Indirect Commands is called a "Program." Instead of executing indirect statements
immediately, BASIC saves Indirect Commands in memory. When you type in RUN, BASIC will
execute the lowest numbered indirect statement that has been typed in first, then the next higher,
etc., for as many as were typed in.
In the example above, we typed in line 10 first and line 20 second. However, it makes no difference
in what order you type in indirect statements. BASIC always puts them into correct numerical order
according to the Line Number.
Suppose we type in
RUN
BASIC will print:
5
-1
203 OPERATING ON PROGRAMS AND LINES
In Subject 202, we typed a two-line program into memory. Now let's see how BASIC can be used
to operate on either or both lines.
LISTING A PROGRAM
If we want a listing of the complete program currently in memory, we type in
LIST