EasyManua.ls Logo

Commodore 1541-II - Numeric Data Storage on Diskette

Commodore 1541-II
104 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...
quotation
mark,
in
either
an
Input
or
Input#
statement,
all
other
characters
except
a
carriage
return
or
another
quotation
mark
are
accepted
as
part
of
the
current
data
element.
EXAMPLES:
To
force
a
quotation
mark
into
a
data
element
going
to
a
file,
append
a
CHR$(34)
to
"
the
start
of
the
data
element.
For
example:
PRINT#2,CHR$(34)
-I-''STRASMA,
JIM''
or
PRINT#2,CHR$(34);4<STRASMA,
JIM"
If
you
do
this
often,
some
space
and
time
may
be
saved
by
previously
defining
a
variable
as
equal
to
CHR$(34)
as
we
did
earlier
with
CHR$(13):
20QT$
=
CHR$(34)
400
PRINT#5,QT$
+
NAMES
In
each
case,
the
added
quotation
mark
will
be
stripped
out
of
the
data
by
the
Input
or
Input#
statement,
but
the
comma
or
colon
will
remain
safely
part
of
the
data.
NUMERIC
DATA
STORAGE
ON
DISKETTE
Inside
the
computer,
the
space
occupied
by
a
numeric
variable
depends
only
on
its
type.
Simple
numeric
variables
use
7
bytes
(character
locations)
of
memory.
Real
array
variables
use
5
bytes
per
array
element,
and
integer
array
elements
use
2
bytes-
each.
In
contrast,
when
a
numeric
variable
or
any
type
is
written
to
a
file,
the
space
it
occupies
depends
entirely
on
its
length,
not
its
type.
Numeric
data
is
written
to
a
file
in
the
form
of
a
string,
as
if
the
Str$()
function
had
been
performed
on
it.
The
first
character
will
be
a
blank
space
if
the
number
is
positive,
and
a
minus
sign
(-)
if
the
number
is
negative.
Then
comes
the
number,
digit
by
digit.
The
last
character
is
a
cursor
right
character.
This
format
allows
the
disk
data
to
be
read
back
into
a
string
or
numeric
variable
later.
It
is,
however,
somewhat
wasteful
of
disk
space,
and
it
can
be
difficult
to
anticipate
the
space
required
by
numbers
of
unknown
length.
For
this
reason,
some
programs
convert
all
numeric
variables
into
strings
before
writing
them
to
diskette,
and
use
string
functions
to
remove
any
unneeded
characters
in
advance.
Doing
so
still
allows
those
data
elements
to
be
read
back
into
a
numeric
variable
by
Input#
later,
although
file
data
errors
may
be
avoided
by
reading
all
data
in
as
strings,
and
converting
to
numbers
after
the
information
is
inside
the
computer.
For
example,
t4N$
=
MID$(STR$(N),2)"
will
convert
a
positive
number
N
into
a
string
N$
without
the
usual
leading
space
for
its
numeric
sign.
Then
instead
of
writing
PRINT#5,N,
you
would
use
PRINT#5,N$.
51

Table of Contents

Related product manuals