News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

About the Joy of Writing an Editor

Started by jj2007, October 03, 2022, 10:12:25 PM

Previous topic - Next topic

jj2007

Quote from: MichaelW on July 14, 2012, 02:22:40 AM
I use SciTE for almost everything.
Quote from: NoCforMe on September 03, 2022, 06:54:23 AM
It seems to be all the rage to create yet another editor for assembly code, so here's mine.
Quote from: zedd151 on September 03, 2022, 09:17:14 AMOh, yeah I've got SimplEd. A dialog box based richedit editor. Have made a lot of additions and enhancements to it, mostly for formatting code in my particular (peculiar?) style.
Quote from: hutch-- on September 03, 2022, 11:54:47 AMCode editors are like girlfriends, you pick what you like if it works for you. QE is a pure ASCII editor, programmable menus
Quote from: jj2007 on May 24, 2012, 08:22:24 AM
TinyIDE is a 7.0 kBytes editor that offers a little bit more than Notepad, at least to the assembler programmer :biggrin:

Many of our members have programmed their own editor. Recently I got seriously p*ssed of because when I typed e.g. myDword in the find box, the listbox said "no matches". So I had to click on "Case" to make the search case-insensitive.

One click too much for my taste, so I opened the source and fixed the problem (solution: if there are no matches, I relaunch the find in case-insensitive mode, pick the first match, correct the find box to MyDword and relaunch in case-sensitive mode). So from now on, I'll find matches for wm_command even if the search mode is case-sensitive.

Of course, it took me some time to dig through code that I hadn't touched for years, but the joy of making that beast obey to my wishes was worth every minute I spent on this :tongue:

Below a screenshot (taken a few minutes ago) of my very first editor, written over 30 years ago. It had permanent bookmarks (I couldn't live without, I even had them in MS Word), a sophisticated listbox showing search matches, embedded graphics, and even a plot function. The screen and printer drivers were mine, programmed in 68000 Assembly. The less demanding parts I wrote in GfaBasic. I wrote and printed a whole book with this editor, and a renowned publisher took the photocopies "as is" to publish the book.


HSE

Equations in Assembly: SmplMath

jj2007

Quote from: HSE on October 03, 2022, 11:16:34 PM
Ambar monitor?



By far the best black and white monitor of the 1990ies. My screenshot is taken from the Steem emulator, though.

zedd151

Ich spreche kein deutsch :tongue:  "I don't speak German"
I've failed my German language tutoring by our neighbor Mrs. Kuckla (when I was a tot). But google I think does a fair job.

jj2007

Btw where is your SimpleEd? Did you post it somewhere?

Quote from: zedd151 on September 03, 2022, 09:17:14 AM
Oh, yeah I've got SimplEd. A dialog box based richedit editor. Have made a lot of additions and enhancements to it, mostly for formatting code in my particular (peculiar?) style. Another one that is the base code for one of my plugin builder (for qeditor) programs, and a coupla two or three more editors that are less noteworthy unless I've already sent them to the circular file

zedd151

#5
Oh no, I'd never post THAT code (SimplEd). At least in its current form.  :tongue:
I  could clean it up a bit and also use more standard functions where I thought I had better alternatives at the time. Some of that code is rather clunky for lack of a better term. It all works though, so I keep it for writing code for qeditor plugins as it has its own plugin interface.  :biggrin:
I have also renamed it some time ago to "Plugin Tester". After I finish my current project I'll look into making it 'ready for the masses' (clean it up and add some comments when needed) and post it for anyone interested.
edited to add:
Found a semi-usable version of SimplEd. Will post it later today if I have the time to clean it up a bit and add some comments. Look for it in a thread near you.  :cool:

Here --> SimpleEd

jj2007

Some basic features I expect from an editor ;-)



See the "a" to the upper right of the Find: box? That's the edit history, my MFUF (Most Frequently Used Feature). I rarely use the arrows to the left and right, because the keyboard shortcut is easier to use: Alt right arrow.

Let's say I work on an invoke line, and I need a variable name from a different location. I click on the bookmark that takes me there, copy the name, and then hit Alt right arrow. A millisecond later I can paste it directly to complete the edit.

jj2007

The new feature needs some more testing, but I am confident that I can release it in the coming week :tongue:


NoCforMe

Quote from: jj2007 on October 03, 2022, 11:20:48 PM
By far the best black and white monitor of the 1990ies.

Um, sorry, no: that would have been the Wyse grayscale monitor I had on my (work) desktop in the very late 1980s. Forget the resolution but the display was gorgeous. It could also be turned on its side for portrait mode. Great piece of gear.
Assembly language programming should be fun. That's why I do it.

jj2007

It has bugged me for a while that after clicking on some$, SPI_GETWORKAREA or EM_EXSETSEL I had to manually correct the selection to get the missing red bits selected. So, inspired by Z's editor thread, I solved the little problem :tongue:

  .elseif uMsg==WM_LBUTTONDBLCLK
  call GetTickCount
  mov LbDbl, eax
or ReDblClk, -1 ; a global variable
  .elseif uMsg==WM_LBUTTONUP
.if ReDblClk
and ReDblClk, 0
sm hRE, EM_EXGETSEL, 0, addr txrg
mov eax, txrg.chrg.cpMax
.if eax>txrg.chrg.cpMin ; seltyp==SEL_MULTICHAR doesn't work
sub txrg.chrg.cpMin, 5
inc txrg.chrg.cpMax ; include the character after the end of the selection
lea esi, tmpBuffer
mov txrg.lpstrText, esi
sm hRE, EM_GETTEXTRANGE, 0, addr txrg
lea edx, [esi+4]
xor ecx, ecx ; flag
.if byte ptr [edx]=="_"
inc ecx ; cpMin was decreased
.Repeat
    dec txrg.chrg.cpMin
    dec edx
.Until edx==esi || byte ptr [edx]<"A"
.endif
add txrg.chrg.cpMin, 5
mov eax, txrg.chrg.cpMax
sub eax, txrg.chrg.cpMin
inc ecx
.if byte ptr [esi+eax+2]!="$"
dec txrg.chrg.cpMax
dec ecx
.endif
jecxz @F
invoke SendMessage, hRE, EM_EXSETSEL, 0, addr txrg
@@:
.endif
.endif


if 0         ; timings for double-click correction
         16 µs for selecting MoveWindow
         18 µs for selecting null
         16 µs for selecting ecx,
         18 µs for selecting RECT.
         18 µs for selecting bottom]
         3670 µs for selecting some$
         2353 µs for selecting GETWORKAREA
endif

jj2007

#10
For the curious, this is the plugin-related section of \Masm32\MasmBasic\Res\MenusRM.ini:

[System & Plugins] ; heading
Calculator,calc.exe ; entry
Control Panel,control.exe
Notepad,notepad.exe
Freecell,Freecell.exe ; spaces can be used
-
Import C structure§Converts MSDN structure on\nclipboard to Masm syntax,Plugins\Cstruct2Asm.exe
Find on disk VC§Find files containing\ntwo different strings in C headers,Plugins\FindOnDiskVC.exe #
Find on disk M32§Find files containing\ntwo different strings in Masm32 includes,Plugins\FindOnDisk.exe #
-
#plugins#

[&Help]


Exactly, it's the #plugins# line that makes you see Calculate selection and the Select e.g. '100/4+3' ... tooltip :cool:

(the technique is described here, replies #152 and #154)

jj2007

A little luxury for myself: With one click, I get the most relevant matches for a variety of issues. After 14 years of coding for the editor, I don't always remember where I treated certain issues. So I created the TOC option, and it really helps me to find my way in this 24,000 lines monster :tongue:


jj2007

I had the bright idea to allow true Unicode bookmarks, for our Chinese, Russian or Arabic friends who want to write their comments in their own language.

The good news: It works, see below :biggrin:

The bad news: In order to achieve this little feature, I had to change from RichEdit20A to RichEdit20W, and from RichEd20.dll to MsftEdit.dll - and that's a nightmare if your code is over 23k LOC (see also RichEdit wrap).

After numerous nights of bug chasing and fixing, RichMasm is now stable enough to be released - get it here.


jj2007


jj2007

Just for fun, a new simple editor - just 111 lines of code :biggrin:

Features:
- search with listbox for found matches (RichMasm style)
- select a word and hit F3 to find all matches
- build all button (or hit F6; you need to extract the bldall.bat to the same folder)
- multilingual interface
- remembers last document opened, i.e. just launch the exe to see the last source you worked on
- 8 files MRU menu
- reads plain text *.asm and Rich Text Format (*.asc, *.rtf) sources
- handles spaces in folders and filenames properly
- drag and drop enabled
- handles Unicode filenames properly
- no need to save your current edits, just hit the F6 key (but do save that precious stuff when closing the editor...)



The file above is \Masm32\examples\exampl02\dispatch\dispatch.asm.