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: GermanyPosts: 172 |
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: AustraliaPosts: 6101 |
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: GermanyPosts: 172 |
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: AustraliaPosts: 899 |
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 KingdomPosts: 9139 |
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: GermanyPosts: 172 |
Works like a charm - thanks @disco4now! |
||||
Print this page |