Warner Communications ATARI 400 User manual


AN
INVITATION
TO
PROGRAMMING™
3:
Introduction
to
Sound and Graphics
A
Warner
Communications
Company
Q
Every
effort
has been
made
to ensure
that
this
manual
accurately
documents
this
product
of
the ATARI
Computer
Division.
However,
because
of
the
ongoing
improvement
and
update
of
the
computer
software
and hardware,
ATARI,
INC.
cannot
guarantee
the
accuracy
of
printed
material
after
the
date
of
publication
and
cannot accept
responsibility
for
errors or omissions.
Reproduction
is
forbidden
without
the
specific
written
permission
of
ATARI, INC., Sunnyvale, CA 94086. No
right
to
reproduce
this
docu-
ment,
nor
the
subject
matter
thereof,
is
granted
unless by
written
agreement
with,
or
written
permission
from
the
Corporation.
I
l
IPRINTED IN
USA.
MANUAL
AND PROGRAM CONTENTS ©1981 ATARI, INC

CONTENTS
1
INTRODUCTION
1
2
HOW
TO
USE
THIS COURSE 1
ATARI
Components
Required 3
General
Instructions
for
Loading
the
Cassette
Tape
5
Preparation
for
the
Lesson
Practice
Sessions 5
3
SUMMARY
OF LESSONS:
INTRODUCTION
TO
SOUND
7
4DESCRIPTION OF FRAMES FOR
INTRODUCTION
TO
SOUND
9
Lesson One: Sound Registers 9
Lesson Two: Sound
Effects
10
Lesson Three: Sound Routines 12
Lesson Four:
Efficient
Sound Programs 16
Lesson Five:
Musical
ABC's 19
Lesson Six:
Identifying
Notes
20
Lesson Seven: Sound Routines
With
Multiple
Registers 23
Final
Quiz:
Sound 26
5
SUMMARY
OF LESSONS:
INTRODUCTION
TO GRAPHICS 29
6DESCRIPTION OF FRAMES FOR
INTRODUCTION
TO GRAPHICS 31
Lesson One:
Graphics
Demonstration
31
Lesson Two:
Changing
Color
31
Lesson Three:
Graphics
Modes
1 and 2 33
Lesson Four: Real
Graphics
36
Lesson Five:
Tricks
With
Graphics
Modes
39
Lesson Six:
Position
and
Animation
41
Lesson Seven:
Graphics
Characters 45
Final
Quiz:
Graphics
47
Contents
iii

1
INTRODUCTION
AN
INVITATION
TO PROGRAMMING™ 3 is a
course
designed
to
introduce
con-
cepts
in
programming
sound
and graphics.
Introduction
to Sound
defines
the
basics
of
music
theory
as
well
as
the
characteristics
of
a
computer-generated
sound. Introduction to Graphics
explains
the
use
of
color
in
graphics
and in-
troduces
the
theory
of
animation.
As
this
course
is
the
third
in a series,
effective
use
of
this
workbook
requires
knowledge
of
ATARI BASIC.
Refer
to
An
Invitation
to Programming 1
and
2
or
the
ATARI
BASIC Reference
Manual
for
clarification
of
any
BASIC
program
instruc-
tions.
The
course
has
the
following
components:
•Cassette
for
I
ntroduction
to
Sound
containing
both
the
computer
program
and
audio
material
•Cassette
for
I
ntroduction
to
Graphics
containing
both
the
computer
program
and
audio
material
• This
workbook
containing
both
sections
of
the
course
to
be used as a
study
guide
and
reference
source
Introduction 1


ATARI
COMPONENTS
REQUIRED
2
HOW
TO
USE
THIS COURSE
•
AT
ARI®
400™
or
AT
ARI
800™
Personal
Computer
System
with:
8K
(minimum)
Random
Access
Memory
(RAM)
AT
ARI
BASIC
Computing
Language
Cartridge
GENERAL
INSTRUCTIONS
FOR
LOADING
THE
CASSETTE
TAPE
•
•
•
AT
ARI
410™
Program
Recorder
Introduction
to
Sound
Cassette
Introduction
to
Graphics
Cassette
1.
Connect
the
ATARI 400 or ATARI 800 Personal Computer System
to
your
television
set
and
to
a
wall
outlet
as
instructed
in
the
Operator's
Manual.
2.
Make
sure
that
the
ATARI 410 Program Recorder is
properly
connected
to
the
computer
console
and
to
a
wall
outlet
(see
your
A TAR I
410
Program
Recorder
Operator's
Manual
for
further
details,
if
necessary).
Note:
If
you
have
"daisy
chained"
(connected
in series)
other
AT
ARI
peripherals
to
your
computer
console,
and
do
not
wish
to
disconnect
them,
connect
your
ATARI
410
Program
Recorder
to
the
I/O
CONNECTOR
of
the
last
unit
in
the
chain.
3.
Make
sure
that
at
least
8K
of
RAM
is
installed
in
your
AT
ARI
Personal
Computer
System. See
the
Operator's
Manual
for
Memory
Module™
loading
instructions.
Note:
If
an
ATARI
Disk
Drive
is
connected
to
the
computer
console,
the
Disk
Operating
System
(DOS)
and
system
software
use
some
of
the
available
Ran-
dom
Access
Memory
(RAM).
The
amount
of
RAM
used
varies
with
the
version
of
DOS
you
are using.
Take
this
overhead
into
account
when
calculating
the
amount
of
RAM
required
to
run
a
program.
4.
Open
the
cartridge
door
and
insert
the
AT
ARI
BASIC
Cartridge
into
the
car-
tridge
slot.
Use
the
LEFT
CARTRIDGE
slot
on
the
ATARI
800 Personal
Com-
puter
System.
Close
the
cartridge
door.
5.
Turn
on
your
television
set.
(You
may
have
to
adjust
the
volume
on
your
television
set,
since
the
voice
from
the
audio
track
comes
from
the
television
speaker.)
6.
Turn
on
your
ATARI
Personal
Computer
System.
The
POWER
switch
is on
the
right
side
of
the
computer
console.
How
to Use This Course 3

4
How
to Use This Course
7.
If
all
equipment
is
properly
connected
and
turned
on,
your
television
screen
should
display
the
READY
prompt,
with
the
white
cursor
just
below.
8. Press STOP/EJECT on
your
ATARI 410
Program
Recorder
to
open
the
cassette
door.
9.
Load
Lesson
One
by
holding
the
cassette
tape
so
that
the
label
(Side 1) is up
and
the
tape
leader
is
facing
you.
Refer
to
Figure 1.
10. SIide
the
cassette
into
the
cassette
holder
and
close
the
door.
11.
If
necessary, press
REWIND
and
rewind
the
tape
to
the
beginning.
(Set
the
counter
on
the
Program
Recorder
to
000.)
12.
Type
CLOAD
on
the
computer
keyboard
and press The
computer
will
"beep"
once
to
remind
you
to
press PLAY on
the
Program
Recorder.
13. Press PLAY and
the
key
to
start
the
tape.
Through
the
window
in
the
Program
Recorder,
note
the
tape
is
turning.
The
beeps and
other
sounds
you
hear
coming
from
the
television
speaker
tell
you
that
Lesson
One
is
being
loaded
into
computer
memory.
Note:
If
you
have
problems
loading
either
of
the
course
programs
and
you
have
peripherals
in
addition
to
the
Program
Recorder
attached
to
the
com-
puter
console,
try
disconnecting
the
other
peripherals
and
connecting
the
Program
Recorder
directly
to
the
computer
console
to
isolate
any
problem.
If
problems
persist,
consult
the
A TAR I
410
Program
Recorder
Operator's
Manua/.
14.
When
the
television
screen
displays
the
READY
prompt,
the
first
program
en-
countered
on
the
cassette, Lesson
One,
has been
loaded
into
the
computer.
Make
sure
that
the
PLAY
button
on
the
Program
Recorder
is
still
down
(and
remains
down).
On
the
chart
provided,
make
a
note
of
the
number
on
the
Pro-
gram
Recorder's
counter.
Enter
this
number
in
the
START
AUDIO
column
for
Lesson
One.
If
you
want
to
run Lesson
One
again,
simply
rewind
the
tape
to
this
number.
As
you
proceed
with
the
course,
similarly
keep
track
of
the
START
AUDIO
numbers
of
the
other
lessons.
15.
Type
RUN
and press
·tJi:l'nJ
to
start
Lesson
One.
From
now
on,
follow
the
in-
structions
given
in
the
lesson.
At
the
end
of
Lesson
One,
make
a
note
of
the
Program
Recorder
counter
number.
Enter
this
number
in
the
END
AlJDIO
column
for
Lesson
One.
16.
DO
NOT
rewind
the
cassette
tape.
When
you
are
ready
to
begin
Lesson
Two,
follow
the
same
procedure
as
you
did
to
load
Lesson
One
(begin
with
Step
12).
Follow
this
procedure
for
all
the
lessons in
the
course
and
for
the
Final
Quiz.
To go
to
a
specific
lesson in
the
course:
Completely
REWIND
the
tape.
Set
the
counter
at
000. Push FAST
FORWARD
on
the
Program
Recorder.
Advance
the
tape
until
you
reach
the
START
LOADING
number
that
you
entered
on
the
chart.
To
repeat
alesson
just
completed:
REWIND
the
tape
to
the
START
AUDIO
number
on
your
chart.

PREPARATION
FOR THE
PRACTICE
SESSIONS
Figure 1
Loading
aCassette Tape
Memory
in a
computer
system is
divided
into
two
components,
ROM
and RAM:
ROM.
Read-Only
Memory
contains
programs
permanently
stored in
your
com-
puter
by
the
manufacturer.
This
information
is essential
for
computer
operation.
The
ROM
programs are
called
read-only
because
they
can be read
but
not
changed.
RAM. Random Access
Memory
temporarily
stores programs and
data
in
your
computer.
You can
enter
information
directly
into
RAM
from
the
keyboard,
which
allows
you
to
create
new programs or
bring
stored
data
into
your
RAM
workspace
from
diskette,
cassette, or cartridge. •
Turning
off
the
computer
console
clears all
the
information
stored in RAM. To
write
new
data
without
turning
your
console
off
and on, use
the
BASIC instruc-
tion
NEW
followed
by A NEW
command
clears
any
information
in RAM.
A
(LOAD
command
brings astored
program
from
the
cassette
into
RAM. To
clear
out
this
program
and prepare
for
the
practice
sessions,
you
MUST
enter
the
NEW
command.
The
following
statement
is repeated at
the
beginning
of
each
practice
session
because
of
its
importance.
How
to Use This Course 5
Note: To
clear
RAM
computer
memory,
type
NEW and press
EVERY
practice
session and
between
each
example
program.
before
,

,

3
SUMMARY
OF
LESSONS:
INTRODUCTION
TO
SOUND
Lesson
One:
Sound Registers
Describes
various
characteristics
of
a
computer-generated
sound.
You experi-
ment
by
changing
each
characteristic,
then
listen
to
the
resulting
sound.
Lesson
Two:
Sound
Effects
Explains
the
underlying
principles
in
generating
routines
for
simple
sound
effects
such as
thunder
or
explosions.
You
also
learn
how
to
imitate
musical
instruments.
Lesson Three: Sound
Routines
Explains in
logical
steps
how
to
develop
a
routine
to
play
computer
music.
Lesson Four:
Efficient
Sound Programs
I
ntroduces
DATA
statements
and
other
techn
iques
that
extend
the
program
developed
in Lesson Three.
Lesson Five:
Musical
ABC's
Discusses
pitch
and
note
representation
of
sounds.
Describes
staves and clefs.
Lesson Six:
Identifying
Notes
Various
musical
sounds are
played
and
shown
on
the
screen. You
identify
the
sounds
and
their
sound
value.
At
the
end
of
the
lesson,
you
translate
written
music
into
a
computer
program.
Lesson Seven: Sound
Routines
With
More
Than
One
Register
Shows
how
to
create
music
programs
and
sound
effects
using
several
sound
registers at
once.
Final
Quiz:
Sound
Quiz
covering
all
of
the
material
taught
in
this
section
of
the
course.
CASSETTE
RECORDER
COUNTER
VALUE
INTRO.
TO START START END
SOUND
LESSON
LOADING AUDIO AUDIO
SIDE 1 1
000
2
3
4
SIDE 25
000
6
7
8
FINAL
TEST
Figure 2Program Recorder
Counter
Numbers
for
Lessons in
Introduction
to
Sound
Summary
of
Lessons:
Introduction
to
Sound
7


LESSON ONE:
SOUND
REGISTERS
4
DESCRIPTION OF FRAMES
FOR
INTRODUCTION
TO
SOUND
Frame 1: The
Sound
Register
Three
variables
determine
the
quality
of
a
sound
produced
by
a
sound
register:
pitch,
purity,
and loudness.
•
Pitch
represents
the
height
of
asound. On
the
ATARI
computer
the
pitch
values range
from
1
to
255.
The
larger
the
assigned
number,
the
lower
the
pitch.
(Frame 19 gives
the
pitch
values
of
musical
sounds.)
•
Purity
(distortion),
a
variable,
allows
you
to
create
special
sound
effects.
Puri-
ty
values range
from
0
to
15. As an
example,
an assigned
number
10
creates a
pure
tone
while
the
number
12
will
give
you
an
interesting
buzzer
sound,
especially
with
a
pitch
number
around
200.
•
The
last
variable
controls
the
loudness
(volume)
of
a
tone.
Values
range
from
1
to
15
with
an assigned
number
1
producing
a
barely
audible
sound, and
the
number
15
producing
a
fairly
loud
sound.
Number
8 is
considered
"normal."
Frame 2: Four
Sound
Registers
The ATARI
computer
contains
four
sound
registers
numbered
0
through
3.
Frame 3:
Sound
Statement
To
produce
asound,
enter
four
variables
into
a
syntax
statement:
the
sound
register,
pitch
value,
purity
value,
and
loudness
of
the
sound.
Commas
must
separate
the
values.
Example:
SOUND
0,
100,
10,
12
where
0 is
the
sound
register,
100
is
the
pitch
value.
10 is
the
purity
value,
and
12 is
the
loudness
value.
Frame 4:
Sound
Shutoff
You
must
turn
the
television
set
to
an
audible
level in
order
to
hear
sound.
Once
turned
on, a
sound
register
stays on
until
you:
1. Assign a
loudness
value
of
o.
2.
Program
an
END
instruction.
For
example,
10
SOUND
1,50,10,8
20 FOR
X=1
TO 1000: NEXT X
30 END
3. Press
the
Irtii£l'i'1"!i[j)
key
on
the
right
side
of
the
keyboard.
~
will
not
stop
the
sound.)
4.
Turn
off
the
sound
on
your
television
set.
Description of Frames
for
Introduction
to Sound 9

Frame 5:
Practice
Session
for
Lesson
One
Note:
To
clear
RAM
computer
memory,
type
NEW and press l;liiil!;!ll
before
EVERY
practice
session and
between
each
example
program.
1.
Type
this
sound
instruction
into
the
computer,
then
press Ij!j"!;!ll
SOUND
0,
50,2,8
To
stop
the
sound,
type
END.
2. Change
the
pitch
value
in
the
instructions
given in step 1.
Repeatedly
change
the
value
until
you
have ageneral idea
of
the
range
of
values
available
to
you. (Suggestion:
refer
to
Frame 22
for
the
pitch
values
of
musical
sounds.)
3.
Similarly
experiment
with
the
purity
and loudness values.
When
you
are ready,
load
Lesson
Two
on
the
cassette by
typing
(LOAD
and
pressing Ij!jiij;lll
twice.
After
the
READY message appears on
the
screen,
type
RUN and press Ij!jiilj!11
to
start
the
lesson.
LESSON
TWO: Frame 6:
Summary
of
Lesson
Two
SOUND
EFFECTS
1. Use
variables
in
SOUND
instructions.
SOUND
0, X, Y, Z
SOUND
0, PITCH, 10, 8
SOUND
0, 15, 2,
LOUD
2.
Produce
sound
effects
with
the
FOR/NEXT
loop.
10 FOR PITCH
=1
TO 255
20
SOUND
0, PITCH, 10, 8
30 NEXT PITCH
3.
Produce
a
variety
of
sounds by
varying
loudness in a FOR/NEXT
loop.
10 REM
PIANO
20 FOR
LOUD=15
TO °STEP-1
30
SOUND
0,15,0,
LOUD
40 NEXT
LOUD
4.
Popping
sounds, explosions,
music
produced
by
tapping,
and
the
like
are
created
by
rapid
variance
between
loud
and soft.
Frame 7:
Practice
Session
for
Lesson
Two
Note:
To
clear
RAM
computer
memory,
type
NEW and press Ijijili;!11
before
EVERY
practice
session and
between
each
example
program.
Description of Frames
10 for
Introduction
to Sound
..

Try
these sound
effects
programs.
An
organ
imitation
uses
two
loudness
loops
in
the
following
program.
The second
loop
rounds
out
the
sound
the
wayan
organ
does
when
the
player
releases
the
key.
Line 10 in
the
program
sets
the
pitch
to a
random
number.
Description of Frames
for
Introduction
to Sound 11

LESSON
THREE:
SOUND
ROUTINES
Descript ion of Frames
12 for
Intr
odu ct ion to S
ound
Add
the
following
line
to
play
two
notes at
the
same
time.
45
SOUND
1, .PITCH
+32,10,
LOUD
When
you
are
ready
,
load
Lesson Three on
the
casse
tte
by t
yping
CLOAD
and
pressing 1;iii'II;!!'
twice
.
After
the
READY message
app
ears on
the
screen,
typ
e
RU N and press 1;iii'II;!!'
to
start
the
lesson.
Frame 8: Sound Routine
A
program
that
produce
s a series
of
sounds is
called
a
sound
routine
. Frames 9
through
17
show
the
evolution
of
an
efficient
way
to
program
a sound
routine
us-
ing
only
one
sound
register. (Lesson Seven discusses
programs
that
use
more
than
one register.)

Frame 9:
line
Numbers
Fr
ame
10:
Adding
Delay
Statements
Each
sep
ar
ate
sound must have a de lay loop.
READY
100
SOUND 0
,81
,10
,8
105
fOR
D
=l
TO 3 0
0:
NEXT D
110
S OUND 0
,64
,10,8
11
5
FOR
0
=1
TO
~
O
O
:
N E
W
T
D
110
S OUND 0
,64
,10,8
1
15
fOR
D
=l
TO
300
:NEXT
D
1 20 S OUND 0
,5
3
,10
,8
1 25
fOR
D
=l
TO 3 0 0 : NEXT D
1 30 SO UND
0,
6
4,
1 0 , 8
1 3 5
fOR
D
=l
TO
300:NEXT
D
140
SOUND
0,60,10,8
145
fOR
D
=l
TO
300
:NEXT
D
150
SOUND
0,47
,10,8
155
fOR
D
=l
TO
300:NEXT
D
160
SOUND
0,60,10,8
165
fOR
D
=l
TO 3 0
0:
NEXT D
170
END
•
Fr
ame
11:
Varying
Amounts
of
Delay
READY
100
SOUND
0,81,10
,8
105
fOR
D
=l
TO
400:NEXT
D
110
SOUND
0,64,10,8
115
fOR
D
=l
TO
200:NEXT
D
120
SOUND
0,53,10,8
125
fOR
D
=l
TO
400:NEXT
D
130
SOUND
0,64,10,8
135
fOR
D
=l
TO
400:NEXT
D
140
SOUND
0,60,10,8
145
fOR
D
=l
TO
400:NEXT
D
150
SOUND
0,47
,10,8
155
fOR
D
=l
TO
200
:NEXT
D
160
SOUND
0,60
,10,8
165
fOR
D
=l
TO
600:NEXT
D
170
END
•
Description of Frames
for
Introduction
to Sound 13

Description of Frames
14 for
Introduction
to Sound
Frame 12:
Delay
Subroutine
REnDY
Ion
~
O
U N
D
0
,81
,10
, 8
10
5 T
400
:GO
~UB
1000
110
~
O
UND
0 ,
54
,10
,8
11
5
T
_
200
:GO
~UB
1000
1
20
~
O
U
N D
0,
5
3,10,8
1 2 5
T
C400:GO
~UB
1000
1
30
~
O U N D
0,64
,10,8
1 3 5
T
=400
:GO
~UB
1000
140
~OUND
0
,60
,10,8
145
T
=400
:GO
~UB
JOOO
150
~
O U N D
0,47,10
,8
155
T =
200
:GO
~UB
1000
160
~OUND
0
,60
,10
,8
16
5
T
=600
:GO~UB
1000
170
END
1000
fOR
D
=l
TO
T:NEKT
D
1010
RETURN
•
Frame 13: PEEK and POKE
For
accurate
counts
in a
music
routine
,
you
can use
the
" cloc
k"
built
into
the
rordX.C-ard-u::courn::i ,li
-,J,'
:" rtd k - ,
OQtT'1'I:':
;"Vu6
-d:fl
r
.fft
"art
-
'
C
,
-cJ
L
~~
'1J
U
H
\
.
"
If)
L8
CL'f,'t
computer
's
memory
.
Telling
the
computer
to
locate
the
clock
requires a PEEK
statement.
Resetting
the
clock
to
0
before
each
use requires a POKE
statement.
The
following
routine
replaces
the
less
accurate
FOR/NEXT
loop
.
Frame 14:
Practice
Session
for
Lesson
Three
Note:
To
clear
RAM
computer
memory,
type
NEW
and press i;iiil!;U1
before
EVERY
practice
session and
between
each
example
program
.

Run
the
following
program
to
hear
the
sound
produced
.
Add
the
following
lines and run it again.
Replace
the
separate FOR/NEXT
loops
with
one
FOR/NEXT
loop
subroutine
by
adding
the
following
lines
to
your
program
. Run
the
program
again.
Desc
ription
of Frames
for Introduction to Sound 15

LESSON FOUR:
EFFICIENT
SOUND
PROGRAMS
Description of Frames
16 for
Introduction
to Sound
Replace
the
FOR/NEXT
subroutine
with
the
following
subroutine, and run
the
pro
-
gram
again.
1000
POKE 20,0
1010
C=
PEEK(20)
1020
IF C
<T
THEN
GOTO
1010
1030
IF
C>
=T
THEN RETURN
Note:
With
T=400
, it
will
take
almost
seven seconds to
play
the
note
! T
value
s
should
be
reduced
.
Replace Line
1030
in
the
above
program
with
the
following
line
and run
the
pro
-
gram again. Is
there
any
difference?
Why?
1030 RETURN
When
you
are
ready
,
load
Lesson Four on
the
cassette by
typing
(LOAD
and
pressing
1;1"'"*'
twice
.
After
the
READY message appears on
the
screen, t
ype
RUN and press
l;I'ilii;V'
to
start
the
lesson.
Frame 15:
Music
Program
With
Timing
Subroutine
Frame 16: Using a
READ/DATA
Statement
READY
100
READ
PT,T
110
IF
PT=O
AND T=O THEN END
120
GOSUB
1000
130
GOTO
100
1000
SOUND
0,PT,10,8
1010
POKE
20,0
1020
C=PEEK(20)
1030
IF
C(T
THEN GOTO
1020
1040
RETURN
2000
DATA
81,40
2010
DATA
64,20
2020
DATA
53,40
2030
DATA
64,50
2040
DATA
60,40
2050
DATA
47,20
2060
DATA
60,60
2070
DATA
0,0
•

Frame 17:
More
Efficient
DATA
Lines
Frame 18:
Practice
Session
for
Lesson
Four
Note:
To
clear
RAM
computer
memory,
type
NEW and press
EVERY
practice
session and
between
each
example
program.
I:
v
1:1'1.
T
practice
session ana
between
each
example
program
.
before
•
Our
" standar
d"
music
program
follows
. The
DATA
lines
contain
the
notes
from
Beethoven
's
Fifth
Symphony
. Run
the
program
as
written
.
READV
100
READ
PT,T
110
If
PT =O AND T=O THEN END
120
GOSUB
1000
130
GOTO
100
1000
SOUND 0
,PT
,10
,8
1010
POKE
20,0
1020
C
=PEEK(20)
1030
If
C<T THEN GOTO
10
20
1040
RETURN
2000
DATA
81,30
2010
DATA
81,30
2020
DATA
81
,30
2030
DATA
102,~0
20
40
DATA
0,0
•
Something
wrong? There are no breaks
between
the
notes! Here is
the
simplest
remedy-add
this
line
to
the
program
:
1040
SOUND
O
,O,O
,O
:RETURN
Now
each
note
is
automatically
shut
off
before
the
next
is
played
.
Description of Frames
for Intro
duc
tio
nto So
und
17
This manual suits for next models
2
Table of contents