449
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
Reading data from a sector is a two-step process. First, you use
to
load all 264 bytes from desired sector into the currently selected RAM buffer. Next,
you use
to read the data from the selected buffer. This method
allows you to read up to 255 bytes beginning from any offset in the buffer (offsets
are counted from 0):
Dim
s
As
String
...
'we want bytes 20-29 from logical sector #3
fd.buffernum=0
'select RAM buffer #0
If
fd.getsector(3)<>PL_FD_STATUS_OK
Then
'flash failure
End
If
s=fd.getbuffer(20,10)
'now s contains desired data
Since the sector (and RAM buffer) size exceeds 255 bytes (maximum length of
string variables), you can't actually read the whole sector contents in one portion.
At least two fd.getbuffer reads are necessary for that.
To modify the data in the selected RAM buffer, use the
method. The
fd.setbuffer allows you to write new data at any offset of the selected RAM buffer.
To store the contents of the RAM buffer back to the flash memory, use the
method:
472
468
479
483