EasyManua.ls Logo

Commodore VIC-20 - Page 149

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...
The
G
should
turn
into
an
"A"
if
you
have
done
everything
correctly.
You
have
now
written
your
first
machine
language
program!
Its
purpose
is
to
store
one
character,
the
letter
A,
in
the
first
byte
of
screen
memory.
ADDRESSING
MODES
ZERO PAGE
As
shown
earlier,
absolute
addresses
are
expressed
in
terms
of
a
high
order
and
a low
order
byte.
The
high
order
byte
is
often
referred
to
as
the
page
of
memory.
For
example,
the
address
S1637
is
in
page S16
(22),
and
S0277
is in
page S02
(2).
There
is,
however,
a
special
mode
of
addressing
known
as
"zero
page"
addressing
and
it
is.
as
the
name
implies,
associated
with
the
addressing
of
memory
locations
in
page
zero.
These
addresses
have
a
high
order
byte
of
zero.
The
zero
page
mode
of
addressing
only
expects
one
byte
to
describe
the
address,
rather
than
two
when
using
an
absolute
address,
which
saves
speed
and
time.
This
mode
tells
the
microprocessor
to
assume
that
the
high
order
address
is
zero.
Therefore
zero
page
addressing
can
reference
memory
locations
whose
addresses
are
between
SOOOO,
and SOOFF.
THE
STACK
The
6502
microprocessor
(like
almost
all
others)
has
what
is
known
as
a
"stack."
This
is
used
both
by
the
programmer
and
the
microprocessor
to
temporarily
remember
things,
and
to
remember
the
order
of
events.
The
GOSUB
statement
in
BASIC,
which
allows
the
programmer
to
call
a
"subroutine,"
must
remember
where
it
is
being
called
from.
When
the
RETURN
statement
is
executed
in
the
subroutine,
the
BASIC
interpreter
"knows"
where
to
go back
in
order
to
continue
executing.
When
a
GOSUB
statement
is
encountered
in
a
program
by
the
BASIC
interpreter,
the
BASIC
interpreter
"pushes"
its
current
position
onto
the
stack
before
going
to
do
the
subroutine,
and
when
a
RETURN
is
executed,
the
interpreter
"pulls"
from
the
stack
the
information
that
tells
it
where
it
was
before
the
subroutine
call
was
made,
so
that
it
may
continue
as
if
nothing
had
happened.
The
interpreter
uses
instructions
like
PHA
which
will
push
the
contents
ol
the
accumulator
onto
the
stack,
and
PLA
(the
inverse)
which
will
pull
a
value
off
the
stack
into
the
accumulator.
The
status
register
can
also
be
pushed
and
pulled
with
the
PHP,
and
PLP
respectively.
The
stack
is
256
bytes
long,
and
is
located
in
page
one
of
memory.
It
is
therefore
from
S0100
to
S01FF.
It
is
organized
133

Other manuals for Commodore VIC-20

Related product manuals