EasyManua.ls Logo

Tandy TRS-80 - Page 61

Tandy TRS-80
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...
THIMMING
THE
FAT
OUT OF
DIRECT
ACCESS
f
Jfi€JUM*U*Utf'
off
/
%
bFF!C£/DAT"
record 1
S
APER
1
*office:/dat
Coda,
^&tr/6
MKN$
converts
a
number
to
a coded
string.
Regardless
of
how
long
the
number
is, MKN$
will
always
convert
it
to a string
that
is five
bytes
long.
For example,
change
line
30 to
LSET
a
number
with
more
than five
digits:
30
LSET A$ =
MKN$(12345G7B9)
Erase
memory,
KILL
"OFFICE/DAT,"
and
type
and RUN
the program.
This
is
what
it
stores
in
your disk
file:
I
^CfcflCE/mT
9
'
To read
this
program
in,
you
need
to
decode
the
string.
LOAD
the
"Fielded
INPUT
Program"
and
make
these
changes
to
it:
10
OPEN "D"
,
#1
,
"OFFICE/DAT"
,
10
20 FIELD
*i
,
5 AS A*
, 5
AS
B$
50 PRINT
"RECORD"
R
"
:
" ;
CYN(A$)i
B$
and
RUN it .
.
.
CVN
(in line
50)
decodes
A$
to
the
number
it
represents.
Note:
The
Computer
only
sees
the
first
9 digits
of
a
number.
It rounds
the rent
off.
PROGRAMMING
EXERCISE
#0.3
Write
a
fielded
direct
access
pro-
gram
which
will
store the
popula-
tions
of all
the
countries.
Make
each
record
contain
15
bytes
with
these
two
fields:
1.
country
10
bytes
2.
population
5
bytes
WBPI^^^H^BOWi^PBBB
--—
5
Jswbu
Ofdc
j*v
/23f56>7&7
"OFFICE/
OfiT"
PROGRAMMING
EXERCISE
#9.4
Write
a
program
which
will
input
the
Hie you
created
in
Exercise
#9.3.
CHAPTER
CHECKPOINT
1. If
you do
not
specify
the record
length,
how
many
bytes
will
each
record
contain?
2.
Why
must
you
include
a FIELD
line
when
you LSET
your
data?
3.
Howmanybytes
will
MKN$
convert
a num-
ber
into?
51

Related product manuals