EasyManua.ls Logo

Commodore Plus 4 - Page 296

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...
884
Machine
Language
on
the
Commodore
Plus/4
Example:
This
program
looks
through
$8000-$80FF
until
it
finds
an
occurrence
of
the
value
SEA
(the
opcode
for
a
NOP).
The
location
of
the
SEA
is
then
stored
at
$2100
using
the
STY
instruction.
2000
A0
00
2002
A9
EA
2004
D9
00
80
2007
PO 03
2009
C8
200A
DO
P8
200C
8C
00
21
200P
00
LDY
#$00
LDA
#$EA
CMP
I8000.Y
BEQ
$2000
INY
BNE
$2004
STY
$2100
BRK
Start
.Y
at
zero.
Load
.A
with
the
value
to
look
for.
Compare
with
the
next
byte.
If
equal,
then
done.
Increment
to
the
next
byte.
If
there
is
more
to
search,
then
go
on.
Store
the
location
in
$2100.
Stop
processing.
TAX—Transfer
Value
in
Accumulator
into
X
Register
The
value
currently
in
the
accumulator
is
placed
in
the
X
register.
Operation:
A
-*
X
Addressing
Mode
Syntax
Flags
Affected:
N,
Z
Opcode
Bytes
Cycles
Implied
TAX
AA
1
Example:
The
value
in
the
accumulator
is
not
altered.
If
the
value
transferred
is
negative,
the
N
flag
is
set
to
1;
otherwise
it
is
cleared
to
0.
If
the
value
transferred
is
zero,
the
Z
flag
is
set
to
1;
otherwise
it
is
cleared
to
0.
In
this
program
a
value
for the
X
register
is
gotten
from
a
location
specified
by
an
indirect
index.
Because
the
indirect
indexed
addressing
mode
is
not
available for
the
LDX
instruction,
the
value
is
loaded
into
the
accumulator
and
then
trans
ferred
to
the
X
register
with
the
TAX
instruction.
2000
A9
00
2002
85
D8
2004
A9
21
2006
85
D9
2008
AO
00
200A
Bl
D8
200C
AA
200D
BD
00
21
2010
8D
00
OC
2013
00
LDA
#$00
STA
$D8
LDA
#$21
STA
$D9
LDY
#$00
LDA
($D8),Y
TAX
LDA
$2100,X
STA
$0000
BRK
Load
.A
with a
zero.
Store
in
the
low
byte
of
the
address.
Load
.A
with a
$21.
Store
in
the
high
byte
of
the
address.
Load
.Y
with
a
zero.
Get
the
index
for
the
data
retrieval.
Transfer
the
index
to
.X.
Load
.A
with
the
data
byte.
Store
on
the
screen.
Stop
processing.

Other manuals for Commodore Plus 4

Related product manuals