![]() |
Forum Index : Microcontroller and PC projects : MMEdit update V3.4.18
Author | Message | ||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6223 |
I have been doing more work to make MMEdit more useful with large programs. If you are not worried about fitting your program into the maximite/micromite memory, you can ignore these options. I have put them into an 'Advanced menu' ![]() Some of the options were previously in the 'program' menu and some are also in the preferences window. There are grouped here to speed things up for the enduser. Mark selected lines as comment. A quick way to comment out a section of code. Uncomment selected lines. A quick way to reverse the above action. Mark selected lines as DEBUG. If you have code that is only needed for debugging, it can be marked so that it can easily be converted into comments when debugging has finished, but still be there 'just in case'. Remove DEBUG mark. A quick way to reverse the above action. Mark DEBUG lines as comment. Global action to change all DEBUG lines into comments. Usually just before final release. Uncomment DEBUG lines. Global action when there is still a bug after all! Run external program. Runs a program of your choice. Your code is saved as a temp.bas file and the program is called with the full path to the temp.bas file as a command line parameter. Holding SHIFT will allow you to select the program. When the program exits, your basic program is reloaded. This allows you to use a pre-processor or syntax checker of your choice. By using a batch file, you can run a DOS MMBasic program with your new program made available for acting on. Autorun external on load. Runs the above external program every time load and run is selected. In this case your program in the edit window is NOT updated. Set clock on load. The maximite clock is set to PC time every time you 'load and run' Auto run on load. The maximite is sent the 'run' command after loading the program. Auto crunch on load. Comments are removed from your program before loading. Delete blank lines. Blank lines are removed from your program before loading. CLS on load. The terminal is cleared after loading the program. Run external program was added after a request from a number of users who want to push the boundaries further. If your external program is not able to read the command line with the name of the file, a batch file might be the answer. I have created a simple batch file which demonstrates how to run a program such as Hugh Buckle's crunch program with a small edit to read the file name from a text file. To use the demo, extract the maximite.zip contents to c:\apps\maximite 2014-08-05_011423_maximite.zip Run Advanced/Run external program with the shift key held down navigate to "C:\apps\maximite\rundos.bat" You will probably need to edit rundos.bat to suit your requirements. Other changes include the ability to go directly to the error line in the main edit window when your crunched program fails. After an error, click on the red right arrow in the terminal window. I have also added the missing VT100 codes so you can run towers of hanoi. As usual, you can download the full update from my website or extract the TKN file from mmedit.zip and replace the existing tkn file in the program folder. 2014-08-05_011459_MMedit.zip Jim VK7JH MMedit |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
Everybody (cc Jim) As a Beta user, I can 1000% recommend this release. What a difference it makes to maximising performance and reducing memory footprint. Recommended, go get it !!! Peter The only Konstant is Change |
||||
hwholmes Newbie ![]() Joined: 30/05/2014 Location: United StatesPosts: 10 |
Thank you Jim Bert |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9501 |
I like the auto-crunch idea. Now I can go through my bigger codes, and comment as much as I like, knowing that this will be stripped out for the running version. It's amazing how much memory comments can take up with a bigger program... Smoke makes things work. When the smoke gets out, it stops! |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2946 |
Thanks Jim for your Tireless efforts. I played with some advanced settings and I get this error when I click on `CLS on Load' ![]() Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6223 |
Bugger... It was a missing 'x' from a procedure name. The fix has been uploaded to my website and the attached ZIP has the corrected TKN file Thanks Mick, it was good to catch the bug before too many had upgraded. 2014-08-05_075459_MMedit.zip Jim VK7JH MMedit |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2946 |
Thanks Jim, That works. Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2927 |
Your excellent software keeps getting better! ![]() Many thanks from me too . . . . ![]() WW |
||||
paceman Guru ![]() Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
Yes, thanks from me again too Jim - I've just gotten off using MMEdit and found it upgraded again! Thanks heaps. Greg |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
Hi Jim's 3.4.18 release is a real landmark in helping MMBasic programmers, especially on the uMite, develop better more readable, maintainable and yet smaller code. Apart from Auto-Crunch, the Run External Program facility allows #define, #include operations. With that in mind I have put together a very simple demonstration of how to use this facility to carry out Pre-Processor type operations. 1) Unzip the .zip 2014-08-06_005225_MCPP.zip file to C:\Apps\MCPP, there will be 5 files in C:\apps\MCPP MCPP.EXE C Preprocessor implements ALL C PP directives, eg #include, #define etc. For a full list google MCPP.EXE MyIncludes.BAS Example MMBasic program showing how #include is used to keep definitions separate from code PP.BAT Batch file which interfaces between MMEdit.exe and MCPP.EXE Test#Define.BAS Example MMBasic program showing use of #define Test#Include.BAS Example MMBasic program showing how to include another file 2) In MMEdit V 3.4.18 Open C:\Apps\MCPP\Test#Define.BAS 'Test File for Pre-Processor in MMEdit/MMBasic 'Advanced | shift+Run External Program 'Browse to c:\apps\mcpp\pp.bat 'After the batch has run, the statement I=Million 'will be replaced by I=1000000 'Use Edit | Undo 'to revert back. 'Then try, 'Advanced | Auto run external on load 'then do List All on the uMite. 'If U have Auto-Crunch set ON, then all you will see will be 'Dim I 'I=1000000 'Print I 'None of these comments or #defines etc will be displayed. #define Million 1000000 DIM I 'When tis has been preprocessed, Million should be replaced by '1000000 I=Million PRINT I When you do Advanced | Shift+Run external program c:\apps\mcpp\pp.bat, you should see 'Test File for Pre-Processor in MMEdit/MMBasic 'Advanced | shift+Run External Program 'Browse to c:\apps\mcpp\pp.bat 'After the batch has run, the statement I=Million 'will be replaced by I=1000000 'Use Edit | Undo 'to revert back. 'Then try, 'Advanced | Auto run external on load 'then do List All on the uMite. 'If U have Auto-Crunch set ON, then all you will see will be 'Dim I 'I=1000000 'Print I 'None of these comments or #defines etc will be displayed. DIM I 'When tis has been preprocessed, Million should be replaced by '1000000 I=1000000 PRINT I Note how the #define has been eliminated and "Million" replaced by 1000000. Do Edit | Undo to revert the file back to what it was before PP.bat was run Now do Advanced | Auto run external on load, ie a check mark will be shown. Then also do File | Preferences and set ON Auto-Crunch On Load, and Delete Blank Lines - Save and Exit. Now Download the code to the uMite - Click on the little Blue Man on the RHS of the button Bar. On the uMite, type List All, you should see Dim I I=1000000 Print I > 3) In MMEdit V 3.4.18 Open C:\Apps\MCPP\Test#Include.BAS. This .BAS program demonstrates the use of #include. When you load C:\Apps\MCPP\Test#Include.BAS into MMedit V3.4.18 or later, you should see 'Test File for Pre-Processor in MMEdit/MMBasic 'Advanced | shift+Run External Program 'Browse to c:\apps\mcpp\pp.bat 'After the batch has run, extra lines will be appended 'to the file. 'Use Edit | Undo 'to revert back. 'Then try, 'Advanced | Auto run external on load 'then do List All on the uMite. 'If U have Auto-Crunch set ON, then all you will see will be 'Dim I 'I=1000000 'Print I 'None of these comments or #directives will be displayed 'Include some useful constantrs #include "MyIncludes.bas" DIM I I=Million PRINT I 'Declare a Switch on pin 10 #define SW 10 SETPIN SW,DIN IF PIN(SW)=OnState THEN PRINT "Switch is ON" ENDIF IF PIN(SW)=OffState THEN PRINT "Switch is OFF" ENDIF 'Show True/False definition in use DIM A A=True IF A=True THEN PRINT "A is True" ELSE PRINT "A is False" ENDIF Note that there are several Symbolic values in the source, ie Million, SW, OnState, OffState, True, but those symbols have NO definition within Test#Include.BAS. The line #include "MyIncludes.bas" at line 24 instructs the pre-processor to insert the file MyIncludes.BAS into this file at this point. MyIncludes.Bas contains the definitions for all the symbols. 'MyIncludes.bas 'Define some useful constants #define Million 1000000 #define OnState 1 #define OffState 0 #define True 1 #define False 0 Now do Advanced | Run external program, MMedit will show 'Test File for Pre-Processor in MMEdit/MMBasic 'Advanced | shift+Run External Program 'Browse to c:\apps\mcpp\pp.bat 'After the batch has run, extra lines will be appended 'to the file. 'Use Edit | Undo 'to revert back. 'Then try, 'Advanced | Auto run external on load 'then do List All on the uMite. 'If U have Auto-Crunch set ON, then all you will see will be 'Dim I 'I=1000000 'Print I 'None of these comments or #directives will be displayed 'Include some useful constantrs 'MyIncludes.bas 'Define some useful constants DIM I I=1000000 PRINT I 'Declare a Switch on pin 10 SETPIN 10,DIN IF PIN(10)=1 THEN PRINT "Switch is ON" ENDIF IF PIN(10)=0 THEN PRINT "Switch is OFF" ENDIF 'Show True/False definition in use DIM A A=1 IF A=1 THEN PRINT "A is True" ELSE PRINT "A is False" ENDIF Note how the Symbols have been replaced with actual valid values. Do Edit | Undo Now download TestInclude.bas to the uMite, ie click on the little blue man. Then do List All on the uMite, you should see List all Dim I I=1000000 Print I SetPin 10,DIN If Pin(10)=1 Then Print "Switch is ON" EndIf If Pin(10)=0 Then Print "Switch is OFF" EndIf Dim A A=1 If A=1 Then Print "A is True" Else Print "A is False" EndIf > This is 100% MMBasic code with all the directives removed, and no unnecessary variable declarations just so that one can use readable symbols instead of codes. I hope this explanation of one possible use of the "External program" feature in MMEdit V3.4.18 or later is helpful to understand how to use this new powerful facility to make even better, more readable, more maintainable and more compact MMBasic programs, especially on the uMite. Another possible use for "External Program" feature is a post-processor a la Hugh's Crunch written in C/C#/VB/Delphi/LB for speed and features, but that's for another day 73s Peter The only Konstant is Change |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
Hi the PP.BAT I posted earlier as part of the .ZIP file has to be located in c:\apps\MCPP or else you have to edit PP.BAT to reflect where it is stored. This slightly updated version of PP.BAT self-determines wherever it is located thus requiring no editing at all wherever you should choose to place the files - the trick is %~dp0, is that obscure or what ! So please copy and overwrite your existing copy of PP.BAT @echo off chdir /D %~dp0 Rem Batch File to interface MCPP.EXE to MMEdit.exe V3.18 or later MCPP.exe -k -P -C -@oldprep %1 -o MCPPout.pp copy MCPPout.pp %1 Del MCPPout.pp Rem Uncomment the following line if U want see what the batch is doing Rem pause exit 2014-08-06_191520_PP_BAT.zip 73 Peter The only Konstant is Change |
||||
hwholmes Newbie ![]() Joined: 30/05/2014 Location: United StatesPosts: 10 |
Love the Advanced features ![]() I believe I have found another bug in the Chat window. It might be in the font you are using but I didn't find any way to change it so I can't verify. The character "\" backslash, used for integer division, shows up as a " " blank in a program list. Example : T$ = T$ + UOMs$(x) + ":" + Str$(T \ UOMs(x))+ " " ![]() as seen in the editor looks like: T$ = T$ + UOMs$(x) + ":" + Str$(T . UOMs(x))+ " " ![]() In the listing in chat window. Note: I had to substitute something (".") for the blank because the forum posting function shrinks multiple spaces to just one. Bert |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6223 |
Ahhh! It only happens in the VT100 mode. the "\" character is used to indicate "printing text" in Liberty Basic. I will have to do some thinking in order to get it to print the "\" as the first character and as I print each character individually, every character is a first character. Thanks for finding the bug. I will have a fix of some sort in a day or two. Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6223 |
I think this update will solve the problem with "\" in the terminal window. Replace the MMEdit.tkn with the one in the attached ZIP. I have to do some more testing before updating the full program on my website. 2014-08-16_020946_MMedit.zip Thanks for finding the bug. It's one that has been there from the beginning! Jim VK7JH MMedit |
||||
halldave![]() Senior Member ![]() Joined: 04/05/2014 Location: AustraliaPosts: 121 |
Jim, I have an enhancement request for mmedit I would love you to consider I am using long variable names, for ease of program documentation, however I foresee a memory limitation brewing. could you consider at the time of upload to maximite / micromite checking for the existence and if it does reading in a translation file. eg. TEST.BAS translation file TEST.VAR The translation file maps long variable names to short variables, comma delimited longvariable,shortvariable xLoop4.Port,A01 xLoop4.Zone4.Enabled,A02 xLoop4.Zone4.Type,A03 xLoop4.Zone4.ZoneTriggered,A04 ... when mmedit crunches and does it's magic, it also translates long variable names to short variable names, therefore saving memory regards David |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
Hi Dave This is what a pre-processor was invented for ! I think that maybe #define may work here as in #define xLoop4.Port A01 #define xLoop4.Zone4.Enabled A02 #define xLoop4.Zone4.Type A03 #define xLoop4.Zone4.ZoneTriggered A04 This idea uses MCPP. The only concern I have is that including "." in variable names is NOT allowed in C and hence MCPP might not do what we would like it to do ! 73 Peter2014-08-18_234313_MCPP.zip The only Konstant is Change |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6223 |
The other method is to use the MMBasic crunch program which will do the same (and more) It is a bit clumsy but You can do it with a batch file to start DOS MMbasic and then run crunch on your program. It does make your program unreadable unfortunately. I have avoided going that far in MMEdit because I don't trust it to be 100% safe. A bulk 'find and replace' would probably work OK with the variable names you are using but if someone used short 'simple' variable names and then tried to shorten then further, I see grief. Jim VK7JH MMedit |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |