Sample Programs - Yamaha CX5M Owner's Manual

Music computer
Hide thumbs Also See for CX5M:
Table of Contents

Advertisement

SAMPLE PROGRAMS
The
following
programs
are
simple
Basic
programs
that
demonstrate
the structure
and flow
of
a
Basic
computer
program.
In
order
to
become
familiar
with
the
CX5M
and
the
keyboard,
try
entering the
programs and
running them.
When
in
the
MSX
Basic
mode,
the screen should appear
as
follows:
Type
in
the
program
just as
it
appears
here,
then type the
command
"run", followed
by
RETURN.
If
the
program
has
been
correctly entered,
it
should run
properly.
If
not,
type
LIST
and
RETURN
to
list
the
program on
the
screen.
Find
your
error
and
correct
it,
using the cursor keys,
INS
key,
DEL
key,
etc.
to
edit
on
the
screen.
Then
try to
run
it
again.
10
SCREEN 27370TCCS
29
COLOR 5,15,7
30
FOR
1*0
TO
15
40
C*J:IFC*0 THEN C=5
50
X=
I
NT
(
RND< -T
I
ME
>
*240)
2
1
F
X<40
OR
X>200 THEN
50
<60
Y*INT(RND<
1)*180)
:
IF
Y<40 OR Y>180 THEN
40
70
R=INT<RNO(
1)*50> sIF
R<30 OR R>70
THEN
70
80
A=RND(
1)
+
.
5;
IF
A<
.
2
OR
A>1.8 THEN
80
90 C
I
RCLE<X
,
Y>
,
R
,
C
,
,
,A
100
NEXT
I
1
10
GOTO
1
10
This
program
will
draw
circles
of
many
different
shapes
onto
the screen
in
1
5
colors.
If
line
80 and
the
final
A
of
line
90
are deleted,
the
program
will
draw
circles
of
many
different
sizes.
10
CLS:
SCREEN 2,3,0
40
LJNE<0
,0)
-(43,
192)
,
2
,
BF
30
LJNEC44
,
0) -<
127, 192)
,4,BF
60
LINE< 128,0)
-< 191
,
192)
.
8
,
BF
79
LINE< 192,0) -(255,
192)
,
15,
BF
80
GOTO
80
If
you want
to save
this
program
for
later
use or study,
please
refer
to
the section
on
cassette
save/load operations
for
instructions
on
how
to save
it
on
cassette tape.
If
you
enter
another program,
it
will
write over the
first
one, so
the
first
program must
be
cleared
from
memory.
This
is
done by
entering the
command
"new"
(do not
type
the
quotation marks)
and
pressing
RETURN.
The
new
program
will
display
four color
bars (green,
dark
blue,
red,
white)
onto
the screen.
Changing
the color
numbers
(2,
4,
8,
15)
of
lines
20
through 50
will
enable color
bars
of the
desig-
nated color
to be
drawn.
This
program
will
produce
sound.
10
A*-"T 100L8O4GBO5O4O4GO5CE4"
20
B*«"T100L14O4DCO38AGBO4CDEDCO38AO4DEF#"
30
C**"T
1
0
0L8O2BO3OO2BGO3CECO2A
"
40
PLAY A*,B*,C*
50
END
-
17
-

Advertisement

Table of Contents
loading

Table of Contents