Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:08 23 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 : File Manager for PicoMite

     Page 2 of 6    
Author Message
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 161
Posted: 08:42am 25 Sep 2024
Copy link to clipboard 
Print this post

  Volhout said  
Library is not usefull.
Volhout


If FM manager writen not in MMbasic, but in C++ and then compiled to Csub -->> call ?
Then it might work? No?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 08:43am 25 Sep 2024
Copy link to clipboard 
Print this post

Surely only SUBs called from the library become part of your program? Otherwise there's no point in having it as every font etc will be part of your program too, even if you don't use them. Have I misunderstood how the library works?

If a library routine specifies local variables then there should be no collision either (only if they are globals).
Mick

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

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2134
Posted: 08:46am 25 Sep 2024
Copy link to clipboard 
Print this post

  Volhout said  all file manager subs and code becomes part of your main program
As Mick said, make it a Sub. As long as the Sub name and the names of it's Subs are different to the names of the Subs in the main program it works.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 08:54am 25 Sep 2024
Copy link to clipboard 
Print this post

If I've understood correctly, library routines are available to your programs but are not part of them and don't take up user RAM space. e.g. a large font in the library costs you nothing in RAM and can be used in several programs. I'm not sure if they are copied into RAM to run them or if they run from flash though (I think it's the latter).

I've not used the library on the Pico so I have no practical experience of this. It takes up a valuable flash slot.
Mick

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

Joined: 07/11/2023
Location: United Kingdom
Posts: 856
Posted: 09:47am 25 Sep 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  If I've understood correctly, library routines are available to your programs but are not part of them and don't take up user RAM space. e.g. a large font in the library costs you nothing in RAM and can be used in several programs. I'm not sure if they are copied into RAM to run them or if they run from flash though (I think it's the latter).

I've not used the library on the Pico so I have no practical experience of this. It takes up a valuable flash slot.


If that's the case, does this mean that a routine in the library would take a performance hit?
 
Volhout
Guru

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

@javavi,

I think I found it.
Try this version. It copies, and moves files correctly now.
Problem was caused by the path name, that did not include trailing "/".
This is tested on PicoMiteVGA MMBAsic 6.0.0 beta 6 (2040 code)

Volhout
fm12_bf2.zip

P.S. this is not the "downgraded" version. I intend to stay on 6.0.0 (or fall back to 5.09.00). For me 5.08.00 prevents me from running some of my own programs. Sorry electricat. But I understand that this may be an issue for others too. Since 5.08.00 at the moment is the "stable release" and widely available (Geoff's website).
Edited 2024-09-25 20:26 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 10:25am 25 Sep 2024
Copy link to clipboard 
Print this post

@ PhenixRising
I suspect so, but I've never tried it. Flash is going to be slower than RAM unless there's a read cache in the way - which there may well be. In that case the difference may be minimal.

Flash on the Pico is pretty quick. If you need maximum speed then you can't beat in-line code. If a routine is only needed a few times, and not in a loop, then getting it from the library is probably fine in almost every case. I used to use it on the Micromite for my ANSI translation to send simple graphics, coloured text etc. to the console.
Edited 2024-09-25 20:26 by Mixtel90
Mick

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

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

Phenix,

The library can be seen exactly as the name says. You can store subroutines in the library (the ones that are debugged) and have them available to all programs that you run.

Example: you use this routine a lot


FUNCTION double(a)
 double=a+a
END FUNCTION


You type "LIBRARY SAVE"

And this function is stored in library.

In any program you load, or write, you can now use the function "double()".
It is as if the function "double()" has become part of MMBasic. You don't see it in any program, but it is there.
You can use "double()" also on the commandline. And that is what everyone is discussing now.

I think FM should not be in the library, becuase it uses many variables. And these variables would become "unavailable" for every program you want to run. Becuase they are already assigned in the FM.bas program (DIM xxx). MMBasic will simply tell you the variable is already assigned. And then it is up to you to find out where (in the library) and how to work around it.

Here is a nice program to put in the library...
Sub FreePins
Local n,gp$,p,pu$
For n=0 To 29
gp$ = "GP"+Str$(n)
p = MM.Info(pinno gp$)
pu$ = MM.Info(pin p)
Print gp$, p, pu$
Next
End Sub


Load the program, then type "LIBRARY SAVE".
Then (commandline) you can type "freepins", and it shows you what pins on the picomite are not assigned

Volhout
Edited 2024-09-25 20:44 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 10:58am 25 Sep 2024
Copy link to clipboard 
Print this post

Can you define variables as LOCAL in the library routines?
Mick

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

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

Hi Mick,

Yes, you can.

And if you take the FM.bas code you can rewrite the whole file manager.
Change every SUB and FUNCTION in the filemanager to inline code (since you cannot have a SUB inside a SUB) and change every variable to a local variable.

I think it will be a major task.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 11:12am 25 Sep 2024
Copy link to clipboard 
Print this post

Ah, I didn't know about the nested SUBs problem.  :(

----------------

Silly me - it's that you can't *define* a SUB from within a SUB. That makes sense.

You can call a library SUB from within a library SUB. I've just tried it. :)

So, SUB fm (or whatever you call it) can only contain calls to the other SUBs. That's a good way anyway. All SUBs live on the same level, root of flash slot 3.
.
Edited 2024-09-25 21:35 by Mixtel90
Mick

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

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

Mick,

You can "call" a sub from within a sub.
But...

If you want the FM in the library, the FM itself must be a sub.
But the FM itself contains subs.

try this


SUB filemanager
 SUB do_it
 END SUB 'do it
END SUB 'filemanager

PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 11:38am 25 Sep 2024
Copy link to clipboard 
Print this post

You wouldn't normally do that though.

You'd use

SUB fm
do_it
do_something_else
end sub

sub do_it
...
...
end sub

sub do_something_else
...
...
end sub
Mick

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

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2134
Posted: 12:19pm 25 Sep 2024
Copy link to clipboard 
Print this post

Yes, that is how I have always done it. You only turn the the program into a Sub. Its subs remain separate. I also used it a lot on the MM2.
As noted, because the library is a shared space all variables need to be local.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6771
Posted: 12:52pm 25 Sep 2024
Copy link to clipboard 
Print this post

My ANSI routines for the Micromite used nested SUBs right from the start because it was easier to write a function that sends ESC[ followed by the rest of the command string. I thought it was odd if it didn't work on the Pico.


'these were in the library
Sub ch:Print Chr$(27);"[";:End Sub
Sub Vcls:ch:Print "2J";:End Sub
Sub Vch:ch:Print "H";:End Sub


ch isn't normally called by a user program, although it's available to it.

Vcls clears the screen by sending ESC[23
Vch is cursor home, sending ESC[H

There was a lot more to it than those two. :)
Mick

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

Joined: 07/11/2023
Location: United Kingdom
Posts: 856
Posted: 12:57pm 25 Sep 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  My ANSI routines for the Micromite used nested SUBs right from the start because it was easier to write a function that sends ESC[ followed by the rest of the command string. I thought it was odd if it didn't work on the Pico.


'these were in the library
Sub ch:Print Chr$(27);"[";:End Sub
Sub Vcls:ch:Print "2J";:End Sub
Sub Vch:ch:Print "H";:End Sub


ch isn't normally called by a user program, although it's available to it.

Vcls clears the screen by sending ESC[23
Vch is cursor home, sending ESC[H

There was a lot more to it than those two. :)


I use them all the time and exactly as listed  
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 161
Posted: 01:09pm 25 Sep 2024
Copy link to clipboard 
Print this post

I had idea.
Now we have 3 fixed FLASH slots and drive A:

I liked drive A:\ much but as we see, sometimes we would be happy to have additional "USER" flash slots (with FIXED 1,2,3 as standart for program compatibility)  

So if there would be some kind of --->> OPTION DEFINE USERSLOT n
e.i. possibility to define flash slots at cost of A:\ flash mem , it might be even more flexible system.

Is it good idea? No?
Edited 2024-09-25 23:10 by electricat
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4222
Posted: 01:17pm 25 Sep 2024
Copy link to clipboard 
Print this post

Guys,

We have all the tools we need
Library
drive a
drive b
flash slots

And all can be connected to a function key.

Volhout
PicomiteVGA PETSCII ROBOTS
 
dddns
Newbie

Joined: 20/09/2024
Location: Germany
Posts: 10
Posted: 01:38pm 25 Sep 2024
Copy link to clipboard 
Print this post

Hello,

I'm not (yet) a basic programmer and you are specialists.

What would it mean, to get the Filemanager running on lcdpanels?
Is there an easy way to translate/get around these VGA specific tile commands?

Regards
Dietmar
 
javavi

Senior Member

Joined: 01/10/2023
Location: Ukraine
Posts: 203
Posted: 05:23pm 25 Sep 2024
Copy link to clipboard 
Print this post

  Volhout said  @javavi,
I think I found it.
Try this version. It copies, and moves files correctly now.
Problem was caused by the path name, that did not include trailing "/".

Thank you very much for your efforts!
Accepted corrections.
And also added viewing of .BMP files, though in B/W.

FM_v13.zip
 
     Page 2 of 6    
Print this page
© JAQ Software 2024