# Managing files on your picomite.

Now that the picomite supports a flash drive, the options for storing and transferring files between the picomite and your PC have changed.
We have 5 flash memory “Slots” plus the current program. These are all available to store bas programs but not usually data.
We have the flash drive which acts the same as an SDcard drive, storing programs and data. The size of this drive depends on the size of the flash memory chip on your module.
The third storage is an optional SD card drive.

If you need to move a lot of files and have the SDcard, the simplest way is to remove the SDcard from the picomite and place it in your PC. This is not always convenient.
Once the files are on your SDcard, they can be transferred to the flash drive using COPY B2A …

Using MMEdit’s file manager is another option.

Start MMCC and connect to your picomite.
Make sure that you have picomite or picoVGA selected as the device type. This tells MMCC what commands to use.
Select File Manager form the Mode menu to open the file manager window.
If you have a large number of files, it will take a few seconds for the picomite files to appear.

Here we are connected to a picomite with the SDcard fitted. If there is no SDcard, drive A: (the flash drive) will be listed. The file manager will open with the currently active drive selected.
You can switch to drive A: using the button. It will change to B: if you are currently displaying drive A:

If you don’t have a drive B: (SDcard), the B: button will do nothing.

You can transfer files between the two drives by selecting the files and pressing on "Copy to A:/B:". Multiple files can be selected.
The files will be copied to the current folder on the target drive.

To copy between your PC and the picomite, select the target drive and folder then select the files to transfer the press ">>>" or "<<<" to copy between devices.

When you copy between the two drives on the picomite, the COPY command is used, resulting in a true copy.

When you copy between the PC and the picomite, XMODEM is used, resulting in some padding with chr$(0) on the end of the file. These extra zeros don’t have any detrimental effect on BAS or BMP files. Other files may need some checking when using them in your programs. See below for a solution.

The right-hand button labelled “Memory”, switches the picomite listing to show the current program and 5 program slots. The button changes to “SDcard”

To copy a program from the PC to any of these locations, select the file on the PC and initiate a transfer using ">>>". You will be prompted to select your target location. AUTOSAVE will be used to load the program into the picomite. If you select one of the ‘slots’, the program will first be transferred to main program memory before being copied to the selected slot. It is not possible to transfer directly to a slot.

Copying from the picomite slots to the PC uses LIST ALL and that does allow you to bypass the main program memory. You will be prompted for a file name.

From either the program slot memory or drive locations, pressing “Edit” will transfer a copy of the file to the PC before opening it in MMEdit.

To transfer the current active program in MMEdit, simply press the “Load and Run” button (Far right on the MMEdit toolbar). The program will be sent to the main program memory using AUTOSAVE.

"Load" will load the selected file into main program memory.

Trimming the trailing zero bytes from files transferred with XMODEM.

After transferring file to the picomite, run this program. It will trim any trailing zero or ^Z bytes from files that it considers safe to modify.
The program will not trim image files etc. The file types that are trimmed are listed in line 5:

DIM safefile$= " bas py html htm txt csv log "

The full program:

' XMODEM trim by TassyJim 23 Feb 23
OPTION EXPLICIT
OPTION DEFAULT INTEGER
DIM f$, tfile$ = "tempfile.txt"
DIM safefile$= " bas py html htm txt csv log "
DIM filetype$, packet$
DIM INTEGER n, k, fsize, blocks
f$ = DIR$("*",FILE)
DO WHILE f$ <> ""
'print f$
filetype$ = FIELD$(f$,2,".")
'print f$, filetype$
IF INSTR(safefile$,filetype$) THEN
fsize = MM.INFO(FILESIZE f$)
IF fsize MOD 128 = 0 THEN
blocks = fsize/128
OPEN tfile$ FOR output AS #2
OPEN f$ FOR INPUT AS #3
FOR n = 1 TO blocks-1
packet$ = INPUT$(128,#3)
PRINT #2, packet$;
NEXT n
packet$ = INPUT$(128,#3)
CLOSE #3
FOR k = LEN(packet$) TO 1 STEP -1
IF MID$(packet$,k,1) <> CHR$(0) AND MID$(packet$,k,1) <> CHR$(26) THEN
EXIT FOR
ENDIF
NEXT k
packet$ = LEFT$(packet$, k)
PRINT #2, packet$;
CLOSE #2
KILL f$
RENAME tfile$ AS f$
PRINT f$, fsize, MM.INFO(filesize f$)
ENDIF
ENDIF
f$ = DIR$()
LOOP
The program may stop after trimming 5 files so you should re-run the program until it reports no files trimmed.
Trimming files when they are transferred to the PC is handled by MMEdit. MMEdit will trim "safe" files and trim other files to the same size as reported by the 'mite.

Last edited: 06 March, 2023