EasyManua.ls Logo

Commodore 1581 - Examples of RECORD# Command Usage

Commodore 1581
138 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...
byte.
It
is
also
possible
to
store
any
unsigned
integer
from
0-65535
in
two
bytes,
with
one
byte
holding
the
part
of
the
number
that
is
evenly
divisible
by
256,
and
any
remainder
in
the
other
byte.
In
machine
language,
such
numbers
are
written
backwards,
with
the
low-order
byte
(the
remainder)
first,
followed
by
the
high-order
byte.
In
assem
bly
language
programs
written
with
the
Commodore
Assembler,
the
low
part
of
a
two-byte
number
is
indicated
by
preceding
its
label
with
the
less-than
character
(<).
Similarly,
the
high
part
of
the
number
is
indicated
by
greater-than
(>).
-NOTE
To
avoid
the
remote
possibility
of
corrupting
relative
file
data,
it
is
necessary
to
give
RECORD#
command
once
before
the
Read
or
Write
access
and
once
after
the
access.
Although
this
is
not
necessary
for
the
1581,
other
Com
modore
drives
require
it.
To
make
your
programs
compati
ble
with
those
other
drives,
it's
a
good
idea
to
use
it.
EXAMPLES:
In
BASIC
7.0,
to
position
the
record
pointer
for
file
#2
to
record
number
3,
type:
RECORD#2,3
In
BASIC
2.0,
to
position
the
recQrd
pointer
for
channel
#2
to
record
number
3,
type:
PRINT
#15,
"P"
+CHR$(98)
+CHR$(3)
+
CHR$(0)
The
CHR$(98)
comes
from
adding
the
constant
(96)
to
the
desired
channel
number
(2).
(96
+
2
=
98)
Although
the
command
appears
to
work
even
when
96
is
not
added
to
the
channel
number,
the
constant
is
normally
added
to
maintain
compatibility
with
the
way
RECORD#
works
in
BASIC
7.0.
Since
3
is
less
than
256,
the
high
byte
of
its
binary
representation
is
0,
and
the
entire
value
fits
into
the
low
byte.
Since
you
want
to
read
or
write
from
the
beginning
of
the
record,
no
offset
value
is
needed.
Since
these
calculations
quickly
become
tedious,
most
programs
are
written
to
do
them
for
you.
Here
is
an
example
of
a
program
which
57

Table of Contents

Other manuals for Commodore 1581

Related product manuals