EasyManuals Logo

Atari XL User Manual

Atari XL
262 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #50 background imageLoading...
Page #50 background image
40
The
Atari
XL
Handbook
Atari
not
to go on to
the
following
lines,
which
contain
the
subroutines.
The
subroutine
at
line
110
inputs
two
numbers
and
stores
them
as
A
and
B.
The
subroutine
at
line
210
clears
the
screen
and
prints
the
two
numbers
and
their
sum.
When
the
program
is
RUN,
the
computer
begins,
as
always,
at
the
lowest
numbered
line,
line
10.
This
line
calls
the
first
subroutine,
and
the
computer
is
diverted
to
line
110.
Line
130
returns
the
computer
to
the
instruction
after
the
GOSUB,
which
is
in
line
20.
The
program
proceeds
as
normal
to
line
30,
which
causes
another
diversion
to
line
210.
Line
240
returns
the
computer
to
line
40,
and
the
program
ends.
So, a
GOSUB
command
causes
a
diversion
from
the
sequence
of
a
program
to a
subroutine,
and
the
RETURN
command
ends
the
diversion.
The
use
of
subroutines
saves
a
lot
of
effort
in
writing
programs,
as
the
program
lines
in
the
subroutine
need
to be
written
only
once,
instead
of
being
retyped
at
every
point
in
the
program
where
they
are
needed.
There
is
no
limit
to
the
number
of
times
a
subroutine
may
be
called.
Another
advantage
of
subroutines
is
that
they
can
make
the
design
of a
program
simpler.
If
you
use
subroutines
for
the
repetitive
and
less
important
parts
of
a
program
the
main
program
becomes
much
easier
for you,
the
programmer,
to follow,
and
is
therefore
much
easier
to
write.
Subroutines,
like
loops,
may
be
nested
-
that
is,
the
subroutines
may
call
other
subroutines,
which
may
in
turn
call
others.
However,
a
subroutine
may
not
be
called
by
another
subroutine
which
it
has
itself
called,
or
an
endless
loop occurs.
The
program
will

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari XL and is the answer not in the manual?

Atari XL Specifications

General IconGeneral
Release Year1983
CPUMOS Technology 6502C
GraphicsANTIC, GTIA
SoundPOKEY (4 channels)
StorageCassette tape
PortsCartridge
Operating SystemAtari BASIC
CPU Speed1.79 MHz
RAM64 KB

Related product manuals