EasyManuals Logo

Atari 800 Basic Reference Manual

Atari 800
122 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 #28 background imageLoading...
Page #28 background image
ON/GOSUB/
RETURN
ONIGOTO
POP
20
Program
Stat
emen
ts
Format:
ON
aexp
{ GOTO}
lineno
[
,lineno
..
.]
GO
SUB
Examples:
100
ON
X GOTO 200, 300, 400
100
ON
A
GOSUB
1000, 2000
100 ON
SQR(X)
GOTO
30,
10, 100
Note:
GOSUB
and
GOTO
may
not
be
abbreviated.
These
two
statements
are
also
conditional
branch
statements
like
the
IF/THEN
statement
.
However,
these
two
are
more
powerful.
The
aexp
must
evaluate
to
a
positive
number
which
is
then
rounded
to
the
nearest
positive
integer
(whole
number)
value
up
to
255.
If
the
resulting
number
is
1,
then
program
control
passes
to
the
first
lineno
in
the
list
following
the
GOSUB
or
GOTO.
If
the
resulting
number
is 2,
program
control
passes
to
the
second
lineno
in
the
list,
and
so on.
If
the
resulting
number
is
0
or
is
greater
than
the
number
of
linenos
in
the
list,
the
conditions
are
not
met
and
program
control
passes
to
the
next
statement
which
may
or
may
not
be
located
on
the
sa
me
line.
With
ON
/GOSUB,
the
selected
subroutine
is
executed
and
then
control
passes
to
the
next
state-
ment.
The
following
routine
demonstrates
the
ON/GOTO
statement:
1 a
:=<=r.:
+ 1
:C.'€1
Ot-.1
:=<
GOTO
100
..
200
..
30f1
..
400}
500
313
IF
:-:::>5
Tli'H~
PRHH
"CIX1PLETE.
II :
HID
413
GOTO
10
50
END
100
PRHH
"t·IDL·J
L·JO~~f:::WG
AT
LH~E
100'':
GOTO
10
200
PF.:IrH
"t
·
[I~J
~·JO~:K
I
~-~G
AT
LH~E
200" =
GOTO
Hi
3tl)
F'RHH
"t·KIL·J
L
·J
OF.:K
I
t
·
~G
AT
LWE
300" :
GOTO
10
40J)
PF.:ItH
"t·[ll·J
l
·JORK
I
t
·
~G
AT
LH~E
400
11
:GOTO
10
50t1
PF.:HH
"t
·
~O~·J
JOF.
:K
IHG
AT
Lir~E
501-3"
:
GOTO
w
Figure
4-9
ON
/
GOTO
Program
Listing
When
the
program
is
executed
, it
looks
like
the
following:
t·~Ol·J
~·JOF.:KH~
AT
LmE
100
t·~C~·l
L·lO~:t:::
WG
AT
LINE
200
r~Ql.l
~·lORK
n~,;
AT
LI
t-~E
300
t·mL·l
l·lORK
Hf.~
AT
L
It-~E
40(1
t·mL·J
L·
JOF.:K
I
t·~
~
AT
L I
t·~E
500
COt
·
1PLETE
.
Figure
4-10
ON
/
GOTO
Program
Execution
Format:
POP
Example:
1000 POP

Table of Contents

Other manuals for Atari 800

Questions and Answers:

Question and Answer IconNeed help?

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

Atari 800 Specifications

General IconGeneral
ProcessorMOS Technology 6502
Processor Speed1.79 MHz
ROM10 KB
GraphicsANTIC and GTIA chips
Release Year1979
Display Resolutionup to 320 x 192
Colors128 colors
Sound4 channels
StorageCartridge, cassette, floppy disk
PortsCartridge, serial, monitor
Operating SystemAtari OS

Related product manuals