EasyManuals Logo
Home>Atari>Desktop>800

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 #71 background imageLoading...
Page #71 background image
PROGRAMMING
IN
MACHINE
LANGUAGE
7. Each
character
after
REM
takes
one
byte
of
memory.
Remarks
are
helpful
to
people
trying
to
understand
a
program,
but
sometimes
it
is
necessary
to
remove
remark
statements
to
save
memory.
8.
Subroutines
can
save
memory
because
one
subroutine
and
several
short
calls
take
less
memory
than
duplicating
the
code
several
times.
On
the
other
hand,
a
subroutine
that
is
only
called
once
takes
extra
bytes
for
the
GOSUB
and·
RETURN
statements.
9.
Parentheses
take
one
byte
each.
Extra
parentheses
are
a good
idea
in
some
cases
if
they
make
an
expression
more
understandable
to
the
programmer
.
However,
removing
unnecessary
parentheses
and
relying
on
operator
precedence
will
same
a
few
bytes.
Machine
language
is
written
entirely
in
binary
code.
The
AT
ARI
Personal
Com-
puter
contains
a 6502
microprocessor
and
it
is possible to call 6502
machine
code
subroutines
from
BASIC
using
the
USR
function
.
Short
routines
ma
y
then
be
entered
into
a
program
by
hand
assembly
(if
necessary).
Before it
returns
to
BASIC,
the
assembly
language
routine
must
do
a
pull
ac-
cumulator
(PLA)
instruction
to
remove
the
number
(N)
of
input
arguments
off
the
stack.
If
this
number
is
not
0,
then
all
ofthe
input
arguments
must
be
pop-
ped
off
the
stack
also
using
PLA. (See
Figure
6-1).
The
subroutine
should
end
by
placing
the
low
byte
of
its
result
in
location 212
(decimal),
and
then
return
to
BASIC
using
an
RTS
(Return
from
Subroutine)
in-
struction.
The
BASIC
interpreter
will
convert
the
2-byte
binary
number
stored
in
locations 212
and
213
into
an
integer
between
0
and
65535
in
floating-point
format
to
obtain
the
value
returned
by
the
USR
function.
The
ADR
function
ma
y
be
used
to
pass
data
that
is
stored
in
arrays
or
strings
to
a
subroutine
in
machine
language. Use
the
ADR
function
to
get
the
address
of
the
array
or
string,
and
then
use
this
address
as
one
of
the
USR
input
arguments.
The
following
program,
Hexcode Loader,
provides
the
means
of
entering
hexa-
decimal
codes, co
nverting
each
hexadecimal
number
to
decimal,
and
storing
the
decimal
number
into
an
array.
The
array
is
then
executed
as
an
assembly
language
subroutine.
(An
array
is
used
to
allocate space
in
memory
for
the
routine.)
Advanced Programming Techniques
63

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
BrandAtari
Model800
CategoryDesktop
LanguageEnglish

Related product manuals