EasyManua.ls Logo

Commodore Plus 4 - Page 330

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...
318
Machine
Language
on
the
Commodore
Plus/4
.
2014
D0
FA
BNE
$2010
.
2016
AA
TAX
.
2017
E0
20
CPX
#$20
.
2019 B0
IF
BCS
$203A
.
201B
A0
08
LDY
#$08
.
201D
BD
00
FF
LDA
$FF00,X
.
2020
F0
15
BEQ
$2037
.
2022
30
04
BMI
$2028
.
2024
.
2025
.
2026
.
2028
.
202A
.
202C
.
202E
2030
.
2031
.
2033
2034
.
2035
.
2037
.
2039
.
203A
.
203C
.
203E
88
0A
D0
85
A9
A2
95
CA
10
18
98
69
85
60
A9
85
60
FA
62
00
03
63
FB
80
61
80
66
DEY
ASL
BNE
STA
LDA
LDX
STA
DEX
BPL
CLC
TYA
ADC
STA
RTS
LDA
STA
RTS
$2022
$62
#$00
#$03
$63,X
$202E
#$80
$61
#$80
$66
This
is
always
taken.
Put
converted
register
number
in
.X.
Compare
to
highest
valid
register
number
(+1).
If
greater
than
or
equalr
exit
with
error.
This keeps
track
of
multiplications
by
2.
Get
the
register
contents.
If
zero,
a
zero
must
be
returned.
When
negative,
no
more
muliplying
required.
Decrement
multiplication
index.
Multiply
by
two.
This
is
always
taken.
Store
the
mantissa
in
floating
point
accumulator.
Get
a
zero.
Load
.X
with
size
of
rest
of
accumulator*
Fill
rest
of
accumulator
with
zero.
Decrement
position
in
accumulator.
If
not
done,
go
back.
Prepare
to
add.
Get
multiplication
index.
Add
128
to
get
exponent
for
accumulator.
Store
in
exponent.
Return.
Get
value
with
sign
bit
set.
Put
in
sign
register
to
indicate
error.
Return.
The
SYS
Command
Example:
The
SYS
command
transfers
control
from
a
BASIC
program
to
a
machine-
language
subroutine.
When
the
subroutine
is
completed
with
an
RTS
instruction,
control
is
returned
to
the
BASIC
program.
When
it
is
necessary
to
pass
parame
ters
to
and
from
the
machine-language
subroutine,
the
values
are
normally
stored
in
memory
with
POKE
commands
and
retrieved
using
PEEK.
Note:
You
can
set
the
values
of
the
accumulator,
X
register,
Y
register,
and
status
register
on
entry
to
your
subroutine
automatically
by
POKEing
their
desired
values
into
2034-2037
($07F2-$07F5).
The
values
of
the
registers
on
exit
from
your
subroutine
are
returned
in
the
same
locations.
In
this
example,
a
machine
code
routine
to
fill
an
area
of
the
screen
with
a
given
character
is
called
from
a
BASIC
program
using
the
SYS
command.
The
BASIC
program
is
as
follows:
10
PRI]SrTCHR$(147)//I]SrPIJTPILLCHAEACTER
";:GETKEYA$: