Radio Shack TRS-80 User Manual page 114

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

12
IN.
"THE STARTING VERTICAL ADDRESS
*
(
TO
47)
IS"|V
14 IN.
"HDWMANY
VERTICAL BLOCKS DO YOU WISH
TO
FILL";
A
16
IF
V+K48
GOTO
20
18
PRINT "TOO MANY VERTICAL BLOCKS. WOULD WRAP-AROUND!"
19
END
30
FOR
Y =
V
TO
V+A
Now
that
we
can
draw
straight
lines,
we
can
form
figures
like
squares
and
rectangles.
This
program
forms
a
rectangle.
After
NEW
,
type:
10
INPUT
"HORIZONTAL STARTING POINT
(0
TO 127)
"jX
20
INPUT
"VERTICAL STARTING POINT
(0
TO
47)
";Y
30
INPUT
"LENGTH
OF EACH SIDE (IN
BLOCKS)
TO
47)
";K
40
CLS
50
FOR
L
=
X
TO X+K
60
SET
(L,Y)
70
SET (L.Y+K)
80
NEXT
L
90 FOR
M
=
Y
TO Y+K
100
SET
£X,H)
1
10
SET
(
X+K,M)
120
NEXT
M
999
GOTO
999
and
RUN
.
Since
our
building blocks
are
not
square,
but
2
by
8
rectangles,
we
always
get a rectangle.
How
can
we
change
the
program
to
always
form
a square?
112

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents