EasyManua.ls Logo

Commodore 128D - Page 339

Commodore 128D
427 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...
USR
VAL
—Call
user-defined
subprogram
USR(X)
When
this
function
is
used,
the
program
jumps
to
a
machine
lan
guage
program
whose
starting
point
is
contained
in
memory
loca
tions
4633($1219)
and
4634($121
A),
(and
785($0311)
and
786($0312)
for
C64
mode).
The
parameter
X
is
passed
to
the
machine-language
program
in
the
floating
point
accumulator.
A
value
is
returned
to
the
BASIC
program
through
the
calling
variable.
You
must
redirect
the
value
into
a
variable
in
your
program
in
order
to
receive
the
value
back
from
the
floating
point
accumulator.
An
ILLEGAL
QUANTITY
ERROR
results
if
you
don't
specify
this
variable.
This
allows
the
user
to
exchange
a
variable
between machine
code
and
BASIC.
EXAMPLE:
10
POKE
4633,0
20
POKE
4634,19
30
A
=
USR(X)
40
PRINT
A
Place
starting
location
($1300
=
4864:$00
=
0:$13
=
19)
of
machine
language
routine
in
location
4633
and
4634.
Line
30
stores
the
returning
value
from
the
floating
point
accumulator.
This
example
assumes
you
have
a
machine
language
routine
at
$1300.
—Return
the
numeric
value
of
a
number
string
VAL(X$)
This
function
converts
the
string
X$
into
a
number
which
is
the
inverse
operation
of
STR$.
The
string
is
examined
from
the
left-most
character
to
the
right,
for
as
many
characters
as
are
in
recognizable
number
format.
If
the
Commodore
128
finds
illegal
characters,
only
the
portion
of
the
string
up
to
that
point
is
converted.
If
no
numeric
characters
are
present,
VAL
returns
a
0.
EXAMPLE:
10
A$
=
"120"
20
B$
=
"365"
30
PRINT
VAL
(A$
+
VAL
B$)
RUN
485
331
BASIC
7.0
ENCYCLOPEDIA—Basic
Functions

Table of Contents

Other manuals for Commodore 128D

Related product manuals