Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : File Manager for PicoMite

   Page 6 of 17    
Posted: 06:39pm
22 Nov 2024
Copy link to clipboard
thwill
Guru


Just spit-balling, but you make the behaviour caller defined and transient:

The "shell" calls:

   RUN "app.bas" [, args$] [ ON END RUN n | filename$ ]

And when "app.bas" ends it will then RUN flash slot 'n' or 'filename$'.

You could get additionally tricksy by:

1. Having a variable Mm.EndCmdLine$ or suchlike, the value of which would then be passed as the command line args when processing the ON END RUN.

2. Also having an optional ON ERROR RUN which would automatically receive the error number and message as its command line args.

HOWEVER ... I'm not convinced we are addressing @javavi's use-case. @javavi could you provide an explicit example of something you want to do rather than describing it in generalities ?

Best wishes,

Tom
Edited 2024-11-23 04:50 by thwill
 
Posted: 06:56pm
22 Nov 2024
Copy link to clipboard
javavi
Guru


  matherp said  
Set a string in the program and it is available at the command line when it exits. If you use my MM.END mechanism then you can run it

Maybe I didn't quite understand your solution. It seems redundant to me to run another program from flash to execute the string. Why not just enter the string (if it is defined) upon program termination into the command line environment?
Edited 2024-11-23 04:59 by javavi
 
Posted: 06:59pm
22 Nov 2024
Copy link to clipboard
twofingers
Guru

  matherp said  Sorry but I'm not going to implement anything that will inevitably cause users to make simple mistakes with bad outcomes when there are safer alternatives available.

Peter: If the program knows that it is already saved (flag) there is no risk. But I don't want to insist ...
 
Posted: 07:04pm
22 Nov 2024
Copy link to clipboard
Mixtel90
Guru


If the concept is to run an application at the command line on instruction from File Manager then it's flawed.

There can only be a single instance of MMBasic, which is running continuously. It's just that it has two forms: command line and runtime. The runtime can accept an argument when it is started from the command line but there is no point in it trying to return an argument as there is nothing to return to - at best it can END and drop out to the command line or FLASH CHAIN to another program that is also stored in flash. The runtime isn't being called at all, operation is being handed over to it.
 
Posted: 07:08pm
22 Nov 2024
Copy link to clipboard
thwill
Guru


  Mixtel90 said  ... at best it can END and drop out to the command line or FLASH CHAIN to another program that is also stored in flash.


It can also just RUN another program (with or without command line args), note you don't need to EXECUTE "RUN ..." you can just RUN ...

Tom
 
Posted: 07:08pm
22 Nov 2024
Copy link to clipboard
matherp
Guru

javavi

As Tom says, please state the requirement rather than a solution. Then we can understand what, if anything, is an appropriate safe way of meeting it.
 
Posted: 07:30pm
22 Nov 2024
Copy link to clipboard
javavi
Guru


  matherp said  As Tom says, please state the requirement rather than a solution.

I need the program from the runtime environment to be able to pass a string of characters directly to the command line after completing its work.
For example, like this:

....
MM.End$="FILES"+Chr$(13)
End

And after the program completed, the content of this MM.End$ was entered into the command line.

> FILES
....

Edited 2024-11-23 05:35 by javavi
 
Posted: 07:38pm
22 Nov 2024
Copy link to clipboard
thwill
Guru


Ok, so FILES is a corner case because it can't be executed from within a program, but you could write a BASIC program that duplicates its behaviour and call that from your FM using RUN.

Any other examples?

Tom
Edited 2024-11-23 05:39 by thwill
 
Posted: 07:43pm
22 Nov 2024
Copy link to clipboard
javavi
Guru


  thwill said  Any other examples?

I also want to accept any user-entered string in the program for execution.
But don't offer the EXECUTE command, since it has limitations.
Edited 2024-11-23 05:45 by javavi
 
Posted: 07:49pm
22 Nov 2024
Copy link to clipboard
thwill
Guru


  javavi said  I also want to accept any user-entered string in the program for execution. But don't offer the EXECUTE command, since it has limitations.


Write the commands that the user wants to execute into a temporary file, then RUN that file, you can even have that file then RUN the file manager again.

Off the top of my head the things you can't do from a program are FILES, EDIT (did that change recently?) and setting some of the OPTIONs ... most of which require the PicoMite to reboot anyway.

Best wishes,

Tom
Edited 2024-11-23 05:50 by thwill
 
Posted: 08:22pm
22 Nov 2024
Copy link to clipboard
JohnS
Guru

  javavi said  Why not just enter the string (if it is defined) upon program termination into the command line environment?

Because in MMBasic there isn't such a command line environment to return to.

Peter's current suggestions may well be as much as you actually need.

John
 
Posted: 08:43pm
22 Nov 2024
Copy link to clipboard
thwill
Guru


  JohnS said  Because in MMBasic there isn't such a command line environment to return to.


Sure there is, the part of the firmware that handles the prompt. I'm fairly sure what is being asked for *could* be implemented (hacked in) ... it's just *strange* and if every bit of *strange* was implemented then MMBasic would be bloated and probably unusable.

Best wishes,

Tom
Edited 2024-11-23 06:43 by thwill
 
Posted: 10:34pm
22 Nov 2024
Copy link to clipboard
JohnS
Guru

OK, I guess I meant there isn't one at the moment of the kind being requested.

John
 
Posted: 08:35am
23 Nov 2024
Copy link to clipboard
Mixtel90
Guru


The command line is for a user to enter commands. It isn't designed to auto-run things unless it's a program that's been designated as auto run. It certainly isn't designed to run any other commands automatically as it should be impossible. You don't want to get locked out of the system because it keeps running FILES/n continuously.

If you set OPTION AUTORUN ON and OPTION BREAK 0 you are (more or less) in the wet and smelly over your wellies. :)  It's a similar thing if you can auto run command line commands. It's commonly regarded to be a "bad thing". :)

There is no OS environment.
The command interpreter, editor and BASIC interpreter are all one and the same no matter how they appear. Get one stuck and the whole system crashes, it's completely irretrievable.

Giving BASIC control of the command interpreter is giving it control of the routine that passed control to it. You can't "call" it as you got into BASIC via a Jump command - there is no return mechanism. Peter's MM.END is probably the best you can do to keep the system stable.
 
Posted: 12:51pm
24 Nov 2024
Copy link to clipboard
twofingers
Guru

My keyboard is only connected via Teraterm. Unfortunately, switching with the ALT key does not work.
I have therefore temporarily replaced the ALT key with the backspace key (chr$(8)). This means I can also use the ALT-F keys.
FM v1.12, Line #69:
Case 135  'End
 SetPControl("BOT")
Case 136  'PgUp
 SetPControl("PREV")
Case 137  'PgDn
 SetPControl("NEXT")
Case 8  'Alt 'was Case 139  'Alt
'Case 8, 139 'Alt or Backspace
 SetAltPControl()
Case 145  'F1-Help
 SetPControl("DIS")
 PrintHelp()
 PanelsReStore()
Case 146  'F2-ReName


BTW. I can't find a table of "Special Keyboard Keys" in the manual. Am I just blind?

From the Maximite Manual:


Edited 2024-11-25 02:19 by twofingers
 
Posted: 08:27pm
25 Nov 2024
Copy link to clipboard
Volhout
Guru

Hi javavi,

Today I did a lot of testing of programs with the new V6.00.01RC1 firmware. Used your FM to navigate through the folders on B:/ a lot, and it works great. A very handy tool.

If you have time to investigate the issue with copying files from B:/ to B:/ that would be great. The issue is that when in the left pane you open a folder on B:/, and try to do the same in the right pane (open a different folder on B:/), you get an error. This is on 1.12

Volhout
Edited 2024-11-26 06:28 by Volhout
 
Posted: 06:36pm
26 Nov 2024
Copy link to clipboard
twofingers
Guru

Thanks Harm for the Freepins() idea!
https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=17466&LastEntry=Y#230142#230129

I included the sub in the File Manager.

Sub FREEPINS()
Local integer n,p
Local string gp$,pu$
For n=0 To 29
  gp$ = "GP"+Str$(n)
  On error skip
  p = MM.Info(pinno gp$)
  If Not MM.Errno Then
     pu$ = MM.Info(pin p)
  Else
     p=-1
     pu$=MM.ErrMsg$
  EndIf
  Print gp$;@(50,MM.Info(vPOS)) p, pu$
Next
End Sub

and replaced this:
Sub GetMenuList(ML$(),LS%())
ML$(0)=".."
ML$(1)="> MEMORY"
ML$(2)="> FLASH LIST"
ML$(3)="> OPTION LIST"
ML$(4)="> LIST COMMANDS"
ML$(5)="> LIST FUNCTIONS"
ML$(6)="> FREEPINS"
ML$(7)=""
LS%(0)=6:LS%(1)=0:LS%(2)=0
End Sub

Regards
Michael

EDIT:
Seems to be obsolete already!?
Edited 2024-11-27 05:29 by twofingers
 
Posted: 10:02pm
26 Nov 2024
Copy link to clipboard
javavi
Guru


FM v1.13    PicoMiteVGA/HDMI 6.00.01RC2
- handling the error of no SD card
- additional BS button for Alternative functions
- loading F9 Menu from DATA
- minor fixes...
FMv1.13.zip
 
Posted: 07:14am
30 Dec 2024
Copy link to clipboard
xandr001
Newbie

Hello Javavi,
Thanks a lot! This is exactly what I was looking for my picomite vga, even started my own implementation, but yours is much more complete.

Have you considered putting the code onto GitHub? Or git is not the way to go for picomite programs?

Thanks!
 
Posted: 10:23am
30 Dec 2024
Copy link to clipboard
Volhout
Guru

Hi javavi,

Have you fixed the copy of files from b:/folder/ to b:/other_folder/ ?

Volhout
 
   Page 6 of 17    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025