Persistor Instruments Card Or Disk Operating System

For Persistor CF8 and Tattletale Model 8


Software Manual

February 2002 - Revision 13



One trillionth of DOS? No, don't let the name fool you. As you'll see, the Persistor Instruments Card Or Disk Operating System actually comes quite close to replicating most of the functionality of a "real" DOS, but embedded in your little data logger or controller. The PicoDOS kernel and command shell provides you with transparent access to DOS compatible file functions at both the programmer and user interface levels.


What's Here

The version of PicoDOS described in this manual targets Onset Computer's Tattletale Model 8, a 2" x 3" 68332 powered single board computer, mated with Peripheral Issues' Persistor CF8 CompactFlash memory expansion system.

In this document you'll find out how to setup and install PicoDOS, descriptions of the commands and parameter syntax for the PicoDOS command shell, and details on the C and TxBASIC programming interface.


PicoDOS Features


PicoDOS In Action

PicoDOS was developed to solve the two main problems that probably prompted you to buy the Persistor product in the first place: Getting data onto non-volatile storage media (data logging), and getting it back off (recovery and analysis). For the most part, if you've worked with files on a DOS machine, then you already know how to work the CompactFlash in a Persistor. In addition, and again for the most part, the files on the CompactFlash are transportable in both directions between PC Card equipped desktop/laptop computers and the CF8.

We've provided a couple of examples to show how simple it is to update your logger/controller to take advantage of high capacity, non-volatile storage. Have you run the logger.c example that ships with the Model 8 software? Take a look at our modified logcf8.c project that adds 9 lines of new code to convert from a RAM based logger storing 100,000 samples, to a non-volatile logger storing up to 12 million samples.

Remember the adventure game "Zork"? It feeds from a 133KB database file and is based on C source consisting of over 35 source files that are now in the public domain. We've included this as an example to stress test PicoDOS-and because we like to brag that it took only three new lines of code to compile and run this under PicoDOS!

You probably didn't buy a Persistor to build games, and though you may use it to update legacy applications, the real benefits to this product will come as you rethink your logger and controller applications in the context of the new capabilities added by the Persistor and PicoDOS.



About Peripheral Issues

Peripheral Issues formed in 1995 to develop and market quality components for the embedded computing market. At Pii, we produce the development tools, software libraries, and hardware components that allow our customers to reduce design costs, increase quality, and help meet ever-shortening time-to-market objectives.

In addition to Persistor CF8, other Peripheral Issues products include:

Crossbow, a cross-assembler and integrated development environment for the Macintosh. Crossbow features macro, conditional, and sectioned assembly, Intel, Motorola, and PIC object formats, local labels and includes, listings and symbol tables, programmers editor with multi-file and GREP search, terminal windows for test and debugging, and built-in support for most of the popular 8-bit microcontrollers.

MotoCross, a suite of utilities that transforms the native Metrowerks CodeWarrior C/C++ Compilers into powerful integrated development environments for embedded 68000 based microcontrollers. Using MotoCross, you can write and test code for embedded processors with the same speed and convenience you've become accustomed to in native code development.


Installing PicoDOS

Installation Files: For both diskette and ftp installation, read the first part of the PicoDOS release notes. This is the blue sheet that comes with your order, and also the download page you pulled your ftp files from. It will tell you how to get the various files into the proper directories.

PicoDOS installs into high flash on your model 8 from a special installer application that loads and runs from the TOM8 monitor. The installer is an interactive runnable hex file that knows how to burn the PicoDOS kernel portion of itself into high flash. The installer will have a name something like PD8Rnnnr.RHX, where "nnn" is the version number and "r" is the optional release number.

For C development: From CrossCut or MotoCross, load PD8Rnnnr.RHX using the same menu commands and procedures used to load ".RHX" files generated by your compiler. When the load completes, type 'G' <return> just as you would to test a ram based application.

The installer will identify itself, and ask if you want to install PicoDOS. Reply 'Y' <return>, then the installer will ask if you would like to autoboot to PicoDOS, and, for simplicity, reply 'Y' <return> to all of the installer prompts. On completion, it will reset the Model 8 and should start up running PicoDOS. If for some reason you choose not to autoboot to PicoDOS, you can type 'G 2BCF8' to test drive PicoDOS. Just remember "To Be CF8". Ahead, we'll explain how to autoboot to PicoDOS.

For TxBASIC development: To use Persistors with TxBASIC, you first need to install a new version of TxBASIC with the proper CF8 extensions. Actually, the load order is not critical, but following the proscribed sequence will make first time installation much easier. Below are very abbreviated instructions for loading TxBASIC from TxTools. Refer to 2-30 of the TxBASIC manual if these aren't perfectly clear.

Install the PicoDOS extended version of TxBASIC from TxTools with the TOM8> monitor prompt showing in the terminal window. Type "LO" <enter>, then use the "CommPort" menu, "Send File ASCII...", and select the file "TXBCF8.AHX". Reply 'Y' to the burn confirmation prompt when the load completes. Reset the TT8, which will automatically put you in TxBASIC, and you'll see the TxB# prompt. For now, ignore any "PicoDOS initialization failed" warnings.

Get back to the TOM8> prompt by typing CTRL-X and replying yes to the prompt. Use the same technique above to load PD8Rnnnr.RHX (it ends up in a different portion of flash). When the load completes, type 'G' <return>.

The installer will identify itself, and ask if you want to install PicoDOS. Reply 'Y' <return>, then the installer will ask if you would like to autoboot to PicoDOS, and you should choose 'N' <return> as you will want TxBASIC to automatically run at startup. You can tell if you're running a version of TxBASIC with Persistor extensions from the "TxCF8#" prompt which takes the place of the standard "TxB#" prompt.

| PicoDOS  1.35   Persistor CF8#0172 |
| (C) 1996-1997    Peripheral Issues |
|    Cape Cod, MA USA |

Installation Woes...

There shouldn't be any, but there's a chance you might see...

No Persistor hardware found, most features disabled

If there's no Persistor attached, or if there are hardware problems with the Persistor such that it's unrecognizable to the software, you'll get the previous message. You can still access the TOM8 functions, and the high-speed downloads if you're running MotoCross, but all of the CompactFlash related commands will be disabled. If you see this, and there is a CF8 attached, check the connections, then give us a call.

Unlikely yet possible, you might see...

No media detected, most features disabled

This just means there's no CompactFlash card in the Persistor, so there's not a whole lot for PicoDOS to do. You might want to try the CCC command, which stands for cooperative card change. Even though the Persistor CF8 doesn't support hot swapping, it seems to survive a card change when the Model 8 bus is idle and the system is in LPSTOP. After typing "CCC" <return>, attempt the change, then hit any key to continue. If it works, you'll be able to access the card, if it fails, you'll probably end up back in the TOM8 monitor.

Extremely unlikely at this stage, but still possible, you may see...

nothing or anything!

But only if the CompactFlash card you've installed has an "autoexec.bat", which PicoDOS is going to try to execute at startup. If that's the case, you can inhibit this automatic execution the same way you stop the TOM8 from running a program burned into flash - by grounding the digital I/O line called IRQ3 (pin A5 on the IO-8, or pin 61 of the SquishyBus).

PicoDOS Command Shell

The PicoDOS command shell does several things. First, and foremost, it provides command handlers for common DOS directory manipulation functions. In addition, it provides facilities to move files back and forth between a host computer through a serial link, and acts as a launch pad to run applications and batch files direct from the CompactFlash. You also get functional equivalents for all of the standard TOM8 monitor commands. Finally, it provides the low level file services required by your running applications.

The command shell and PicoDOS kernel live at the top of flash and take away about 82KB of flash and 28KB of high RAM, leaving about 170KB flash and 220KB RAM for your applications use. If that seems like too much, remember, you'll get this back-and more-with the new ability to chain to programs on the CompactFlash, and maybe some of those giant tables you have coded into static data structures are candidates to become disk files that load to RAM at runtime.

You give a little, you get a lot. For example, with PicoDOS, you can break up that huge monolithic program into separate modules for setup-interacting with a user and storing run-time parameters to a disk file, for acquisition-using the disk file parameters to control the sampling, and for recovery-possibly to attempt some on the fly data compression.

For existing programs that do not reach into the top of flash (you'd know because they wouldn't load with the earlier TOM8's), and that do not make calls to PicoDOS (they couldn't 'cause it didn't exist!), the presence of PicoDOS in flash will have absolutely no effect. As described ahead, you must initialize PicoDOS with a call to InitCF8() to activate the kernel, and even then, it does nothing between calls for service.

For new or updated programs that wish to take advantage of PicoDOS services, nothing really changes in the makefiles or build processes you've been working with. The mechanics of PicoDOS are encapsulated in tiny inline functions defined in <PicoDCF8.h> and dispatched through inline TRAP12 instructions-all of which you can blissfully ignore as you'll be programming file operations at a much higher level using the standard C library functions.

The following information is provided for the insatiably curious, and for those folks who might be poking into undocumented reserved RAM areas or actually using 68000 TRAP 12 instructions. If that's not you, you can safely skip ahead to the next section.

Flash Memory Map
  000000 - 0017FF    TOM8 Monitor
  001800 - 001FFF    Custom TPU Code
  002000 - 02BCF7    Your flash application
  02BCF8 - 03FFFF    PicoDOS kernel
RAM Memory Map
  2C0000 - 2C1FFF    Application stack
  2C2000 - 2F7FFF    Application code [ram'd] followed by heap
  2F8000 - 2FEFFF    PicoDOS
  2FF000 - 2FFBFF    -- unknown --
  2FFC00 - 2FFFFF    Vector Base (PicoDOS @ TRAP12:2FFCB0)

TOM8 Emulation Commands

The PicoDOS command shell does not replace the TOM8 monitor-it continues to live at the base of flash, and you can always get back to the TOM8 from the command shell by typing "TOM8", from your applications with the ResetToMon() function, and from hardware by grounding IRQ3 at reset or power up.

The command shell does however replicate all of the TOM8 functions so that you can conveniently autoboot to PicoDOS and still continue to use the same tools you're used to without having to swap back and forth between PicoDOS and the TOM8 monitor and without having to make any changes to your makefiles or build utilities. The TOM8 commands include the following.

?    ?
G    g [address]
GO   go [address]
LO   lo [ofs][;Bx[+]][;G]
MD   md [address]
MM   mm [address]


DOS Emulation Commands

To minimize your learning curve, and wherever possible, the PicoDOS shell commands mimic the syntax and behavior of their DOS counterparts. If you're not sure about a command, make a guess and try it (well, maybe not era!). These standard DOS commands and their usage are summarized below.

COPY    copy source destination
DATE    date
DEL     del filename
DIR     dir [wildcards]
ERASE   erase filename
FORMAT  format [/Q][/E][/F]
TIME    time
TYPE    type filename
REN     oldname newname
VER     ver

Unlike DOS, and with the exception of the DIR command, all of the filename specifications must be complete unambiguous filenames without a drive letter (no "A:"). To erase all of the files, you have to either manually work through all the files, or re-FORMAT the card. The DATE and TIME commands both invoke the same handler and are a bit different from their DOS namesakes, but they are compatible with CrossCut and MotoCross, and get the time and date into the Model 8.

FORMAT - Format a CompactFlash card
Format with no optional switches prepares the partition, boot, and directory sectors for DOS compatibility. In doing so, it effectively gives you a clean slate from which to begin recording, but it does not actually erase the data sectors themselves.

The /E switch forces PicoDOS to clear every sector to all FF's. This puts additional wear and tear on the card, but it does guarantee that on a catastrophic failure, any data on the card was put there after the last format. The The /Q switch tells PicoDOS to be quiet during the format (no messages). The /F switch puts the card into high current mode for the duration of the format to speed up the operation. This is most useful when used in conjunction with the /E switch.



File Transfer Commands

Though you can directly transfer files between the CompactFlash cards and a DOS computer with PC Card slots using the PC Card adapter, it's sometime more convenient to just transfer the files serially. The PicoDOS command shell supports XMODEM (128, 1K, and CRC) and YMODEM (including batch) file transfers in both directions, and at rates up to 230,400 baud.

BAUD     baud [newrate [/Q]] 
CCC      ccc
CAPTURE  filename [delim] [/N]
DUMP     filename [startofs[,endofs]]
SAVE     filename [startaddr, endaddr]
XS       xs [/Q] [/X] [/C] filename
XR       xr [/Q] [/X] [/C] [filename]
YS       ys [/Q] [/G] filename [,file2...]
YR       yr [/Q] [/G]

BAUD - Change the baud rate
When you request a new baud rate, PicoDOS prompts you to change your host baud rate then hit a key to continue. The Model 8 can handle any standard rate from 75 to 230,400, though most PC's can only go up to 115,200. PicoDOS always reverts back to 9600 baud at reset, though you can make an autoexec.bat file entry to force any other rate at startup. Typing baud by itself displays the current baud rate which is rarely exactly what you specified, instead being the actual closest baud rate the hardware can produce.

If you specify the optional quiet flag (-Q or /Q), there will be no messages or prompts. This is primarily for use in batch files where interaction may not be desirable.

CCC - Cooperative Card Change
The CCC command puts the Model 8 into LPSTOP mode until the next keystroke. In this mode, it may be possible to remove or insert a CompactFlash card without bombing the Model 8. No guarantees, but it usually works for us, and you may also find this convenient.

Beginning with PicoDOS 1.34, the CCC command was extended to support multiple stacked Persistors by specifying an optional chip select argument of 1, 2 or 10 corresponding to the jumper selection on the Persistor, and like the Persistor, it defaults to CS2. This is also available from within your programs using the execstr() function, and you can use the optional /Q (quiet) flag to skip the prompts and messages.

The CAPTURE command copies everything coming in from the serial port into RAM until you send a break character (the default), or until it sees the specified delimiter (use 3 for CTRL-C). It then copies the whole thing to the filename you specified. It buffers into RAM from 2C2000 to 2F800 which gives you about 250KB to work with.

Using TYPE with CAPTURE is a convenient way to edit small batch files with most modern terminal programs (like CrossCut or MotoCross). TYPE the current file from PicoDOS, select and copy the text from your terminal program, paste into an editor and make the changes, select and copy again, the paste the update back after issuing the CAPTURE command. It's actually easier than it reads.

The option /N switch causes capture to append linefeed characters '\n' to incoming carriage returns '\r'. If your captures don't display correctly when you TYPE them back, try using this switch.

The SAVE command command copies a block of memory from the Model 8 to a file on the CompactFlash. This could be used to capture the results of a RAM logging session, but is more likely used to move programs loaded into RAM onto the CompactFlash for later execution. If no start and end address parameters are provided, SAVE uses the information from the last LO command (or from MotoCross high speed loads) to get the address range. Do not run a program in RAM prior to saving it. It may work, but you should expect some bizarre results. You can run the program immediately after saving if you like.

DUMP - Dump file in Hex and ASCII
The DUMP command displays the contents of the specified file as lines of hexadecimal numbers followed by the mating ASCII characters (where valid). You can also specify an optional starting and ending offset into the file where display should begin and end.

XS and XR
The XS (XMODEM Send) and XR (XMODEM Receive) both initiate an XMODEM session at the Model 8 end, and it's expected you will take the appropriate action at the host computer end. Both of these implement a smart XMODEM protocol hunt and should synchronize with hosts that support original 128 byte block XMODEM, CRC, and 1k XMODEM. You can force them to first try original XMODEM with the -X or /X option, or XMODEM 128CRC with the -C or /C option.

If you don't specify a filename, the XR command names the incoming file "RECEIVE.NNN" where NNN is the next available extension number. What the host does with the XS command filename will vary from machine to machine. Crosscut prompts you for a destination filename.

YS and YR
The YS and YR commands are similar to the XS and XR commands, but they support batch file transfers with automatic file naming using the more modern YMODEM protocol. This is the preferred protocol if supported by your host (sorry, Crosscut doesn't talk YMODEM) for speed and convenience. YS and YR default to normal YMODEM batch, but can be forced to YMODEMG (no error checking/recovery) with the -G or /G option. -Q inhibits the routines from emitting messages.


Behavior Control Commands

The remaining PicoDOS commands allow you to save and run Model 8 programs stored on CompactFlash or otherwise control Model 8 execution.

BOOT    boot [P...] [T...]
RESET   reset
TOM8    tom8

The BOOT command with no arguments displays the current bootup operation which will be either to the TOM8 monitor, to PicoDOS, or ??? for some unknown application currently in flash. Specifying 'P' as the first command character inserts a tiny jump program into flash at location 0x2000 which tricks the TOM8 into automatically running PicoDOS at power up or reset. Use this when you get tired of typing "G 2BCF8". You can clear this by typing "BOOT TOM8" at the PicoDOS prompt. The boot to PicoDOS automatically gets cleared when you load your own application into flash.

The RESET command causes a complete system reset, which will either enter the TOM8, run an application in RAM, or put you back into PicoDOS, depending on the current environment. This is the same a calling Reset() from inside your application.

The TOM8 command forces execution back to the TOM8 monitor, whether or not there's an application burned in flash, and independent of the BOOT setting. This is the same a calling ResetToMon() from inside your application.


Running Command Files

Like DOS, PicoDOS allows you to load and run applications stored on the CompactFlash which have the filename extension ".RUN". The .RUN files we use, are the same ".RUN" files created by MotoCross or the Aztec compiler when you use the standard Onset makefile templates (the .RUN files are the .RHX files before being expanded to HEX format).

You can get ".RUN" files to the CompactFlash by using the standard CrossCut or MotoCross methods to load a RAM application, but type "SAVE filename.RUN" <return> instead of "G" ( MotoCross users will have to backspace first). If you did this with a built version of the logger.c example, and saved it to "LOGGER.RUN", you can just type LOGGER<return> and you'll be running the logger example. You can also transfer existing ".RUN" files to the CompactFlash using XR and Crosscut (or YR and something else), then SAVE the load with the extension ".RUN".

Older applications designed for the Model 8 had no way of knowing they'd be running under an operating system, so they couldn't take advantage of any OS facilities. Your new programs can. When you run a command program from PicoDOS, you can specify arguments just as you would on a PC, and newer programs can access these from the argc and argv variables in the main() function. Similarly, when you chain to a new command program using the execstr() function, you can pass a command string that gets parsed into the argument variables.


Running BATCH Files

Also like DOS, PicoDOS allows you to automate some processes by running batch files, which are text files containing valid PicoDOS commands, and which have the filename extension ".BAT". Our batch file processor does not support variables, looping or conditionals and there are no environment variables for the system to work with.

The file "AUTOEXEC.BAT", if present, will load and execute immediately upon entering the PicoDOS command shell. This is a convenient way to automatically run an application at startup.


PicoDOS C Programming

Remember at the beginning we said it only took four lines of additional code to adapt a large disk intensive game program to use the Persistor? Well actually, only two of those lines relate to the PicoDOS, the other two specified the database filename and did the standard InitTT8() call.

For the same reason it took only two lines to adapt that program, it'll be the same two lines to adapt you to programming with the Persistor. Almost all of your interfacing will be through the standard C library function calls documented (among other places) in the ANSI C version of The C Programming Language by Kernighan and Ritchie. In fact, though we provide an API for accessing command line options and chaining to other applications, there are no other lower level file access interfaces provided with PicoDOS.


#include <PicoDCF8.h>

This is where all the action takes place - most of which you can safely ignore. Near the top are an inline function and three C macros that you'll be using in the main() function of your PicoDOS aware applications.

#define CF8StdCS       2        // defaults to CS2
#define CF8StdAddr     0x800000 // gotta be somewhere
#define InitCF8(cs,ad) \...

The macro CF8StdCS just specifies the chip select used for the Persistor CF8. This is hard wired to CS2, but can be changed with a cut and jump as described in the Persistor Hardware Manual. The second macro, CF8StdAddr, just tells the CF8 where it lives in memory. This location seemed as good as any, but you can move it around if it conflicts with your custom hardware.

If you're interested, the InitCF8 macro first invoke the inline function initpd(). If you were to disassemble this, you'd see that it first sniffs around in high flash where PicoDOS is known to hang out, and on finding it, knows where to go to have the TRAP12 handler installed. The next calls to initcf() and initfs() use the newly installed TRAP mechanism to do their respective jobs of initializing the Persistor and initializing the file system.

InitCF8(CF8StdCS, CF8StdAddr);

This is the line of code you need to add to your main() function to enable PicoDOS services. It must immediately follow your call to InitTT8(), which as you recall, must be the first executable statement in your main() function. Typically, your main() function will begin like this:

  // local variable declarations ...
  InitTT8(NO_WATCHDOG, TT8_TPU); // setup Model 8
  InitCF8(CF8StdCS, CF8StdAddr); // always follows the InitTT8() call
  if (errno != 0) // look out for No Hardware (100) or No Media (101)
  printf("\n\n!!! InitCF8 failed, error %d !!!\n\n", errno);
  if (errno == -1 || errno == PiDosNoHardware) // no PicoDOS/Persistor !
  Reset(); // any future PicoDOS calls would crash the TT8

Smart programmers will check the global variable errno to make sure that initialization succeeded before launching into the application code, but barring some hardware problem, your Tattletale is now prepared to use the entire standard C library file functions. If the call to InitCF8 returns -1 (no PicoDOS found in high flash) or the constant PiDosNoHardware (defined in <PicoDCF8.h>), you must not attempt further PicoDOS calls since there is nothing at the receiving end to handle them and your program will crash with an exception error. If the call returns PiDosNoMedia, there's no card in the Persistor, and you'll be limited to functions that can operate without a card (like some of the execstr() commands).


argc = initargs(&argv);

Now that your program is PicoDOS aware, you may want to take advantage of the ability to receive,and even pass on, command line arguments. Since PicoDOS wants to coexist with non-PicoDOS and legacy applications, you must perform an additional step you don't normally see in PC hosted programs.

At the point of entry, argc will be equal to one and argv[0] will point to some harmless but meaningless short string. To get the command line values, add this initargs line before you access the argc or argv parameters (but after calling InitCF8()):

After that, you can treat the arguments just as you would in any C program. One of the standard PicoDOS example programs, called TestArgs, demonstrates how to use this capability. You can compile and run it directly, but it's most informative if you load it and save it to the card as a runnable ( file. From the PicoDOS prompt, you can then type "testargs", followed by some parameters, and it will show you how it receives and interprets the parameters.


short pdcfinfo(char *drive, long *size, long *avail);

This call returns the size of the CompactFlash card, and the amount of free space remaining. Pass the string "A:" for the drive parameter, and pointers to longs to hold the size (max) of the card and the free space available. You should be aware that this call can take several hundred milliseconds before it returns.

long    cfsize, cffree;
pdcfinfo("A:", &cfsize, &cffree);

int execstr(char *cmdline);

To make up for the flash we take away to host the PicoDOS kernel, we provide the execstr() function to allow you to chain to other command programs on the CompactFlash. Usually, you can ignore the return value, since it's not supposed to return. If it does, the requested program never ran, and you can take a look at the returned error code for a clue as to why. The following C statement runs the TESTARGS.RUN program to show off.

err = execstr("TESTARGS -p100 -f988 blah.bla");

Obviously you don't have to feed in string constants and could vector control from a lookup table or even direct or remote user input.


char *picodosver(void);

This call returns a string defining the PicoDOS target, serial number, and version number in the form "TTT#SSSS-V.RR", where TTT is the Persistor type (CF8), SSSS is the serial number, V is the PicoDOS version, and RR is the current release. Note that beta releases of PicoDOS may have a single character appended to the release number. This current version of PicoDOS for Persistor CF8 serial number 124 would be: "CF8#0124-1.33".


void ResetToPicoDOS (void);

This call simply jumps to PicoDOS (0x2BCF8) as a way to get back to PicoDOS from an application burned in flash. Be aware this could fail if you've installed custom interrupts.





PicoDOS TxBASIC Programming

The Persistor compatible version of TxBASIC adds several new extensions to expand your Model 8's data storage repertoire. As with all TxBASIC extensions, the PicoDOS extensions must be defined near the top of your program with the following statement, and also like all TxBASIC extensions, upper and lower case is significant.

	extension CFSize, CFAvail, CFSave, CFRead, CFExec

CFAvail ()

This extension tells you the total free space in bytes of the installed CompactFlash card. It returns the same negative error codes as for CFSize() below.

CFSize ()

This extension tells you the total capacity in bytes of the installed CompactFlash card. If there is no Persistor attached, no PicoDOS installed, or no CompactFlash inserted it returns the following negative error codes:

-1 Command failed
-2 No PicoDOS installed in high flash
-3 No Persistor attached
-4 No CompactFlash card inserted
-5 Undefined initialization error


CFSave (filename [,length [,dfofs [,append]]])

This extension saves all or part of the DATAFILE to a new or existing file on the CompactFlash card.

filename is a string constant or string variable that must conform to DOS 8.3 file naming conventions, where 8.3 refers to a maximum of eight characters for the first part of the name, and a maximum of three characters for the filename extension, and the period separating the two. Examples of valid filenames are: "test.dat", "temp", "data.0". The special filename "?" will cause CFSave to generate a unique new name so that you don't have deal with that in your program.

length is an optional argument that can specify a byte count less than or equal to DFMAX, which is the default and is equal to the size of the datafile. If length is less than zero, or greater than DFMAX minus the start offset, CFSave will attempt to write the maximum number of bytes from offset to end.

dfofs is an optional argument that can specify a byte offset into the datafile where writing is to begin, and must be greater than or equal to zero, and less than DFMAX. If dfofs is specified, the length parameter will be shortened as needed to not write past the end of the datafile.

append is an optional flag argument that, when non-zero, tells CFSave to attempt to append to an existing file with the same name, but to create a new file, if the specified file does not yet exist.

returns the actual number of bytes transferred to the CompactFlash, or a negative error code which can be interpreted as follows:

-1 CompactFlash failed initialization
-2 Invalid filename specified
-3 Can't open the specified file
-4 Can't position to the requested offset (CFRead only)




CFRead (filename [,length [,fileofs [,dfofs]]])

This extension reads all or part of an existing CompactFlash file into the DATAFILE.

filename is a string constant or string variable that must conform to DOS 8.3 file naming conventions, as described for the CFSave command.

length is an optional argument that can specify a byte count less than or equal to DFMAX, which is the default and is equal to the size of the DFMAX minus the start offset, or the size of the file, whichever is less.

fileofs is an optional argument that can specify a byte offset into the file where reading is to begin, and which must be greater than or equal to zero.

dfofs is an optional argument that can specify a byte offset into the datafile where reading is to begin, and must be greater than or equal to zero, and less than DFMAX. If dfofs is specified, the length parameter will be shortened as needed to not read past the end of the datafile.

returns the actual number of bytes transferred from the CompactFlash, or a negative error code which can be interpreted as described for CFSave.


CFExec (command)

This extension lets you execute a PicoDOS intrinsic command as described above for the Command Shell.

command is a string constant or string variable of sixty characters or less that gets directly passed to PicoDOS.

returns zero for success, or -1 if the command failed. Note that executing a "RUN" will never return control to your TxBASIC program.




Persistor Information Resources

Persistor Instruments

Links to the most up to date Persistor information and software updates are available online from Persistor Instruments home page and ftp site at:

The Peripheral Issues staff is available to handle product inquiries and technical support questions during east coast business hours at:

508 759-6434 (Sales)
508 759-6434 (Tech Support)
508 759-6436 (Fax)


Onset Computer Corporation

Onset Computer Corporation manufactures and sells the Tattletale Model 8 and offers a complete line of data logging solutions. You can reach them at:

508 563-9000 (Sales & Support)
508 563-9477 (Fax)


Tel: 508-759-6434 Fax: 508-759-6436

Copyright (C) 1996- 2002

All products and names appearing in this document
are trademarks of their respective holders.