EasyManua.ls Logo

Commodore 1581 - Completing Relative File Creation

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...
inputs
a
record
number
and
converts
it
into
the
required
low-byte/
high-byte
form:
450
INPUTRECORD
NUMBER
DESIRED";RE
460
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)
COMPLETING
RELATIVE
FILE
CREATION
Now
that
you
have
learned
how
to
use
both
the
Open
and
Re-
cord#
commands,
you
are
almost
ready
to
properly
create
a
relative
file.
The
only
additional
fact
you
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
you
want
to
write
the
last
record,
you
expect
to
need
in
your
file
with
dummy
data
that
will
not
interfere
with
your
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.
BASIC
2.0:
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
1410
OPEN
l,8,2,"0:"
+
FI$
+
"JL,"
+
CHR$(RL)
Begin
to
create
desired
file
1420
GOSUB
59990
Check
for
disk errors
1430
RH
=
INT(NR/256)
Calculate
length
values
144ORL
=
NR-256*RH
1450
PRINT#15,"P"
+
CHR$(96
+
2)
+
CHR$(RL)
+
CHR$(RH)
Position
to
last
record
number
1455
PRINT#15,"P"
+
CHR$(96
+
2)
+
Re-position
for
safety
CHR$(RL)
+
CHR$(RH)
1460
GOSUB
59990
1470
PRINT#1
,CHR$(255);
Send
default
character
to
it
58

Table of Contents

Other manuals for Commodore 1581

Related product manuals