Conversely BASIC programs can be exported by simply listing them to the printer with LLIST and then copying the output seen in the Printer → Printer... window. Or for very short files a File → Copy of what is on the screen will suffice.
The File → Load... menu entry can load a program file into memory. Most of the TRS-80's have either a DUMP or SAVEM command you could use to subsequently save the program to diskette. However, you'll need to know where the file loads into memory and the execution address if it ia a program file.
For exporting binary data keep the Record -> RAM command in mind. A LOAD PROG/CMD or LOADM can bring a file into memory which can then be extracted from the saved copy of RAM.
Another approach is to use some kind of file transfer program in the emulator that can send or receive files over the RS-232. Since the RS-232 can be hooked to a TCP/IP connection it should be possible to get some kind of utility than can speak xmodem or the kermit protocol or what have you. Or even something of your own devising.
These may not be the most desirable approaches but I mention them as they can be surpisingly handy. Pasting in a basic program from your PC editor and then capturing local edits with LLIST is a fairly decent if somewhat hand-crank development environment. Or sometimes you just need to get something in once to bootstrap a more powerful technique. And some of the tedium can be automated with trs80gp's automatic input facilities.
The built-in utilities floppy has IMPORT2 and EXPORT2 commands to bring files into and out of the emulator. They use the FreHD emulation so trs80gp must be run with the -frehd option for them to work or activated by the Hard Drive → FreHD menu. Otherwise they will say No FreHD attached and exit. Most Model II operating systems will require the hard drive controller to be disabled (-hx) for the utilities to function.
IMPORT2 reads a file from the host computer and writes it to a TRS-80 disk file.
Usage: IMPORT2 [-lnepvr] hostfile [trs80file]
If the
Options:
EXPORT2 reads a file from the TRS-80 and writes it to the host computer.
Usage: EXPORT2 [-lner] trs80file [hostfile]
If the hostfile parameter is omitted the trs80file is used with '/' changed to '.'.
Options:
IMPORT2 and EXPORT2 are my modified versions of Frederic Vecoven's modified version of Timothy Mann's originals. VHDUTL is a modified version of Frederic Vecoven's original. My main change was to add support for the Model II operating systems. Note that although there is a utility floppy image for each DOS and model the executables are all identical. The copies are only required because of their incompatible file systems and floppies. The executables themselves detect the DOS they are run under and use the correct system calls.
Except for the Model II they should work on a real machine with a FreHD hard drive emulator. I have not tested this.
For bulk import and export I recommend either creating a /JCL (batch/script file) containing all the commands or using the -i options to have trs80gp do all the typing. There are also command line and GUI utilities to read and write files for many TRS-80 floppy image formats. I recommend the graphical TRSTools utility or the command line trsread & trswrite utilities. Neither have any support for the Model II which was the primary motivation to add IMPORT2 and EXPORT2 to trs80gp.
Normally they are exported and imported as text files in the standard TRS-80 format with carriage return (character 13) terminated lines. It appears that these variable length record files are primarily used for program source code with each record holding a single line.
When they are exported in raw format each record is preceeded by a length byte which gives the size of the record including the length byte. A length byte of 1 will have no following data. A length of 44 will be followed by 43 bytes of data. A length of 0 is followed by 255 bytes of data.
There is also the xfile utility. It can read (but not write) Xenix hard drive images. Once trs80gp has been shut down xfile can list or extact files directly from the hard drive image file.
For truly massive file import and export there is a technique where tar archives can be placed into hard drive images. Credit to John Elliott IV for the technique and these instructions on how to do it.
Make a copy of your root filesystem DSK (both the DSK & CFG). Name it something else like scratch.dsk and scratch.cfg. Launch trs80gp, and use the Hard Drive menu to mount the new image on a free drive. On my system, I have HD0 as root and HD1 as /home, so I mount on HD2. On the emulator’s Hard Drive menu, that’s root on :4, home on :5, and ‘scratch’ my extra drive on :6.
Boot XENIX & login. su to root.
To bring files in, on your host system you create a tar file with the items you wish to import. Next, on your host system, you run this command:
dd if=my-stuff.tar of=/path-to/scratch.DSK obs=512 seek=34
What that does is skip the boot tracks on the HD image and write the tar file to the data portion of the HD image. On your XENIX system, just run tar xvf /dev/hd2. You’ll see the files extracted that you tar’d up on your host system.
To transfer files OUT of the emulator, create a tar file on /tmp or wherever. Next, DD the tar file to /dev/hd2 (in my case, or wherever your ‘scratch’ drive is). So, for example, let’s say I want to get something out of my source directory:
% su – Password: # cd /home/iv/src # tar cvf /tmp/vim-4.5.tar vim-4.5 [tar outputs stuff] # dd if=/tmp/vim-4.5.tar of=/dev/hd2 obs=512 iiii blocks in oooo blocks outNow, you may be wondering why not tar directly to HD2? The reason is, to extract on the host system side we need the exact number of 512 blocks, and dd gives that to us, the oooo before blocks out.
Next, on your host system, extract your tar file with dd:
% dd if=scratch.DSK of=/tmp/vim-4.5.tar ibs=512 skip=34 count=ooooVoila, you have fast in and out. The only limit is the size of the scratch HD image you’re using. Well, that and the free space wherever you’re going to extract it.