EasyManua.ls Logo

Commodore 1541-II - Completing Relative File Creation

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...
450
INPUT"RECORD
#
DESIRED";RE
46a
IF
RE<1
OR
RE>65535
THEN
450
470RH
=
INT(RE/256)
480RL =
RE-256*RH
490
PRINT#15,
"P"
+CHR$
(98)
+CHR$
(RL)
+
CHR$
(RH)
Assuming
RH
and
RL
are
calculated
as
in
the
previous
example,
programs
may
also
use
variables
for
the
channel,
record,
and
offset
required:
570
INPUT
"CHANNEL,
RECORD,
&
OFFSET
DESIRED";CH,RE,OF
630
PRINT#15,"P"+CHR$(CH
+
96)+CHR$(RL)+CHR$(RH)+CHR$
(OF)
ANOTHER
RECORD#
COMMAND
Basic
4.0
on
Commodore's
PET
and
CBM
models
includes
a
Basic
Record#
command
not
found
in
any
of
the
serial
bus
computers.
However,
some
available
utility
programs
for
these
models
include
it.
It
serves
the
same
function
as
the
Record#
command
explained
above,
but
has
a
simplified
syntax:
RECORD#file
#,record
#,offset
where
"file
#"
is
the
relative
file
number
being
used,
not
the
command
channel's
file,
"record
#"
is
the
desired
record
number,
and
"offset"
is
as
above.
If
you
see
a
Record#
command
written
in
Basic
4
form
in
a
program
you
want
to
use,
simply
convert
it
into
the
usual
form
for
both
Basic
2
and
3.5
described
in
this
section.
COMPLETING
RELATIVE
FILE
CREATION
Now
that
we
have
learned
how
to
use
both
the
Open
and
Record#
commands,
we
are
almost
ready
to
properly
create
a
relative
file.
The
only
additional
fact
we
need
to
know
is
that
CHR$(255)
is
a
special
character
in
a
relative
file.
It
is
the
character
used
by
the
DOS
to
fill
relative
records
as
they
are
created,
before
a
program
fills
them
with
other
information.
Thus,
if
we
want
to
write
the
last
record
we
expect
to
need
in
our
file
with
dummy
data
that will
not
interfere
with
our
later
work,
CHR$(255)
is
the
obvious
choice.
Here
is
how
it
works
in
an
actual
program
which
you
may
copy
for
use
in
your
own
relative
file
programs.
1020
OPEN
15,8,15
Open
command
channel
1380
INPUT"
ENTER
RELATIVE
FILE
NAME''
;FI$
Select
file
parameters
1390
INPUT"ENTER
MAX.
#
OF
RECORDS";NR
1400
INPUT-ENTER
RECORD
LENGTH";RL
59

Table of Contents

Related product manuals