Atari 65XE Owner's Manual page 66

Hide thumbs Also See for 65XE:
Table of Contents

Advertisement

Delay Loops
Erase all the PRINT statements so that absolutely nothing is in the
FOR-NEXT sandwich loop, except the FOR and the NEXT statements.
Run the program and see what happens:
15
16
17
18
19
20
21
22
23
LIST
RUN
Nothing happens. Change the number in line 10 and watch carefully
again:
10 FOR JKL=1 TO 500
RUN
The Ready prompt takes a few seconds to appear. Change line 10
again:
10 FOR JKL = 1 TO 5000
RUN
This time the Ready prompt takes considerably longer to appear. The
computer is counting but not printing its calculations. The process is
similar to counting silently to yourself. The time it takes the Ready
prompt to appear on the screen is the time it takes the computer to
count to 5000.
FOR-NEXT loops are excellent devices for keeping the computer from
moving on. In fact, FOR-NEXT loops are used so frequently for this
purpose that they are sometimes called "delay loops," and the
common variable name is DELAY. Rewrite the FOR-NEXT loop, using
DELAY as the variable name and different numbers in the FOR
statement:
NEW
10 FOR DELAY=1 TO 300
20 NEXT DELAY
LIST
RUN
61

Advertisement

Table of Contents
loading

Table of Contents