EasyManua.ls Logo

Commodore Plus 4 - Page 292

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...
280
Machine
Language
on
the
Commodore
Plus/4
The
carry
flag
is
used
to
transmit
the
borrow
information
between
the
bytes.
Before
the
first
SBC,
the
carry
is
set,
so
the
first
result
is
correct.
If
a
borrow
is
produced
(i.e.,
the
carry
is
cleared),
it
is
automatically
accounted
for
in
the
next
byte
because
the
program
does
not
set
the
carry
before
performing
the
next
SBC.
SEC—Set
the
Carry
Flag
The
carry
flag
is
set
to
1.
Operation:
1
C
Flags
Affected:
C
Addressing
Mode
Syntax
Opcode
Bytes
Cycles
Implied
SEC
38
1
2
Example:
This
program
subtracts
the
contents
of
$2101
from
the
contents
of
$2100
and
stores
the
result
in
$2102.
Since
the
SBC
instruction
adds
the
value
of
the
carry
to
the
sum
of
the
accumulator
and
the
one's
complement
of
the
operand,
the
SEC
instruction
is
used
to
set
the
carry
flag
prior
to
the
subtraction.
This
ensures
that
the
result
is
exactly
the
first
value
minus
the
second
value.
2000
2001
2004
2007
200A
38
AD
ED
8D
00
00
01
02
21
21
21
SEC
LDA
SBC
STA
BRK
12100
12101
$2102
Set the
carry
flag
to
subtract.
Get
the
first
value.
Subtract
the
second
Store
the
result.
Stop
processing.
prepare
to
value.
Use
the
M
(Memory)
command
to
examine
and
change
the
contents
of
$2100-$2102.
SED—Set
Decimal
Mode
The
processor
is
put
into
decimal
mode.
Operation:
1
D
Flags
Affected:
D
Addressing
Mode
Syntax
Opcode
Bytes
Cycles
Implied
SED
F8
1
2
See
the
section
on
decimal
mode.

Other manuals for Commodore Plus 4

Related product manuals