Sharp MZ-80A Owner's Manual page 57

Hide thumbs Also See for MZ-80A:
Table of Contents

Advertisement

47
|
ASC and CHR$ are
Relatives
ASC
10 PRINT ASC ("A")
;
20 PRINT ASC ("ABC");
30 TS
=
"Z"
;
PRINT ASC
(TS)
40
END
RUN
65 65 90
Ready
With strings in the parenthesis (
)
of
ASC,
when
PRINT
is
keyed-in the result always
shows numerals.
Actually, this shows the
ASCII code. All characters used with the
computer
are based on
the
ASCII code. For
its
table,
refer
to
page 210. ASC
(
)
picks
up the
ASCII code for
the
first character
of
string in
the parenthnesis
(
).
This
gives
a clear clue
to
the reason why the
same result
is
obtained
although the
strings in
the parentheses differ between line numbers 10
and
20.
The ASCII code is for characters up
to
255.
CHR$
If
characters can
be
converted
to
the ASCII
code,
it is natural that
there is a statement
to
reverse
the conversion. That's right.
CHRS
state¬
ment
does that job.
PRINT CHRS
(65).
CHRS (ASC
("K"))
A
K
Ready
A cipher is generated using the
numerals. Let
CHRS
read it.
10 FOR J
=
1
TO 24
:
READ
A
20 6S
=
CHRS
(A j
30 PRINT BS
; :
NEXT
:
END
40 DATA
73.
32.83,84,85,68
50 DATA 89, 32,66.65,83,73
60 DATA
67, 32,79,70,32,77
70 DATA
90,
45,56,48,65,46
RUN
I
STUDY
BASIC
OF
MZ
80A.
Ready

Advertisement

Table of Contents
loading

Table of Contents