Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:57 24 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 : Another file manager for the picos

     Page 1 of 2    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6096
Posted: 10:17pm 26 Sep 2024
Copy link to clipboard 
Print this post

4 years ago, I wrote a file manager program for the CMM2. It's main purpose was to test the various image and audio formats that are supported by the CMM2.

I had a few hours to spare so I decided to see how well it ran on the picoHDMI.
The original was hard coded for 800x600 display so that was the first thing to fix.
There are still a couple of tweaks needed.
I decided to remove the mouse controls but that could be reintroduced if required.

There are two changes I was not expecting.
SEEK 0 on the CMM2 gets you to the start of a file.
You need SEEK 1 on the pico. SEEK 0 throws an error.
The pico drive A file system is case sensitive.

The attached program should run on any display resolution and will adjust the number of columns automatically. If you don't like MODE 3 on the HDMI or VGA, edit line 29

I suggest renaming it to File Explorer to avoid confusion with Javavi's File Manager.

helpTxt:
 DATA " FE v1.4"
 DATA " Use arrow keys to move between files, PgUp/PgDown to change pages"
 DATA " Home- Change to first file in root folder"
 DATA " End - select last file in current folder"
 DATA " Enter View Image and text files, PLAY audio files,"
 DATA "       load and RUN BAS files change folder"
 DATA " a/b - change drive"
 DATA " f   - toggle font size"
 DATA " u   - toggle colour"
 DATA " v   - view file (including BAS files)"
 DATA " t   - view as text"
 DATA " x   - view as HEX"
 DATA " esc - quit viewing or playing."
 DATA " i   - display info about the file"
 DATA " s   - send file to PC using XMODEM"
 DATA " m   - accept file from PC using XMODEM"
 DATA " del - permanently delete file."
 DATA " k   - permanently delete file."
 DATA " r   - rename file"
 DATA " c   - copy file"
 DATA " n   - make new directory"
 DATA " h   - display this help"
 DATA " q   - Quit"


FMpico.zip

Jim
VK7JH
MMedit   MMBasic Help
 
dddns
Newbie

Joined: 20/09/2024
Location: Germany
Posts: 10
Posted: 05:09am 27 Sep 2024
Copy link to clipboard 
Print this post

Hello Jim,

it runs on a lcdpanel 800x480 just as well.
Thank you!
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4222
Posted: 05:47am 27 Sep 2024
Copy link to clipboard 
Print this post

Hi Jim,

Thank you for File Explorer for pico. Some minor remarks:

- In VGA Mode 1, the file highlighting (colouring) is only in the first column.
- The help text banner is wider (800 ?), and does not scroll, so some parts are not visual on 640.





Regards,

Volhout
PicomiteVGA PETSCII ROBOTS
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6096
Posted: 07:36am 27 Sep 2024
Copy link to clipboard 
Print this post

@Volhout
I haven't any experience with the magic that produces the colour in VGA mode 1 but I am guessing that I need to start the text on a byte boundary. The program simply divides the pixels by 3. I will do some adjusting.

The help banner is as short as I could make it. The main one is 'h' which shows the full help.
You could try a smaller font. 'f' toggles between font 1 and 7

We were spoilt with the size of the screens on the CMM2.

Jim
VK7JH
MMedit   MMBasic Help
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4222
Posted: 07:42am 27 Sep 2024
Copy link to clipboard 
Print this post

Hi Jim,

I remember in the old days we had:

heX  Help  Edit  View

and the likes. But those days are gone now. We are in a new age...

Volhout
Edited 2024-09-27 17:44 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1113
Posted: 07:53am 27 Sep 2024
Copy link to clipboard 
Print this post

I also started programming a file manager once. (only the basic structure and optics)


'MartinCommander ;-) MC
'
MODE 1:Font 1:CLS RGB(blue)
Dim integer fh=MM.Info(FONTHEIGHT),fw=MM.Info(FONTWIDTH),fnr,dnr
Dim String folder(512)length 64
Dim string fls(512)length 64
topln%=0
dframe 0,topln%,39,28-topln%
dframe 40,topln%,39,28-topln%
MText 5,topln%+1,"Name        Size     Date    Time",RGB(Yellow),RGB(Blue)
MText 45,topln%+1,"Name        Size     Date    Time",RGB(Yellow),RGB(Blue)
hline 0,topln%+27,39,RGB(cyan),RGB(blue)
hline 40,topln%+27,39,RGB(cyan),RGB(blue)
vline 14,topln%,27-topln%,RGB(cyan),RGB(blue)
vline 24,topln%,27-topln%,RGB(cyan),RGB(blue)
vline 32,topln%,27-topln%,RGB(cyan),RGB(blue)
vline 54,topln%,27-topln%,RGB(cyan),RGB(blue)
vline 64,topln%,27-topln%,RGB(cyan),RGB(blue)
vline 72,topln%,27-topln%,RGB(cyan),RGB(blue)
tp1$=" "+Cwd$+" "
If Len(tp1$)>23 Then tp1$=Left$(tp1$,10)+"..."+Right$(tp1$,10)
xp=20-(Len(tp1$)/2)
mtext xp,topln%,tp1$,0,RGB(cyan)
mtext xp+40,topln%,tp1$,RGB(cyan),RGB(blue)
Text 0,fh*32,""
For f=0 To 511:fls(f)="":folder(f)="":Next

getdirs : getfiles

top=0:ln=2
Do
 dn$=folder(ln+top-2)
 Inc ln
 If dn$="" Then Exit
 If ln>26 Then Exit
 MTEXT 1,ln,dn$,RGB(GREEN),RGB(BLUE)
 MTEXT 15,ln,Chr$(&H94)+"SUB-DIR"+Chr$(&H95),RGB(GREEN),RGB(BLUE)
Loop

'showdirs(top)



Sub getfiles
 fnr=0
 fl$ = Dir$("*.*",FILE)
   Do While fl$ <> ""
     fls(fnr)=fl$:Inc fnr
     fl$ = Dir$()
 Loop
End Sub

Sub getdirs
dnr=0
fl$ = Dir$("*",DIR)
   Do While fl$ <> ""
     folder(dnr)=fl$ :Inc dnr
   fl$ = Dir$()
 Loop
End Sub

'Screen related subs
Sub hline  x,y,w,fc,BG
   Local integer f
   Text x*fw,y*fh,Chr$(&HC7),,1,,fc,bg
   Text (x+w)*fw,y*fh,Chr$(&HB6),,1,,fc,bg
   Text (x+1)*fw,y*fh,String$(w-1,&Hc4),,1,,fc,bg
End Sub

Sub vline x,y,h,fc,BG
   Local integer f
   Text x*fw,y*fh,Chr$(&HD1),,1,,fc,bg
   Text x*fw,(y+h)*fh,Chr$(&Hc1),,1,,fc,bg
       For f=y+fh To (y+h-1)*fh Step fh
   Text x*fw,f,Chr$(&HB3),,1,,fc,bg
   Next
End Sub

Sub dframe x,y,w,h
Local integer fc=RGB(CYAN),BG=RGB(BLUE)
For f=x To x+w-1
   Text f*fw,y*fh,Chr$(&HCD),,1,,fc,bg
   Text f*fw,(y+H)*fh,Chr$(&HCD),,1,,fc,bg
Next
For f=y To y+h-1
   Text x*fw,f*fh,Chr$(&HBA),,1,,fc,bg
   Text (x+w)*fw,f*fh,Chr$(&HBA),,1,,fc,bg
Next
Text x*fw,y*fh,Chr$(&Hc9),,1,,fc,bg
Text (x+w)*fw,y*fh,Chr$(&HBB),,1,,fc,bg
Text x*fw,(y+h)*fh,Chr$(&Hc8),,1,,fc,bg
Text (x+w)*fw,(y+h)*fh,Chr$(&HBC),,1,,fc,bg
End Sub

Sub MTEXT x,y,t$,fc,bg
Text x*fw,y*fh,t$,,1,,fc,bg
End Sub
>




maybe we can try to combine the best of all of them

Cheers
Martin
Edited 2024-09-27 18:31 by Martin H.
'no comment
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6778
Posted: 08:37am 27 Sep 2024
Copy link to clipboard 
Print this post

This is looking more and more like CMM1.5 (or CMM1.75). :)

Is this going to be the next programming challenge? Write a file explorer/manager for the Pico? ;)

.
Edited 2024-09-27 18:38 by Mixtel90
Mick

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

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6096
Posted: 09:52am 27 Sep 2024
Copy link to clipboard 
Print this post

I have sorted out the strange colours/lack of colour
I should read the manual more often.

A fix tomorrow ...
Jim
VK7JH
MMedit   MMBasic Help
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 368
Posted: 03:16pm 27 Sep 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  Is this going to be the next programming challenge? Write a file explorer/manager for the Pico? ;)


It looks like it's a common project! I also started coding up a GUI file manager for the CMM2 a few years back. Just something to make copying folders and the like a bit easier, and maybe a front end for finding games.

Now that I have my new CMM2's I think I'll dust it off and maybe give it a bit of spit and polish.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6096
Posted: 08:04am 28 Sep 2024
Copy link to clipboard 
Print this post

I think I have fixed the colour in MODE 1
Using font 7 will be in monochrome, font 1 colour.
I also fixed a couple of other bugs.

FEpico.zip

Jim
VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 08:00am 04 Oct 2024
Copy link to clipboard 
Print this post

To all interested in this. I'll be posting RC4 shortly - suggest you check it out

Dim a%(5000)
For i=0 To 5000:a%(i)=i:Next
Input "File name: ",fname$
Edit File fname$
Print a%(222)

Edited 2024-10-04 18:02 by matherp
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 161
Posted: 11:05am 04 Oct 2024
Copy link to clipboard 
Print this post

Peter,

I not only checked, but already added and tested new EDIT FILE cmd to JAVAVI file manager. It works sure.

It might be strange question for you, but I am simple user, not developer.

So, what would happen if I would try edit larger file and there would be no warning-> there is no enough heap memmory?

What would happen if user would be alowed edit that large file without any warning?

What if user have no plans return to file manager, but just want edit that large program and then SAVE "xx" ?
Isn`t this the same situation as after RUN $fname from program line, but instantly stopped?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 11:24am 04 Oct 2024
Copy link to clipboard 
Print this post

If you edit too large a program you should get an out of memory error. I need to check I've put that in all the relevant places.

  Quote  What if user have no plans return to file manager, but just want edit that large program and then SAVE "xx" ?


EDIT FILE will return to the program calling it like any other Basic command. If then you want to run the program you can code this in the file manager
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 351
Posted: 12:55pm 04 Oct 2024
Copy link to clipboard 
Print this post

  electricat said  
What if user have no plans return to file manager, but just want edit that large program and then SAVE "xx" ?


Then use a helper program, pass the file to be called with the Execute call. This helper program does nothing but call the edit of the big file. If necessary, you could reload the file manager after returning to this utility (and here you could save the configuration beforehand so that the same settings are loaded again).

You have to be creative when programming with limited resources :-)

Matthias
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1109
Posted: 03:48pm 04 Oct 2024
Copy link to clipboard 
Print this post

Could an extra parameter be useful?
Edit File fname$ [,linenum]

Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 03:52pm 04 Oct 2024
Copy link to clipboard 
Print this post

  Quote  Could an extra parameter be useful?

NO
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 161
Posted: 05:59pm 04 Oct 2024
Copy link to clipboard 
Print this post

Peter,

While working on File manager and making improvements there and there  I wanted make elegant way escape after INPUT, val$ has started and waits for user input.

But what if user decides do not continue with INPUT or started INPUT dialog accidentally and wants escape?

Elegant and usual way for user I would see by pressing ESC key.

So if INPUT command would return and rise ERROR instantly after ESC key was pressed we could catch it and decide how to continue program.

I see this as elegant enough way leave INPUT (not by entering multiple values until finished for example)

I tried to look arround, read, play with interrupts and ON KEYS etc.. and finally gave up. I am reading and reading manual. I find so many tiny details I missed, but still it might be not enough of taht reading  
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9105
Posted: 06:13pm 04 Oct 2024
Copy link to clipboard 
Print this post

INPUT is a generic command that is used for files, the console and serial ports. ESC is a valid character for things like function keys or just binary data so can't work like you propose. If you want to do something like that you need to write a function in Basic to receive and echo characters one-by-one. That way you can interpret them as you wish including having a timeout if appropriate
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 161
Posted: 06:27pm 04 Oct 2024
Copy link to clipboard 
Print this post

  matherp said  If you want to do something like that you need to write a function in Basic to receive and echo characters one-by-one.


I was thinking that direction too but just needed to check if I did not missed something. Thank You.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3800
Posted: 09:07pm 04 Oct 2024
Copy link to clipboard 
Print this post

Why not use INKEY$ ?

John
 
     Page 1 of 2    
Print this page
© JAQ Software 2024