Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:50 29 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 : Simple scripting for MMBasic?

Author Message
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 172
Posted: 11:25am 02 Apr 2023
Copy link to clipboard 
Print this post

Hi,

I played with the new LIBRARY commands and this is really useful; for my robot project, now the whole robot API can go into a library, which makes the (different) main programs much easier to maintain. Wonderful!

This said, I found editing and comprehensive testing of libraries rather awkward, because it requires many commands and there is the danger of overwriting the wrong flash slot.

I understand why commands like LIBRARY cannot be part of a Basic program. But if these commands could be scripted, that would be really useful.

Say, a text file with one command per line on the internal flash drive could be executed. The MMBasic command line would just have to execute each line - as if it was typed in.

Switching to editing a library could be done by a file containing:
flash overwrite 1
library delete
flash load 3
edit


Going back to editing the main program:
flash overwrite 3
library save
flash load 1
edit


Also complex configurations (as a list of option commands) could be managed as a text file.

Just an idea.

Cheers
Thomas
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6101
Posted: 11:35am 02 Apr 2023
Copy link to clipboard 
Print this post

MMEdit uses MMC files (MaxiMite Command) and programmable macro buttons

TeraTerm has ttl files for Macros.

Both will do much of what you are asking.

Jim
VK7JH
MMedit   MMBasic Help
 
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 172
Posted: 06:41am 08 Apr 2023
Copy link to clipboard 
Print this post

  Quote  MMEdit uses MMC files (MaxiMite Command) and programmable macro buttons

TeraTerm has ttl files for Macros.

Both will do much of what you are asking.


Thanks for the pointers.

Yes, that is true but what I particularly like about MMBasic is that you can do (almost) everything from inside the prompt, that is, without external tools except a terminal program. My scripting (or rather simple batch processing) suggestion would be consistent with this idea.

My professional life is software-wise complex enough
Interacting with MMBasic in a terminal is a nice counterpoint to that.

Anyways, was just a thought.
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 899
Posted: 11:03am 09 Apr 2023
Copy link to clipboard 
Print this post

Using the latest RC3 you can get a bit of help using the programmable function keys.
OPTION ESCAPE will allow use of \r\n to send the CR+LF to enter the command. This is shorter than CHR$(13)+CHR$(10) as you only have 64 characters to play with. Once the function key Options are set you don't need OPTION ESCAPE anymore,just when you are programming them.
You can stack commands into the function key as you would on a single command line, i.e. separated by a colon. LIBRARY SAVE can only be used as the last command in a sequence as it will do an implicit NEW to clear the main program and this will clear any trailing commands. So to manage the Library you first save your initial Library source with
FLASH SAVE 3
Then save something to FLASH 1 so that a FLASH OVERWRITE 1 will not complain.

Now you can manage the Library with F7,F8 and F9
i.e.
F7 - Save Main and Edit Library
F8 - Save Library and backup
F9 - Restore Main and Edit

Just do a SAVE "MAIN" and SAVE "LIBRARY" to put them onto the file system a regular intervals in case you press F7 or F8 at the wrong time.
A:/
  <DIR>  .
  <DIR>  ..
  <DIR>  tests
  <DIR>  tmp
00:00 01-01-2000          4  bootcount
00:43 01-01-2000         46  library.bas
00:40 01-01-2000         44  main.bas
4 directories, 3 files


Program the keys as below.

> option list
PicoMite MMBasic Version 5.07.07RC3
OPTION FLASH SIZE 16777216
>
>
> option escape
>
> option F7 "flash overwrite 1:library delete:flash load 3:edit \r\n"
>
> option F8 "flash overwrite 3:library save \r\n"
>
> option F9 "flash load 1:edit \r\n"


Should look like this.

> option list
PicoMite MMBasic Version 5.07.07RC3
OPTION FLASH SIZE 16777216
OPTION LIBRARY_FLASH_SIZE  20000
OPTION F7 flash overwrite 1:library delete:flash load 3:edit

OPTION F8 flash overwrite 3:library save

OPTION F9 flash load 1:edit


Latest F4 Latest H7
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 11:13am 09 Apr 2023
Copy link to clipboard 
Print this post

  Quote  This is shorter than CHR$(13)+CHR$(10) as you only have 64 characters to play with.

In either case the function will only have 1 character. i.e. makes no difference except to the amount of typing to enter
 
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 172
Posted: 06:44am 10 Apr 2023
Copy link to clipboard 
Print this post

Works like a charm - thanks @disco4now!
 
Print this page


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

© JAQ Software 2024