Radio Shack TRS-80 User Manual page 110

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

Advertisement

In the
vertical
direction, there are
48
light-block addresses
numbered from
to 47.
is
at
the top
and 47
is
at
the
bottom.
The
statement
"SET
(X,Y)" whitens
the
block
which
is
the
Xth
block
from
the
left in
the
horizontal direction
and
the
Yth
one
down
from
the
top
in
the
vertical
direction.
And,
you've
figured
out
that
RESET
works
the
same
way
except
that
it
"turns the
light
off".
Let's try
it
out.
This
program
will
lighten
any one
block of
your
choosing.
Type:
10
INPUT
"HORIZONTAL ADDRESS
(0
TO 127)
IS";X
20
INPUT
"VERTICAL ADDRESS
(0
TO
47)
IS"
(Y
30
CLS
40
SET
(X,
Y)
and
RUN
many
times using various
values of
X
and
Y.
What
happens
if
X
= 150? Try
it.
How
about
if
Y
= 60?
Try
it,
too.
The
block
just
moves
off
the
end
(or
bottom)
of the screen
and
starts
over with the address count.
We
call
this
"wrap
around".
You may
have noticed
that
if
a
block
is lit
in
the
upper
left-hand corner,
the
READY
and
the
prompt
(>)
destroy
it.
Try
X
= 6 and
Y
=
6.
Then
X
=
5
and
Y
=
5.
We
can avoid
this
problem by not
returning control
to the
prompt
by
adding
99
GOTO
99
at
the
end
of the
program. After running the program,
this line
locks the
Computer
in
an
endless loop.
To
break
the loop,
press
|
BREAK]
key.
You
should put an
endless
loop
at
the
end
of every graphics
program.
Do
it
here,
then
try
X
=
5
and
Y
=
5.
Now
try
X
=
and
Y
=
0.
Remember
the
|BREAK|
key
to stop a properly
"locked
out"
graphics
program,
before
starting
another.
While
we
have a
key
that
RESETs
every block
on
the screen to
"OFF"
in
one
operation
(the
JCLEAR
J
key),
we
don't
have
a
similar
key
to turn
them
all
"ON".
However,
we
can
easily
write a
program
that
"lights",
"whitens"
or "paints" the
entire
screen.
It
uses
one
Clear (not
really
a
must, but always
a
good
habit to use
one
for graphics
programs),
two
FOR-NEXT
loops
and one
endless "locking loop".
Type
this:
10
CLS
108

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents