EasyManua.ls Logo

Commodore VIC-20 - Page 50

Commodore VIC-20
308 pages
Print Icon
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...
WAIT
Format:
Abbreviation:
Scraen
Display:
I
WAIT
location,
Wp.}:!i-|A
W
[*]
maski
[,
mask2]
For
most
programmers,
this
statement
should
never be
used.
It
causes
the
program
to
halt
until
a
specific
memory
location's
bits
change
in
a
specified
way.
This
is
used
for
arcane
I/O
operations
and
almost
nothing
else.
The
WAIT
statement
takes
the
value
in
the
memory
location
and
performs a
logical
AND
operation
with
the
value
in
maski.
If
there
is
a
mask2
in
the
statement,
the
result
of
the
first
operation
is
exclusive-ORed
with
mask2.
This
sounds
confusing,
but
there's
an
easier
way
to
look
at
it.
The
maski
value
"filters
out'r
any
bits
that
we
don't
want
to
test.
Where
the
bit
is
0
in
maski,
the
corresponding
bit
in
the
result
will
always
be
0.
The
mask2
value
will
flip
any
bits,
so
we
can
test
for
an
off
condition
as
well
as
on.
Any
bits
being
tested
for
a
0
should
have
a
1
in
the
corresponding
position
in
mask2.
EXAMPLE:
WAIT
36868
,
144
,
16
What
are
we
testing
for
here?
Here's
a
binary
look
at
our
two
masks:
144
=
10010000
16
=
00010000
This
WAIT
statement
will
halt
the
program
until
either
the
128
bit
is
on
or
the
32
bit
is
off.
i
;
34

Other manuals for Commodore VIC-20

Related product manuals