Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:45 28 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 : Edit - Save

Author Message
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 09:50am 08 Nov 2013
Copy link to clipboard 
Print this post

I'm confused by "Save" in edit mode.

Scenario #1
I load a program named adc.bas (load "adc.bas") from the flash drive b:
and then type Edit.
Edit mode appears with the adc.bas file showing.
I change the file and then press F1 "Save".
It puts me back at the > prompt and if I type LIST it shows the changes.

But if I then Load "adc.bas" again, the changes are lost.

Scenario #2
I load "adc.bas" from flash drive b:
then type edit "adc.bas" instead.
I can change the file, press F1 "Save" and when back at the >prompt type
type List and changes appear.

Load "adc.bas" and the changes appear in the file now.

So where does the file get saved in scenario #1 if I don't specify the exact file?
Just to RAM so I have to Save "adc.bas" to save it to the flash drive?

www.elproducts.com
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 12:24pm 08 Nov 2013
Copy link to clipboard 
Print this post

MMBasic is doing the right thing.

If you just used the command EDIT (without a file name) then you will edit the program in memory and that is where your edits will be saved when you press F1 to save.

If you used a file name with the edit command (ie, EDIT "FOO.BAS") then you will edit the file on the SD card and that where your edits will be saved when you press F1.

This is also documented in the User Manual (admittedly briefly).

Geoff
Geoff Graham - http://geoffg.net
 
shoebuckle
Senior Member

Joined: 21/01/2012
Location: Australia
Posts: 189
Posted: 12:28pm 08 Nov 2013
Copy link to clipboard 
Print this post

Hi elproducts,
Yes, a number of people have been confused by this... you are not alone.

The EDIT command has two different modes:
a) Your Scenario 1, in which the program in program memory is loaded into the Editor. It is invoked by just typing EDIT without a file name. In this case, F1 Save in the Editor saves your changes back to program memory. Having done that, you then need to type the command SAVE to save it to SD card or SAVE "<filename>" if you don't want to overwrite the original file.

b) Your Scenario 2, the file is loaded directly from the SD card into the editor without putting it into program memory. It is invoked by typing EDIT "<filename>". F1 Save out of the Editor puts it back on the SD card. This mode allows you to alter a file on the SD card, such as data, without destroying the program in program memory, making it easier and quicker to alter your test data for the next run.

In other words, F1 saves it to where it to where it came from; either program memory (Scenario 1) or SD card (Scenario 2).

Hope this helps.
Cheers,
Hugh Edited by shoebuckle 2013-11-09
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 01:02pm 08 Nov 2013
Copy link to clipboard 
Print this post

If your not doing anything else with OPTION F1 then set it to

OPTION F1 "Save "
or
OPTION F1 "Save" + chr$(13)

Then in scenario 1 you can save your 'memory' edit to the SD with a second press of F1.

Of course if you put the option f1 command in your autorun.bas it will be set every time you turn your unit on.

Cheers.
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 01:44pm 08 Nov 2013
Copy link to clipboard 
Print this post

Thanks for the quick answers.
I did read the manual but just didn't completely understand it, but now I do.
Thanks.
The F1 option is interesting.


www.elproducts.com
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1329
Posted: 09:24pm 08 Nov 2013
Copy link to clipboard 
Print this post

Hi Chuck,
There's a simple AUTORUN program in the Maximite MMBasic library on Geoff's website. MMBasic Library This has the "SAVE" on F1 and a set of other function keys that are often used.

Greg
 
Print this page


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

© JAQ Software 2024