Using MMEdit


The main edit window should work as expected. Many of the standard keyboard shortcuts are there as well as a long list of less common shortcuts.

To understand the workflow of MMEdit, the best place to start with MMEdit V5 is with MM Control Centre.

Use the Control Centre to set up a connection to your micromite device.

The minimum settings needed are:

1.
Device type - picomite, CMM2, micromite etc
Device location. This is usually a serial port  and speed. For picomites using the inbuilt USB port, the baud rate is not significant but must be present.
Only currently connected devices will show in the com port list.
The device location can also be a TCPIP connection in which case you need to supply IP and Port numbers.

2.
You can also add other directives such as settime\ which will cause MMCC to set the device date and time when uploading a BAS file.
The only directives that are used when connecting are device type, and port number etc. All other directives are acted during BAS file upload.

3.
It's worth saving the configuration to a quick launch button for an easy way to select different devices. The nickname for the connected device is entered in text box 4.
To alter a setting, enter the new target directives and save under the same name. The new directives will replace the original settings.

To delete a device, save with the device nickname present but the directive box blank. The device will be deleted on the next MMCC start.

Now when you edit a code file in MMEdit and are ready to send it to your device for testing, one click on the right most tool bar button "Load file and run it"

An alternative way to test code which doesn't require connection to external devices, you can use MMBasic.exe
The original version is text only and is included in the Windows program folder. The first menu item in the Action menu is configured to use this version.
Peter Mather has produced a Windows micromite emulator. To use it for running code directly from MMEdit, you need to create a new "action" menu item pointing to your copy of MMBasic for Windows.

 Once you are comfortable with the basic running of MMEdit and MMCC, you can investigate further enhancements.

If you have code written for a particular device, you can include the 'target directives as the first line of your code. Then when you send the file to MMCC, the included 'target directives are used rather than the manual setting in MMCC.
This saves you accidentally sending code to the wrong device.

 

A closer look at the editor:

Help for MMBasic syntax  is on hand.
Place the cursor anywhere in a keyword and press F1 for a short syntax help for that command. MMEdit looks at the previous word in an attempt to see the word in context. The one line help will appear as a pupup in Windows versions or on the status line for Linux versions.
Shift-F1 will bring up a small help viewer with more detailed help.

The Code Formatter (Alt+O), indents code to make the code easier to follow. 
The Tab can bet set between 2 and 8 spaces and there can be extra indenting to emphasise labels and functions. Try it and see - all indenting is reversible.
Tabs are usually converted to space characters as you type code in.
Pasting text of loading files with tab characters will not be converted until you "Format Code"
Once converted to spaces, there is no going back for tabs within lines but leading indents can be reversed.
If you prefer to leave TABs as Tab characters, there is an option to do this.
Indenting does use some space so there is an option to remove all leading and trailing spaces to save space. 
Formatting code also helps draw attention to miss-matched conditional statements and looping structures.

It is strongly recommended that you convert your files to 'without numbers'.

The source code can have Unix or DOS/Windows style line endings.
When a file is loaded, MMEdit checks the first 1k, looking for <CR>. If any <CR>s are found, it is assumed that the file is DOS format and the full file is forced into DOS line endings.
If no <CR>s are found, the file gets force converted into Unix line endings.
You can always change the endings at any time. Unless your device requires Unix <LF> line endings, it is preferable to stick to DOS <CRLF>
When uploading using AUTOSAVE, the line ending setting in MMCC is used. Files uploaded with XMODEM are not altered.

The various options in the Edit window are remembered between sessions. Under File/Preferences, you can set options that MM Edit always starts with.

New files are pre-filled with up to 10 lines of code.
The default is:
'
OPTION EXPLICIT
OPTION DEFAULT NONE

You can edit this and 'save new file intro' in the File menu.
You can stop it from being used with a setting in the inf file.

Many of the options only affect what you see and are not part of the code.
Saving or sending code to the Maximite will not include these 'features'.

Space characters can be highlighted. A space (or lack of) can cause havoc and can be difficult to see.

Keywords are coloured and converted to uppercase.
You can change that in 'Preferences'
It is preferable to select the correct syntax file for your device. The syntax colouring will vary between devices.
Syntax files are stored in the data folder and you can add your own file. Just copy the format used by the supplied files and your file will be included in the list next time MMEdit starts. Currently, 20 different syntax files are allowed.
The supplied syntax files include many command parameters. You may prefer strictly Commands and Functions only.

F1 will give syntax help and Shift_F1 will give you a comprehensive help on the selected keyword. Not all keywords have extended help.
Just as with the syntax files, users can create their own help files.
The supplied help uses the file 'kw_list.csv' and 'user.csv' is the one you should use. Both files are scanned on startup. There is only one help file for all device variations.
The csv file contains a short one line help hint and a link to a HTML file. If you are adding your own HTML help, the files should be placed in the html sub folder. If you use a name starting with '_' or similar, your files should be safe from getting overwritten with MMEdit updates.

Physical line numbers are useful for debugging. The MM Basic interpreter will indicate which line gave an error. Having Physical line numbers turned on makes it easy to look at that line. Remember that sometimes the error is actually caused by a problem in a previous line.
If you are moving between two or three sections of the code, such as a subroutine and the code body or the initialisation area, bookmarks are very useful.
You can jump to and from subroutines and user functions by highlighting the name and click - you're there. If you don't have function name selected, you will be given a popup list of functions to choose from.

Indenting lines of code can make it a lot easier to read (and debug).
With auto-indent turned on, the indent used will carry forward to the next line.
Backspace when you want to remove the indent and the new indent setting will carry forward. Indent does affect the final code.
You can also go directly to a physical line number with Ctrl+G
'Format' will reformat you code with indents. This is a fast way to check for incorrect structure in your code. Alt-O is a shortcut for 'Format'
Format also converts TABs to spaces.

Transferring your code to the Maximite is achieved with the help of MMCC.

The fast way is to click on the 'Load and Run' button. This will load the current program onto the Maximite.
Using The file manager in MMCC allows you to view and transfer files form the micromite and the PC.
If your device is a picomite, you can transfer directly to and from the flash memory slots.

 Depending on the device and file type, transfers will use AUTOSAVE and LIST ALL or XMODEM to transfer files.

 

Last edited: 21 August, 2022