EasyManua.ls Logo

Commodore VIC-20 - Page 147

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...
If
you
didn't,
then
don't
worry;
learning
machine
language
does
take
patience,
and
cannot
be
accomplished
in
a
day.
The
various
internal
registers
can
be
thought
of
as
special
memory
locations,
because
they
too
can
hold
one
byte
of
information.
It
is
not
necessary
for
us
to
explain
the
binary
numbering
system
(base
2)
since
it
follows
the
same
rules
as
outlined
for
hexadecimal
and
decimal
outlined
previously,
but
one
"bit"
is
one
binary
digit
and
eight
bits
make
up
one
byte.
The
maximum
number
that
can
be
contained
in
a
byte
is
the
largest
number
that
an
eight
digit
binary
number
can
be.
This
number
is
11111111
(binary),
which
equals
SFF
(hexadecimal),
which
equals
255
(decimal).
You
have
probably
wondered
why
only
numbers
from
zero
to
two
hundred
and
fifty-five
could
be
put
into
a
memory
location.
If
you
try
POKE
7680,260
(which
is
a
BASIC
statement
that
"says":—
"Put
the
number
two
hundred
and
sixty
into
memory
location
seven
thousand,
six
hundred
and
eighty,"
The
BASIC
interpreter
knows
that
only
numbers
0
-
255 can
be
put
in
a
memory
location,
and
your
VIC
20
will
reply
with:
7ILLEGAL
QUANTITY
ERROR
READY.
If
the
limit
of
one
byte
is
SFF
(hex),
how
is
the
address
parameter
in
the
absolute
instruction
"LDA
S102E"
expressed
in
memory?
Well,
it
is
expressed
in
two
bytes
(it
won't
fit
into
one,
of
course).
The
lower
(rightmost)
two
digits
of
the
hexadecimal
address
form
the
"low
byte"
of
the
address,
and
the
upper
(leftmost)
two
digits
form
the "high
byte."
The
6502
requires
any
address
to
be
specified
with
its
low
byte
first,
and
then
the
high
byte.
This
means
that
the
instruction
"LDA
S102E"
is
represented
in
memory
by
the
three
consecutive
values:
SAD,
S2E,
S10
We
need
to
know
one
more
instruction
before
we
can
write
our
first
program. That
instruction
is
"BRK."
For a
full
explanation
of
this
instruction,
refer
to
M.O.S
6502 Programming
Manual,
You
can
think
of
it
as
the
"END"
instruction
in
machine
language.
If
we
write
a
program
with
VICMon
and
put the
BRK
instruction
at
the
end,
the
program
will
return
to
VICMon
when
it
is
finished.
This
might
not
happen
if
there
is
a
mistake
in
your program,
or
if
the
BRK
instruction
is
never
reached
(just
like
an
"END"
statement
in
BASIC
may
never
get
executed,
and
thus
if
the
VIC
20
didn't
have
a
STOP
key,
you
wouldn't
be
able
to
abort
your
BASIC
programs!)
131

Other manuals for Commodore VIC-20

Related product manuals