EasyManua.ls Logo

Commodore VIC-20 - How to Crunch BASIC Programs

Commodore VIC-20
308 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
HOW
TO
CRUNCH
BASIC
PROGRAMS
You
can
pack
more
instructions—and
power—into
your
BASIC
programs
by
making
each
program
as
short
as
possible.
This
process
of
shortening
programs
is
called
"crunching."
Crunching
programs
lets
you
squeeze
the
maximum
possible
number
of
instructions
into
your
program.
It
also
helps
you
reduce
the
size
of
programs
which
might
not
otherwise
run
in
a
given
size;
and
if
you're
writing
a
program
which
requires the
input
of
data
such
as
inventory
items,
numbers
or
text,
ashort
program
will
leave
more
memory
space
free to
hold
data.
But
whether
you're
using
an
unexpanded
VIC
or
a
32K
VIC
System,
your
programs
will
benefit
from
the
following
crunching
techniques.
ABBREVIATING
KEYWORDS
A
list
of
keyword
abbreviations
is
given
in
the
Appendix
A.
This
is
helpful
when
you
program
because
you can
actually
crowd
more
information
on
each
line
using
abbreviations.
The
most
frequently
used
abbreviation
is
the
question
mark
(?)
which
is
the
BASIC
abbreviation
for
the
PRINT
command.
However,
if
you
LIST
a
program
that
has
abbreviations,
the
VIC
will
automatically
print
out
the
listing
with
the
full-length
keywords.
If
any
program
line
exceeds
88
characters
(4
lines
on
the
screen)
with
the
keywords
unabbreviated,
and you
want
to
change
it,
you
will
have
to
re-enter
that
line
with the
abbreviations
before
saving
the
program.
SAVEing
a
program
incorporates
the
keywords
without
inflating
any
lines
because
BASIC
keywords
are
tokenized
by
the
VIC.
Usually,
abbreviations
are
added
after
a
program
is
written
and do
not
have
to
be
LISTed any
more
before
SAVEing.
SHORTENING
PROGRAM
LINE
NUMBERS
Most
programmers
start their
programs
at
line
100
and
number
each
line at
intervals
of
10
(i.e.,
100,
120,
130).
This
allows
extra
lines of
instruction
to
be
added
(111,
112,
etc.)
as
the
program
is
developed.
One
means
of
crunching
the
program
after
it
is
completed
is
to
change
the
line
numbers
to
the
lowest
numbers
possible
(i.e.,
1,
2,
3)
because
longer
line
numbers
take
more
memory
than
shorter
numbers.
For
instance,
the
number
100
uses
79

Other manuals for Commodore VIC-20

Related product manuals