EasyManua.ls Logo

Commodore 128D - The ASC and CH R$ Commands; Converting Strings and Numbers

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...
Each
number
generated
represents
one
toss
of
a
die.
To
simulate
a
pair
of
dice,
use
two
commands
of
this
nature.
Each
number
is
gen
erated
separately,
and
the
sum
of
the
two
numbers
represents
the
total
of
the
dice.
The
ASC
and
CHR$
Functions
Every
character
that
the
Commodore
128
can
display
(including
graphic
characters)
has a
number
assigned
to
it.
This
number
is
called
a
character
string
code
(CHR$)
and
there
are
256
of
them
in
the
Commodore
128.
There
are
two
functions
associated
with
this
concept
that
are
very
useful.
The
first
is
the
ASC
function.
Type:
The
computer
responds
with
81.81
is
the
character
string
code
for
the
Q
key.
Substitute
any
character
for
Q
in
the
command
above
to
find
out
the
Commodore
ASCII
code
number
for
that
character.
The
second
function
is
the
CHR$
function.
Type:
The
computer
responds
with
Q.
In
effect,
the
CHR$
function
is
the
opposite
of
the
ASC
function.
They
both
refer
to
the
table
of
charac
ter
string
codes
in
the
computer's
memory.
CHR$
values
can
be
used
to
program
function
keys.
See
Section
5
for
more
information
about
this
use
of
CHR$.
See
Appendix
E
of
this
Guide
for
a
full
listing
of
ASC
and
CHR$
codes.
Converting
Strings
and
Numbers
Sometimes
you
may
need
to
perform
calculations
on
numeric
char
acters
that
are
stored
as
string
variables
in
your
program.
Other
times,
you
may
want
to
perform
string
operations
on
numbers.
There
are
two
BASIC
functions
you
can
use
to
convert
your
variables
from
numeric
to
string
type
and
vice
versa.
69
USING
C128
MODE-Advanced
BASIC
Programming

Table of Contents

Other manuals for Commodore 128D

Related product manuals