EasyManua.ls Logo

Commodore Plus 4 - Page 305

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
293
Example:
sooo
2001
2002
2004
2006
2007
P8
18
A9
69
D8
00
98
12
SED
CLC
LDA
ADC
CLD
BRK
##98
#$12
Set
decimal
mode.
Clear
the
carry
for
adding.
Load
.A
with
98
(BCD).
Add
12
(BCD).
Clear
decimal
mode.
Stop
processing.
The
result
(in
.A
and
the
status
register)
will
be
10
(BCD)
with
a
carry.
Note:
The
zero
flag
is
not
valid
following
a
decimal
mode
operation.
Use
a
compare
to
check
for
zero.
Note:
The
system
interrupt
service
routine
does
not
clear
decimal
mode.
If
it
is
set
in
the
main
program,
it
is
set
during
IRQ
service
unless
the
IRQ
routine
clears
decimal
mode.
Note
that
clearing
decimal
mode
in
the
IRQ
routine
does
not
affect
its
setting
in
the
main
program
because
the
status
register
is
restored
during
the
RTI.
Addressing
Modes
Some
6502
instructions
must
be
accompanied
by
an
operand
address
containing
the
data
with
which
the
instruction
will
be
performed.
There
are
a
number
of
ways
to
specify
the
operand
address.
Basically,
6502
addressing
modes
fall
into
two
categories,
indexed
and
nonindexed.
The
nonindexed
modes
are
immediate,
absolute,
zero page,
relative,
and
indirect.
The
indexed
modes
are
absolute
indexed,
zero
page
indexed,
indirect
indexed,
and
indexed
indirect.
Many
instructions
do
not
require
an
operand.
Their
addressing
mode
is
referred
to
as
implied
and
they
require
only
1
byte.
In
the
machine-language
monitor,
an
implied
mode
instruction
appears
in
this
format:
mnemonic
where
mnemonic
is
an
instruction
mnemonic.
The
following
instructions
are
available
in
implied
mode:
BRK,
CLC,
CLD,
CLI,
CLV,
DEX,
DEY,
INX,
INY,
NOP,
PHA,
PHP,
PLA,
PLP,
RTI,
RTS,
SEC,
SED,
SEI,
TAX,
TAY,
TSX,
TXA,
TXS,
and
TYA.
A
few
instructions
may
be
performed
on
the
data
in
the
accumulator.
Their
addressing
mode
is
referred
to
as
accumulator
and
they
require
only
1
byte.
In
the
machine-language
monitor,
an
accumulator
mode
instruction
appears
in
this
format:
mnemonic
where
mnemonic
is
an
instruction
mnemonic.
The
following
instructions
are
available
in
accumulator
mode:
ASL,
LSR,
ROL,
and
ROR.