Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:40 01 Aug 2025 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 : Run without overwriting in memory program

Author Message
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 03:06pm 13 Sep 2020
Copy link to clipboard 
Print this post

I'm not sure if anyone else has done this, but I'd like to have a set of functions and constants available (using autostart or similar) when starting my CMM2 without overwriting the currently loaded program (similar to a default #Include or being able to run from the Path except without actually loading the program for edit.

Is this possible?  Apologies for such a newbie question, but I've not seen anything in the programming manual that describes this.
Edited 2020-09-14 01:11 by elk1984
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 04:16pm 13 Sep 2020
Copy link to clipboard 
Print this post

Are you asking if there is a way to do this so that those options and constants and such are there and exist in memory  so you can access and use them when programming on the command line (vs in the editor)?

If that's what you're asking, you could set them up in a BASIC program, run that program and let it complete and then from that point on in the command line (at least until you type new) I BELIEVE they should still be active (but haven't confirmed this, don't have my CMM2 near me) in the command line after the program ends.

I seem to recall there being something in the manual about auto-launching a .bas at power up, but I could be wrong. It's not something I've had a need for...


If you're just wanting an include that does these things in your programs (like a standard set of settings you always want to use in your code) just make a .inc with them and always include that at the start of your programs.

I don't know of any way to do it where you run something without blowing away the currently loaded program though.
Edited 2020-09-14 02:18 by mkopack73
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 04:17pm 13 Sep 2020
Copy link to clipboard 
Print this post

This is a pretty cool feature available in the -MicroMite- via the LIBRARY. There can be routines that are stored "permanently" (survives NEW, etc) in flash that run before the code runs.

The CMM2 does not do this.
Micromites and Maximites! - Beginning Maximite
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 04:27pm 13 Sep 2020
Copy link to clipboard 
Print this post

  CircuitGizmos said  This is a pretty cool feature available in the -MicroMite- via the LIBRARY. There can be routines that are stored "permanently" (survives NEW, etc) in flash that run before the code runs.

The CMM2 does not do this.


Yes, that's exactly the functionality I was looking for.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 05:07pm 13 Sep 2020
Copy link to clipboard 
Print this post

  Quote  This is a pretty cool feature available in the -MicroMite- via the LIBRARY.


This won't ever be available in the CMM2 before anyone asks
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 05:46pm 13 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  This is a pretty cool feature available in the -MicroMite- via the LIBRARY.


This won't ever be available in the CMM2 before anyone asks


I can understand why.  There are limited resources available and it's a niche use case.  The CMM2 is a great retro device and I've had more fun than in years of using more modern development languages and tools in my professional work.

It's a bit like popping the SD card out and sticking it my PC becuase it's the quickest way to do file manipulation - it breaks the retro feel for me.

So to give the use case (rather than a soluton   )

Is there a way of running a set of commands / a program without losing the currently loaded file?  I would even be open to my things having to save / reload the file that was loaded when the command was launched.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 06:03pm 13 Sep 2020
Copy link to clipboard 
Print this post

  elk1984 said  Is there a way of running a set of commands / a program without losing the currently loaded file?  I would even be open to my things having to save / reload the file that was loaded when the command was launched.


I'm hoping someone will tell me I am wrong, but I believe the answer is "No".

Either your programs have to know about each other and agree on a common mechanism to interchange data and launch each other, or as a special case of the former you have to write a "shell" and all the programs have to know how to behave when launched by the shell and return control to the shell when they exit.

Related to this I've been pondering the possibility of porting the pre-UNIX Software Tools Users Group Virtual Operating System from Ratfor to MMBasic and thus filling in many of the missing OS pieces from the CMM2. It looks possible and I think I have the skills, but currently not the time.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 06:25pm 13 Sep 2020
Copy link to clipboard 
Print this post

  elk1984 said  
Is there a way of running a set of commands / a program without losing the currently loaded file?  I would even be open to my things having to save / reload the file that was loaded when the command was launched.


Would you mean this?

Editing fred.bas (in memory)

On the command line type:

*flip

(This loads and runs whatever the flip program is)

Continue editing and it would be fred.bas

There would need to be a mechanism that when the * is encountered, the filename for the current file is saved, and then before the command prompt returns, that file is restored.
Micromites and Maximites! - Beginning Maximite
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 06:28pm 13 Sep 2020
Copy link to clipboard 
Print this post

  CircuitGizmos said  
  elk1984 said  
Is there a way of running a set of commands / a program without losing the currently loaded file?  I would even be open to my things having to save / reload the file that was loaded when the command was launched.


Would you mean this?

Editing fred.bas (in memory)

On the command line type:

*flip

(This loads and runs whatever the flip program is)

Continue editing and it would be fred.bas

There would need to be a mechanism that when the * is encountered, the filename for the current file is saved, and then before the command prompt returns, that file is restored.


It's a very BBC Micro way of looking at it (which is cool with me!) - commands extended via *, but yes - essentially that syntax with the ability to restore what was previously running.

For a set of constants etc, I'll have to get used to *setupMyStuff  
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 06:33pm 13 Sep 2020
Copy link to clipboard 
Print this post

  CircuitGizmos said  
  elk1984 said  
Is there a way of running a set of commands / a program without losing the currently loaded file?  I would even be open to my things having to save / reload the file that was loaded when the command was launched.


Would you mean this?

Editing fred.bas (in memory)

On the command line type:

*flip

(This loads and runs whatever the flip program is)

Continue editing and it would be fred.bas

There would need to be a mechanism that when the * is encountered, the filename for the current file is saved, and then before the command prompt returns, that file is restored.


Hence the need for a shell program. You would use it instead of the command line and it would try to handle all this. More likely than persuading Peter to engage in major extensions to the firmware. However I suspect it would be very challenging to implement and assume it would still need limited additional firmware support, e.g. a mechanism to return to the shell program if a program you run from it craps out.

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 06:37pm 13 Sep 2020
Copy link to clipboard 
Print this post

  elk1984 said  It's a very BBC Micro way of looking at it (which is cool with me!) - commands extended via *, but yes - essentially that syntax with the ability to restore what was previously running.


The * syntax already exists, the other bit doesn't.

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 06:41pm 13 Sep 2020
Copy link to clipboard 
Print this post

  thwill said  
  elk1984 said  It's a very BBC Micro way of looking at it (which is cool with me!) - commands extended via *, but yes - essentially that syntax with the ability to restore what was previously running.


The * syntax already exists, the other bit doesn't.

Tom


Thanks - I'd aleady spotted that and was using it (in fact that's what got my hopes up).
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 06:42pm 13 Sep 2020
Copy link to clipboard 
Print this post

  thwill said  
  CircuitGizmos said  
  elk1984 said  
Is there a way of running a set of commands / a program without losing the currently loaded file?  I would even be open to my things having to save / reload the file that was loaded when the command was launched.


Would you mean this?

Editing fred.bas (in memory)

On the command line type:

*flip

(This loads and runs whatever the flip program is)

Continue editing and it would be fred.bas

There would need to be a mechanism that when the * is encountered, the filename for the current file is saved, and then before the command prompt returns, that file is restored.


Hence the need for a shell program. You would use it instead of the command line and it would try to handle all this. More likely than persuading Peter to engage in major extensions to the firmware. However I suspect it would be very challenging to implement and assume it would still need limited additional firmware support, e.g. a mechanism to return to the shell program if a program you run from it craps out.

Tom


Agreed - like every product there's only a case for the time and effort if it's a core use case and this is a very edge case (talking myself out of an extension even if it would be considered here   )
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 06:51pm 13 Sep 2020
Copy link to clipboard 
Print this post

You may know all this already, but in case you don't you can be the first person to give a damn about this post http://www.thebackshed.com/forum/ViewTopic_mobile.php?TID=12409

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 228
Posted: 06:53pm 13 Sep 2020
Copy link to clipboard 
Print this post

  thwill said  You may know all this already, but in case you don't you can be the first person to give a damn about this post http://www.thebackshed.com/forum/ViewTopic_mobile.php?TID=12409

Best wishes,

Tom


Definitely do!
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 07:09pm 13 Sep 2020
Copy link to clipboard 
Print this post

How about this convoluted scheme?

Editing fred.bas (in flash memory)

On the command line type:

*flip

Parsing * changes to RAM mamory, loads and runs whatever the flip program is, then changes back to flash where fred.bas still is.


It would be like * shells out to the RAM setup.
Edited 2020-09-14 05:10 by CircuitGizmos
Micromites and Maximites! - Beginning Maximite
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 07:24pm 13 Sep 2020
Copy link to clipboard 
Print this post

  CircuitGizmos said  How about this convoluted scheme? ...


I suspect that is a non-starter given switching between FLASH and RAM and vice-versa involves a restart ... something to do with fixing up the address space IIRC.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 07:27pm 13 Sep 2020
Copy link to clipboard 
Print this post

  thwill said  
  CircuitGizmos said  How about this convoluted scheme? ...


I suspect that is a non-starter given switching between FLASH and RAM and vice-versa involves a restart ... something to do with fixing up the address space IIRC.

Best wishes,

Tom


Ah. Good point.
Micromites and Maximites! - Beginning Maximite
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025