Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:51 25 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Picomite [Tool] SFA - Simple File Archiver

Author Message
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 06:30pm 28 Feb 2023
Copy link to clipboard 
Print this post

I have dozens of files on my Pico's flash memory and needed a backup of them on my PC with XModem. Since Epsilon's remarkable MAR didn't work for the Pico for me, I wrote a simple archive program. It creates one single file from the many files in the active directory, which can then be easily transferred to the PC. On the PC, the individual files can be extracted with a text editor (e.g. Notepad++). Later, this will be done by a separate program.


Unfortunately, I found two bugs in the Picomite firmware that took me a few hours to work around.

The first bug concerns the "DIR()" function, which seems to be affected by an "OPEN fname$ ...". This does not happen on the CMM2. I've written two bypass subroutines (ArchiveFiles_0 + ArchiveFiles_1) that work, but neither fully satisfy. The bug is demonstrated in the "ArchiveFiles_2" subprogram.

The second bug is related to the "Print#" command. It creates e.g. from >Print #1, "0.bas"< ---- >.bas<. So it omits the zero. This is not good. Here, too, the MMBasic for CMM2 works without any complaints.
My workaround for this bug is: Print #1,"%&"+"0.bas"+"&%".

Demo:
Open "testprint.txt" For output As #1
   Print #1,"%&"+"0.bas"+"&%"
   Print #1,"0.bas"
Close #1



sfa.zip

When the bugs are fixed I will upload a revised version.

Regards
Michael
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9112
Posted: 03:09pm 01 Mar 2023
Copy link to clipboard 
Print this post

  Quote  My workaround for this bug is: Print #1,"%&"+"0.bas"+"&%".


no issue for me



The second issue may be a limitation of LittleFS. Do you see the same thing if you run your program on the SDcard which is then the same as CMM2?

PS: Why not connect an SDcard and just use

COPY "*.*" to "B:/backupdir
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 04:15pm 01 Mar 2023
Copy link to clipboard 
Print this post

  matherp said  
  Quote  My workaround for this bug is: Print #1,"%&"+"0.bas"+"&%".


no issue for me


Hi Peter,
that's weird!  
Open "testprint.txt" For output As #1
   Print #1,"%&"+"0.bas"+"&%"
   Print #1,"0.bas"
   Print #1,"%&"+"1.bas"+"&%"
   Print #1,"1.bas"
Close #1


I get this with edit:
  Quote  %&0.bas&%
.bas
%&1.bas&%
1 .bas


> list"testprint.txt"
%&0.bas&%
0.bas
%&1.bas&%
1.bas


With Notepad++ (Windows)


At the moment I have no way of connecting an SD card. I just wanted you to be informed. There is a workaround, but it's not very elegant.

Thanks for looking at this issue!
Best regards
Michael
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9112
Posted: 04:25pm 01 Mar 2023
Copy link to clipboard 
Print this post

Your notepad version has been transferred with Xmodem from it loaded as a program

Use XMODEM S "testprint.txt" and it should be the same as LIST
The problem is that when you load it and edit it the file is tokenised with undefined  results
LIST just prints the ascii so is correct
Edited 2023-03-02 02:25 by matherp
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 04:47pm 01 Mar 2023
Copy link to clipboard 
Print this post

  matherp said  Your notepad version has been transferred with Xmodem from it loaded as a program

Use XMODEM S "testprint.txt" and it should be the same as LIST
The problem is that when you load it and edit it the file is tokenised with undefined  results
LIST just prints the ascii so is correct


Hi Peter, your assumption is correct. It's not a bug. Sorry! Learned something again ...

EDIT: Another observation (already mentioned in the first post): The editor of MMBasic for CMM2 behaves differently to Picomite and displays file contents correctly.
Edited 2023-03-02 03:18 by twofingers
causality ≠ correlation ≠ coincidence
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 03:18pm 26 Mar 2023
Copy link to clipboard 
Print this post

This is the New Simple Archiver:

nsa.zip

A useful tool for me to back up files, help with transfers and save disk space, although it doesn't compress the files. It is partially compatible with Epsilons@TBS "MAR " archiver:

Regards
Michael
causality ≠ correlation ≠ coincidence
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 04:21pm 30 Mar 2024
Copy link to clipboard 
Print this post

There have been changes to the firmware for the PicoMite. That's why I revised the archiver software.

The result is NSA V1.0 , tested with Picomite V5.09, MMB4W 5.07.03.24 and CMM2 5.07.00.

I found out that on the CMM2 the LOC() - proof: testloc.zip - and mm.ver functions do not work as expected. Adjustments were necessary for MMB4W because the MM.Info(FREE SPACE) function does not work.

Regards
Michael

and happy Easter!
causality ≠ correlation ≠ coincidence
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3801
Posted: 01:42pm 31 Mar 2024
Copy link to clipboard 
Print this post

  twofingers said  I found out that on the CMM2 the LOC() - proof: testloc.zip - and mm.ver functions do not work as expected. Adjustments were necessary for MMB4W because the MM.Info(FREE SPACE) function does not work.

Regards
Michael

and happy Easter!

I feel they're worth reporting to Peter - he may fix them :)

John
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 03:50pm 31 Mar 2024
Copy link to clipboard 
Print this post

Hi John,
I'm sure he will fix - sooner or later. I feel like I'm the only one using low-level file operations.
Best regards
Michael
causality ≠ correlation ≠ coincidence
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3801
Posted: 06:01pm 31 Mar 2024
Copy link to clipboard 
Print this post

You might be the only one doing exactly those things - or others may not have noticed the problems... (gulp)

John
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 07:38pm 31 Mar 2024
Copy link to clipboard 
Print this post


causality ≠ correlation ≠ coincidence
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6785
Posted: 08:03pm 31 Mar 2024
Copy link to clipboard 
Print this post

Due to firmware updates I rarely keep much on A: anyway. Most stuff is on a couple of SD cards or on the PC.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9112
Posted: 11:37am 01 Apr 2024
Copy link to clipboard 
Print this post

CMM2: V5.07.02b1: Minor bug fixes

  Quote  The LOC function does not work for files. Fixed in V5.07.02b1


mm.ver == mm.info(version)
Edited 2024-04-01 21:39 by matherp
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 11:26am 02 Apr 2024
Copy link to clipboard 
Print this post

@Peter:
You're right!  
Fixed 3 years ago.

Best regards
Michael

NSAv101 revised:
nsa101.zip
Edited 2024-04-03 00:52 by twofingers
causality ≠ correlation ≠ coincidence
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024