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 5 of 6 | |||||
Author | Message | ||||
javavi Senior Member Joined: 01/10/2023 Location: UkrainePosts: 203 |
This, as I understand it, saves variables in flash memory. In principle, it is possible to transfer data from the program to the program. But here the task is a little more complicated, how to pass a string to the environment PicoMite MMBasic for execution. Edited 2024-11-22 19:36 by javavi |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4222 |
please explain what it is you want to achieve. It is always possible to write yout flash 3 program to do multiple things in sequence, using variable pre-set in main program. For example: this works for some commands (see explanation in user manual). You need a mod file (i.e. pacman.mod, as part of the CIRCLE game) in the folder you are executing your main from. Flash slot 3 For i=0 To cmds Execute a$(i) Next i Main program cmds=4 Dim a$(cmds) a$(0)="CLS"+Chr$(13) a$(1)="PRINT "+Chr$(34)+"Playing music"+Chr$(34)+Chr$(13) a$(2)="PLAY MODFILE "+Chr$(34)+"pacman.mod"+Chr$(34)+Chr$(13) a$(3)="PRINT "+Chr$(34)+"Playing busy"+Chr$(34)+Chr$(13) 'a$(3)="PAUSE 10000"+Chr$(13) a$(4)="PLAY STOP"+Chr$(13) Flash chain 3 But as you can see ... the PAUSE command can not be "executed". Try it, your system will reboot. Finally: unless Peter creates it: there is no other way to execute from MMBasic commandline. Secondly: VAR SAVE is erased when you load a new program. Volhout Edited 2024-11-22 23:06 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6772 |
There isn't really an "environment" to pass an argument to. That's because there is no OS as such. MMBasic can accept an argument using MM.CMDLINE$ but AFAIK there is no way for it to return one. The only way that variables are preserved from one program to another is using FLASH CHAIN. That's because both are able to run from flash and the variables area doesn't get cleared. If you need to pass several commands to the new program then you'll probably have to write them to a file on A: Edited 2024-11-23 00:27 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
javavi Senior Member Joined: 01/10/2023 Location: UkrainePosts: 203 |
I want to be able to type or accept a command line in a program, and then, upon exiting the program, pass it on to the environment command line for execution. More specifically, in the example, I want to be able to execute any command line typed by the user in the File Manager. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6772 |
I don't see how this can be done without an OS for the file manager to run on. EXECUTE is the mechanism to do it from within MMBasic, but without MMBasic running there is nothing to execute anything. RUN will destroy everything in user space. You specifically can't run command line commands from within MMBasic as most of them need at least free access to the variables area, which you simply can't have while MMBasic is running. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4036 |
I've poked at this a lot and I believe Mick is correct, MMBasic simply does not provide enough "operating system" for this to be possible. From one MMBasic program you can RUN another, and pass it command line arguments, e.g. RUN "foo.bas", "some arguments" that the other program can read from the "variable" Mm.CmdLine$. But there is no mechanism to run something directly at the prompt, and a couple of things are only possible at the prompt. Calling back to another thread, if (and it's a big IF) someone ever creates a GEM-like environment for MMBasic we will need to persuade Peter/Geoff/Me(?) to modify the firmware so that instead of returning to the prompt it is possible to implicitly run a specific program on exit, ... or all programs designed to run under MM-GEM will have to do so explicitly. Best wishes, Tom Edited 2024-11-23 02:40 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9101 |
I don't know if this helps but in my dev version I've just implemented something that may be relevant. This is a hook to run a subroutine named MM.END whenever an explicit or implicit END statement is encountered. Like MM.STARTUP, you could then save a MMBasic subroutine named MM.END in the library and that would be run whenever any program exits. If a program is exited using Ctrl-C then the function is not executed. If you don't want MM.END to be executed for any reason use "END noend" to exit the program. If it doesn't exist then of course it is ignored Edited 2024-11-23 03:12 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4036 |
It would certainly provide a mechanism to return to an MM-GEM. However personally I dislike the "library" concept in the context of a Boot to BASIC computer with effectively unlimited disk drive storage (i.e. SD card) even though I understand it in the uC context with only flash to play with. This dislike stems from the possible conflicts between what software providers want users to have in their library, what the users want in their library, and the difficulty of editing (as opposed to appending to) the library. IMO it is much simpler to use fixed name/location files. Note that I'm not asking you to make any changes Peter, I'm just flapping my mouth . Best wishes, Tom Edited 2024-11-23 03:24 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
That's brilliant! I think that should solve the problem with restarting the file manager. Couldn't the whole FM (when development is finished) be stored in the library? Another idea is to implement a MM.CTRLC hook in addition to the MM.END hook. Then you can react individually to the Ctrl-C ... Password query etc. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9101 |
How about this? OPTION FLASH RUN ON END n If this option is set then the END command will automatically RUN (not CHAIN) anything in flash slot n So if you save the filemanager in flash slot 1 and then enable this option whenever any program ends the filemanager will be automatically run. This is trivial to include. The only tricky bit is to ensure that when the flash program ends it doesn't run itself |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4036 |
Could it be implemented so there was also the option to run a file from A:/ or B:/ ? OPTION ON END FLASH RUN n OPTION ON END RUN filename$ Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9101 |
The problem with loading anything from file is that it deletes the current program. This could make developing a program a nightmare, one error and you have lost everything you've just done. The flash slot version is benign as the program remains in memory |
||||
javavi Senior Member Joined: 01/10/2023 Location: UkrainePosts: 203 |
@matherp, I am not an expert in the BASIC programming language and cannot advise here on how to do it. I just think that it is logical that if a program can accept arguments from the environment at the input, it should also be able to return the result of its work to the environment. As an example, a program can issue a string of the result of its work to the execution environment and if at the end of this string there is the code ENTER, then this string will be executed. |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
If found the idea with the hook mm.end more appealing. It also seems more flexible in the long run, who knows what ideas you'll come up with over time. Isn't there a value in memory with the name of the running program? then you can query this in mm.end and if it is the FM.bas itself, it will simply be terminated. Edited 2024-11-23 04:08 by homa |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9101 |
Not sure what that would achieve that adding an EXECUTE RUN command doesn't already do. My ideas were attempting to find a solution without every program having to have code added. At the moment when a program exits all its context and variables remain available until another program is run |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4036 |
Right ... one of the reasons I don't program directly on the PicoMite is that its ability to run a program without saving it (and also sometimes mistakenly using EDIT and EDIT filename$ for the same program) means that I inevitably lose my changes at some point. I think I'll stick with the "shell" and its "apps" being written to explicitly collaborate. Best wishes, Tom Edited 2024-11-23 04:16 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1236 |
I like Tom's idea the best. It looks very flexible. I think we should trust users with a bit of personal responsibility. Regards Michael Edited 2024-11-23 04:20 by twofingers causality ≠ correlation ≠ coincidence |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9101 |
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. |
||||
javavi Senior Member Joined: 01/10/2023 Location: UkrainePosts: 203 |
I don't want to restart FM every time, I am satisfied with the customizable option to call by the F key. I need, in my opinion, a very flexible option to return from the program a string that the environment (PicoMite command line) will take for execution, or it will simply output it to the command line (if the line does not end with /r) Edited 2024-11-23 04:43 by javavi |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9101 |
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 |
||||
Page 5 of 6 |
Print this page |