EasyManua.ls Logo

Commodore VIC-20 - Page 152

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...
page
zero
is
the
actual
address
because
the
index
has
already
been
used
in
the
indirection.
Let
us
fill
location
$05
with
$45,
and
location
S06
with
S1E.
If
the
instruction
to
load
the
accumulator
in
the
indexed
indirect
mode
is
executed
and
the
specified
zero
page
address
is
S01,
then
the
actual
address
will
be
comprised
of:
low
order
=
contents
of
(S01
+X)
high
order
-
contents
of
(S02
+
X)
X
register
=
$04
Thus
the actual
address
will
be
in
=
S01
*
X
-
SOS
Therefore,
the
actual
address
will
be
the
indirect
address
contained
In
S05 and $06
which
is
$1E45
This
is
like
sending
a
mailing
to
a
specific
list
ot
addresses.
We
will
store
a
list
in
zero
page,
and
send
the
"letter"
only
to
those
in
the
list.
Suppose
the
list
of
addresses
starts
at
$00.
Here
is
a
program
to
send
a
"letter"
to
one
of
the
addresses:
LDA
#500
—load
low
order
actual
base
address
STA
S06
—set
the
low
byte
of
the
indirect
address
LDA
#516
—load
high
order
indirect
address
STA
$07
—set
the
high
byte
of
the
indirect
address
LDX
#306 —set
the
indirect
index
(X)
LDA
($00,X)
—load
indirectly
indexed
by
X,
BRANCHES
AND
TESTING
Another
very
important
principle
in
machine
language
is
the
ability
to
lest,
and
detect
certain
conditions,
in
a
similar
fashion
to
the
"IF.
.
THEN"
structure
En
VIC
BASIC.
The
various
"flags"
in
the
status
register
are
affected
by
different
instructions
in
different
ways.
For
example,
there
is
a
flag
1hat
is
set
when
an
instruction
has
caused
a
zero
result,
and
is
reset
when
a
result
is
not
zero.
LDA
#$00
This
instruction
will
cause
[Hthe
zero
result
flag" to
be
set,
because
the
instruction
has
resulted
in
the
accumulator
containing
a
zero.
There
is
a
set
of
instructions
that
will,
given
a
particular
condition,
"branch11
to
another
part
of
the
program.
An
example
of
a
branch
instruction
is
"'BEQ11,
which
means
"branch
if
result
equal
to
zero."
The
branch
instructions
will
"branch"
if
the
condition
is
true,
and
if
not,
the
program
will
continue onto
the
next
instruction,
as
if
nothing
had
occurred.
The
branch
instructions
branch
not
by
the
result of
136

Other manuals for Commodore VIC-20

Related product manuals