Projects > MasmBasic & the RichMasm IDE

A guide to the RichMasm editor

(1/9) > >>

When you install MasmBasic (a library that allows to use Basic syntax in assembler), the first thing you'll see after clicking OK is the file MbGuide.rtf in MasmBasic's editor called "RichMasm", a special editor for working with assembler source code. It has been designed for long sources, and concentrates on effective navigation rather than on beauty and/or abundance of features. The package includes a number of easy-to-use "skeletons", including dll and library examples.

On a green background, some simple instructions to build your first Hello World are shown.

In the right half of the screen, you can click into a listbox with "found matches", in this case: all 200+ occurrences of the Find string .Mb (an internal code to identify help topics). For example, if you change the string to .Mb*file and hit Enter, the find box will contain all 19 help entries dealing with files. The wildcard * means "find a line that contains both strings"; the string push eax*****pop would mean "find a line that contains push eax and has a pop on the same line or within the next 4 lines".

To the right, there are also a few bookmarks; you can click into them to jump e.g. to the "StringToArray" section. Bookmarks are defined by selecting a (meaningful) text, e.g. start: or Parser proc, and hitting Ctrl D. In contrast to so-called "bookmarks" in other editors, RichMasm bookmarks will be saved with the text, so that you can work with them next time you open the document. Press Alt K to toggle between keys and bookmarks view.

Another way to navigate in the text are the left and right arrows in the upper right corner: The document's history is stored with the source, and by clicking on the left arrow, you can go to sections that you edited earlier. Hitting the Alt Left or Alt Right keys will do the same.

To explore the menus, please go to the top of MbGuide.rtf and left-click on try 90+ snippets as shown below:

A new document opens, MbSnippets.asc.
- Hover over the File menu, it will open without clicking:

As usual, Open, Save, Save as are on top; what you will most frequently need is New Masm source, the F6 and F7 keys, the Guide to MasmBasic, and the recent files list. Hopefully, you will never need the Last good version entry 8)

Some notes:

- New Masm source opens the file Template.asc; click on any link to "create a new project" (hint: "MessageBox" in the upper left corner opens a simple Hello World with really boring grey on black colours). Just edit according to your needs. When you try to save your work, you will be prompted to choose a new name, i.e. you are not allowed to overwrite the template.

- The yellow area "to build any"... on top is an optional extra window that serves to keep a portion of the document visible independently of the current edit position. Imagine you have a structure defined somewhere near the top, and you'd like to see the definition while working with it near the end of the document; just select the lines you want to see and press Ctrl F12 (if nothing is selected, the window disappears).

- The word Init is selected. If you hit F6 (=build & run), RichMasm will search backwards to "include..." and forward to either end start or EndOfCode, and if they are present, it will conclude that user wants to build only the section that contains Init. The whole document has 94 such "snippets", you can build and run them all either by selecting Init by hand, or by clicking into the "94 matches" listbox and hitting F6.

- In the upper right corner under "Find:", the text L1200... indicates Line1200, Column 3, +4 characters selected, 73d is the decimal Ascii code of the selected "I", while 49 6E 69 74h is the hexadecimal representation of Init.

- Now hover over the Edit & Format menu:
There are a number of formatting options, like colours, tabs and fonts, plus functions for exporting selected text. You will need the F4 (comment) key fairly often; when selecting several lines of text, the whole block gets commented out. Pressing F4 again turns comments into code, and in addition colours MasmBasic commands in blue, while push/pop pairs are formatted in red, for obvious reasons.

Hint for those who are scared of coloured code: Press Ctrl A (select all), then twice Ctrl E. The whole text will be black.

- Finally, the menus System & Plugins, Help and AutoCode can be defined in \Masm32\MasmBasic\Res\menus.ini:

Note that the help files, where technically possible, receive the currently selected text for jumping to their dedicated help page.

Here is an example of the output window, which can be toggled pressing the F7 key:

The code contains an error, so when hitting F6, RichMasm highlights the error message in the output window and jumps to the error line in the main edit window.

GREAT post jj.  Keep 'em coming.

Thanks, satpro ;)

One element of the RichMasm philosophy is that a "project" doesn't need to be distributed over a dozen tiny little files. If possible, why not use one single file? Why, for example, should we use a separate resource file, if it can be integrated into the main source? Attached a simple example - a single *.asc file. Open it in RichMasm, edit a resource string (e.g. change "Welcome" to "Good night") and hit F6.

As you can see in the screenshot, the AutoCode menu has an entry "Resource section". Just put the cursor behind GuiEnd (or end start/EndOfCode, wherever your source ends), click this entry and voilĂ , you have now an editable resource section. Every little change that you make can immediately be tested, you don't even have to save first (but do save it when you feel the code is OK 8)).

As of version 19 May 2016, RichMasm can assign keystrokes to menu functions:

- hover over a menu title, e.g. System & Plugins
- move down until the desired function is highlighted, e.g. "Find on disk" (a plugin)
- hold Shift and right-click into the highlighted menu item
- the menu closes, and you see "Press a key" in the status bar in the upper right corner
- press a key, e.g. f

Afterwards, the key sequence F12, f will do exactly what the menu would do. Hitting F12 twice will toggle between the list of shortcut keys and your bookmarks (try also pressing Alt K repeatedly).

Note this is saved immediately, and your shortcuts will not be overwritten by a re-installation of MasmBasic.

RichMasm beta: extract to \Masm32\MasmBasic\RichMasm.exe (you might rename the old one before).
Attachment removed, the beta has been promoted and is now included in the normal release :icon_cool:

Main feature is a much speedier (20*) load of files in the megabyte range. The culprit was the EM_LINEINDEX message. You may test the difference with the F9 key, which displays a file info message:

--- Quote ---File info (when opened):
17.06.2016, 03:14:35, 1720890 bytes in 29146 lines

Loading MasmBasic.asc took 0.70 seconds
--- End quote ---

Other changes:
- in case of assembly errors, the jump to the offending line is now more precise for large files
- searching has become much faster; for example, finding 3483 times eax in the 18,000 lines of the RichMasm source takes now about 50ms on the i5, counted from hitting Return to seeing the listbox; in short: it's immediate


[0] Message Index

[#] Next page

Go to full version