EasyManua.ls Logo

Commodore 2031 - LOADING THE DOS SUPPORT PROGRAM

Commodore 2031
98 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...
The following program illustrates the feature which permits access to individual
bytes within a record:
110 DOPEN#1,”FILE1”,D0
120 GOSUB 900
130 RECORD#1,25,1
140 GOSUB 900
150 PRINT#1,”FIELD 1”
160 GOSUB 900
170 RECORD#1,25,10
180 GOSUB 900
190 PRINT#1,”FIELD 2”
200 GOSUB 900
210 RECORD#1,25,30
220 GOSUB 900
230 PRINT#1,”FIELD 3”
240 GOSUB 900
250 DCLOSE#1
260 END
900 IF DS<20 THEN RETURN
910 PRINT DS$
920 STOP
Lines 130, 170, and 210 cause the file pointer to be moved to different places
within record number 25. The following illustration is a representation of the
contents of record number 25 after the above example is executed:
1 2 3 4 5
12345678901234567890123456789012345678901234567890
--------------------------------------------------
FIELD 1* FIELD 2* FIELD 3*
--------------------------------------------------
Where * represents a carriage return (CHR$(13)).
NOTE
It is important that the fields are written in order
because writing to a byte at the beginning of the
record flushes the rest of the record in memory. This
means that while it is possible to position and write
first to byte 1 and then to byte 20, it is NOT possible
to first write byte 20 and then byte 1.
Since the carriage return is recognized as a terminator by the BASIC INPUT
statement, the data may be retrieved by the following sequence:
67

Table of Contents

Other manuals for Commodore 2031

Related product manuals