EasyManua.ls Logo

Commodore Plus 4 - Page 291

Commodore Plus 4
464 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
6502
Microprocessor
279
Operation:
A
-
M
-
Addressing
Mode
~C-+A,C
Flags
Affected:
N,
Z,
C,
V
Syntax
Opcode
Bytes
Cycles
Example:
Immediate
Zero
page
Zero
page,
X
Absolute
Absolute,
X
Absolute,
Y
(Indirect,
X)
(Indirect),
Y
SBC
#$hh
SBC
$hh
SBC
$hh,X
SBC
$hhhh
SBC
$hhhh,X
SBC
$hhhh,Y
SBC
($hh,X)
SBC
($hh),Y
E9
E5
F5
ED
FD
F9
El
Fl
2
2
2
3
3
3
2
2
2
3
4
4
4*
4*
6
5*
*
Add
1
when
a
page
boundary
is
crossed.
The
microprocessor
does
two's
complement
subtraction
by
taking
the
one's
complement
of
the
operand
and
performing
an
addition
with
carry.
Thus,
it
is
necessary
to
set
the
carry
prior
to
the
subtraction
to
get
a
valid
two's
complement
result.
The
status
of
the
carry
following
a
subtraction
reflects
the
result.
If
no
borrow
was
required,
the
carry
is
set
to
1.
If
a
borrow
was
required,
the
carry
is
cleared
to
0.
This
fact
may
be
used
to
perform
multiple
precision
subtractions.
If
the
result
is
negative,
the
N
flag
is
set
to
1;
otherwise,
it
is
cleared
to
0.
If
the
result
is
zero,
the
Z
flag
is
set
to
1;
otherwise
it
is
cleared
to
0.
If
the
result
exceeds+127
or
-128,
the
overflow
flag
is
set
to
1;
otherwise
it
is
cleared
to
0.
Frequently,
it
is
necessary
to
have
a
greater
precision
in
calculations
than
the
256
possible
values
for
a
single
byte.
This
is
possible
by
treating
a
group
of
2
or
more
bytes
as
a
single
number.
In
this
example,
the
32-bit
number
stored
at
$2104-$2107
(high
byte
to
low
byte)
is
subtracted
from
the
32-bit
number
at
$2100-52103,
and
the
result
stored
in
$2108-$210B.
.
2000
38
.
2001
A2
03
.
S003
BD
00
SI
.
2006
PD
04
21
.
2009
9D
08
21
.
200C
CA
200D
10
F4
.
200P
00
SEC
LDX
#$03
LDA
$2100,X
SBC
$2104,X
STA
$2108,X
DEX
BPL
$2003
BRK
Set
the
carry
prior
to
the
first
subtraction.
.X
will
index
through
the
4
bytes.
Get
a
byte
of
the
first
number.
Subtract
the
corresponding
byte
from
the
second
number.
Store
the
result
in
the
destination.
Decrement
.X
to
point
at
the
next
byte.
Continue
processing
until
all
4
bytes
are
done.
Stop
processing.
Use
the
M
(Memory)
command
to
examine
and
modify
the
contents
of
$2100-$2107
before
executing
the
program
(using
G
2000).
Then
check
the
contents
of
$2100-$210B
after
the
program
executes.
The
values
in
$2108-$210B
will
be
the
difference
of
$2100-$2103
and
$2104-$2107.

Other manuals for Commodore Plus 4

Related product manuals