EasyManua.ls Logo

Commodore Plus 4 - Page 290

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...
278
Machine
Language
on
the
Commodore
Plus/4
RTS—Return
from
a
Subroutine
The
value
of
the
PC
is
pulled
from
the
stack,
and
processing
continues
from
that
point.
Operation:
PC
t
PC+1-+
PC
Addressing
Mode
Syntax
Flags
Affected:
None
Opcode
Bytes
Cycles
Implied
RTS
60
1
Example:
This
instruction
is
used
to
end
the
processing
of
a
subroutine.
The
return
address
is
pulled
from
the
stack,
incremented,
and
stored
in
the
PC.
None
of
the
flags
is
affected.
Hence,
the
flags
may
be
used
to
communicate
between
the
main
program
and
the
subroutine.
This
program
cycles
the
two
upper
left
character
locations
on
the
screen
through
all
possible
values.
They
are
changed
alternately,
with
a
brief
wait
between.
The
wait
routine
is
a
subroutine
that
is
terminated
by
an
RTS
instruction.
2000
A2
00
LDX
#$00
2002
EE
00
OC
INC
$0000
2005
20
12
20
JSR
$2012
2008
EE
01
OC
INC
$0001
200B
20
12
20
JSR
$2012
200E
CA
DEX
200P
DO
PI
BNE
$2002
2011
00
BRK
2012
A5
A5
LDA
$A5
2014
29
08
2016
DO
PA
2018
A5
A5
201A
29
08
201C
PO
PA
201E
60
AUD
#$08
BITE
$2012
LDA
$A5
AKTD
#$08
BEQ
$2018
RTS
.X
counts
all
the
possible
values.
Next
character
for
the
first
location.
Call
the
wait
subroutine.
Next
character
for
the
second
location.
j
Call
the
wait'subroutine.
Decrement
the
counter.
If
not
done,
go
back.
Stop
processing.
Start
of
the
subroutine.
Load
the
jiffy
clock.
Look
at
bit
3.
Wait
until
it
is
off.
Load
the
value
of
the
jiffy
clock.
Look
at
bit
3.
Wait
until
it
is
on.
Return
from
the
subroutine.
SBC—Subtract
Memoiy
from
Accumulator
with
Carry
The
operand
is
subtracted
from
the
value
in
the
accumulator
minus
the
inverse
of
the
carry,
and
the
result
is
placed
in
the
accumulator.
Normally
the
carry
is
set
(see
SEC)
prior
to
a
subtraction.
When
in
decimal
mode,
the
Z
flag
is
not
valid;
check
the
accumulator
for
a
zero
result.

Other manuals for Commodore Plus 4

Related product manuals