EasyManua.ls Logo

Radio Shack TRS-80 - Page 141

Radio Shack TRS-80
236 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
50
P.AT56
,
"X Y"
i
100 F.I=1T0 P: SET(RND( 1
13)
,
RND ( 45)+2) : N.
I
110 F.X=0 TO 111:F.Y=0 TD
47
120 IF
POINT<X,Y)
=
GOTO 160
130
P. AT L,X;iP.AT
L+4,Y;
140
L=L+64
150 G.
170
160 SET(X.Y) sRESETtX.Y)
170
N.Y:N.X
180
P.AT5,"
THE
COORDINATES
OF THE
GRAPHICS
BLOCKS
ARE
>>
>>
"
j
190
P. AT
0;
200 G.200
Vectoring
in
on
Darth
Vader's
Death
Star Fleet
. . .
If
that one didn't blow your mind,
let's take the program apart a
line
at a time:
Line
10
is just the program
identification
note
Line
20
P is set
at
15,
the number
of "targets" to be randomly placed
on the screen
by
the FOR-NEXT
loop
and the random number generator in line 100. L is
set at
119,
the
starting
point for printing
the coordinates and their headings
in
lines
130 and
140.
Line
30
clears
the screen for action.
Line
40
and
50
use PRINT AT to print the heading.
Line
100
generates
15 addresses
and SETs 15 lights.
Line 110 uses two
nested FOR-NEXT loops
to
establish a "scanner",
testing
every
graphics
point
on the screen.
Line 120
tests
to see if the point being
addressed
is
off. If so, the address
printing and
related
incrementing
of
the next
PRINT
AT location in lines
130
and
140
are
bypassed.
Line
130
prints the values
of
X
and
Y
if the
POINT test in line 120 "fell
through", mean-
ing that the point
being
tested
was
not
off.
Line
140
increments the PRINT
AT address
for the next
time line
130
prints the coordi-
nates.
By adding
64,
the next
printing
will
directly line up under
the
current heading
and numbers.
(See the
layout
chart
if
you
can't follow
it
in your
head.)
139

Other manuals for Radio Shack TRS-80

Related product manuals