Host (PC) file system access
Here is an object to allow the P2 to read/write files on the host PC, using the 9P protocol. This code should compile with any Spin2 compiler (I have tested with flexspin and PNut). FlexProp users will be familiar with the 9P file server, as we have had access to this from C and BASIC for a long time. This object lets Spin2 users also have access.
The main object is hostfs.spin2. It is based on the Parallax flash file system, and has a very similar interface. On the P2 side you mount the file system, passing in a method that says how to communicate with the PC (samples are provided for serial communication, but in theory ethernet or some other transport could be used). Then you can open files and read/write using POSIX like calls.
On the PC side you need to run a file server. Loadp2 (which comes with flexprop) has a built in serial file server, as does my port of proploader. To use this do something like:
loadp2 -b2000000 myprogram.bin -9.
-b2000000 specifies the serial baud rate, and
-9. specifies the directory to be served to the P2.
-9. means to expose the current directory to the P2; you could also do something like
-9C:\ to give access to all of the C: drive, although that's probably not a great idea.