Hello
A long time ago I started coding an editor that I wanted to extend with an internal automation engine for addins. My intention was to use LUA.
Other things got in the way and I only got back to it a few weeks ago.
It was much more complicated than I expected. In particular, synchronising all the editor features is a real challenge. Hats off to those who have managed it. For some features I used RadAsm and Notepad++ as a reference.
Current features are:
Caret management
Scrolling
Insertion and deletion
Drag and Drop
Load/Save/SaveAs file
Syntax Highlithing
Configuration (ini-file) and precoded defaults
Multiple synchronized Views of a single file
Zoom in and out
Line numbering
Copy/Paste/Replace
Undo/Redo
Window management
Not yet implemented:
Interlisense
LUA
Project management
Addins management
etc.
Regards, Biterider
Good luck Biterider :thumbsup:
Editors I use has "undo/redo" menu text
Numbers of undo/redo only limited by memory or like image program setting of max memory to use for undo/redo? Or max number of undo/redo limited to 32, 64?
Hi
I have a question for those who have played with UTF-8 as input for ML/UASM.
Is there anything to be aware of?
For this project, I'm coding the editor code buffer using WIDE chars (Unicode/UTF-16). Now, when I save the content, I want to save it as UTF-8 and pass it to the assembler.
Does this work or are there any pitfalls?
Regards, Biterider
Quote from: Biterider on March 05, 2025, 08:00:13 AMI have a question for those who have played with UTF-8 as input for ML/UASM
Masm, UAsm & friends don't care what you use, as long as it doesn't have nullbytes in it, like Utf-16 does. So just send Utf-8 without a BOM. No pitfalls. The assembler simply doesn't know about that "encoding" stuff ;-)
Example:
Quoteinclude \masm32\MasmBasic\MasmBasic.inc
Init
PrintLine "Введите текст здесь" ; "Enter text here" in Russian
PrintLine "Нажмите на эту кнопку" ; "Click on this button" in Russian
EndOfCode
Now this is RTF, but have a look at the attached plain text source.
Quote from: jj2007 on March 05, 2025, 08:08:30 AMUtf-8 without a BOM
That is key. UTF8 without a BOM looks like, tastes like and smells like a plain, ordinary ANSI ascii text file. You can see this in a hex editor.
On Win 10, Notepad saves as UTF8 (no BOM) by default, and examining the file in a hex editor it looks exactly as if were saved as ANSI ascii. And I spent a lot of time selecting "ANSI" to save with Notepad, until I found this out. Hope this helps...
Saving as UTF8 with BOM in notepad, it appends hex bytes "EF", "BB", BF" to the file. It still opens though with qeditor and when saving, qeditor does not retain the 3 hex bytes.
Now after saving an .asm file as utf8
WITH BOM in notepad, "error A2044: invalid character in file" upon assembling (or trying to) it with ml.exe
For utf8 without BOM, it assembles fine with ml.exe.
Quote from: zedd151 on March 05, 2025, 08:17:53 AMOn Win 10, Notepad saves as UTF8 (no BOM) by default
Indeed, the source above looks right in a Win10 Notepad, but not (yet) in RichMasm and other editors.
Notepad opens both attached files correctly. One is Utf8, the other uses my local codepage. There is no fool-proof way to find out the encoding, so apparently Notepad uses some heuristic method...
Hi
Deciding which file format is best is a case-by-case decision.
UTF-8/16, ANSI are valid options for a good editor. I'll add some entries to the ini file to automatically select the best choice based on the file extension.
One cool feature suggested by HSE is to offset the line numbering on a given line to track macro error messages. It can also be used for other tasks, such as simple item counting.
For testing purposes, I implemented this by right-clicking on the selection bar at the vertical position of the zero line number. A second click resets to normal operation (see attached image).
Regards, Biterider
Hi
Here we go!
In the first post I attached the first binary (alpha release).
Source code can be downloaded from Github.
For those who want to experiment, open the zip file and extract the 2 files into the same folder.
At the moment the files are opened and saved in UTF-8 format. The 2 windows on the left have no functionality yet.
Any feedback is very welcome.
Regards, Biterider
Quote from: Biterider on March 10, 2025, 07:44:15 AMSource code can be downloaded from Github
Link?
The editor runs but I don't see the window. Quick test:
include \masm32\MasmBasic\MasmBasic.inc
SetGlobals hWin, rc:RECT
Init
.if WinByTitle("Assembler Development Environment")
mov hWin, eax
invoke GetWindowRect, hWin, addr rc
deb 4, "The window", rc.left, rc.top, rc.right, rc.bottom
invoke MoveWindow, hWin, 27, 27, 1200, 666, 0
invoke ShowWindow, hWin, SW_MINIMIZE
invoke ShowWindow, hWin, SW_RESTORE
.endif
EndOfCode
The window
rc.left 32767
rc.top 32767
rc.right 34067
rc.bottom 33507
Is there somewhere a shr in the source that should have been sar?
Attached an exe to make it visible. Looks good :thumbsup:
Hi JJ
Thank you for giving it a try :thumbsup:
The sources are here https://github.com/ObjAsm/ObjAsm-C.2/tree/master/Projects/X/AsmDevEnv (https://github.com/ObjAsm/ObjAsm-C.2/tree/master/Projects/X/AsmDevEnv), but keep in mind that this is an alpha release. There is still a long way to go.
The effect you see is because I fixed the window size to my screen resolution while testing the application. I simply forgot to reset it back to the normal operation.
Regards, Biterider
Hi
I'm making some progress with the ASM-IDE and the code editor. I managed to add some functionality but the project is still in alpha state.
If anyone wants to take a look and test it, I have updated the binary in the first post. The source code is also updated on GitHub.
Feedback is welcome.
Added feature list:
- Text highlighting of selected word
- Clipboard functions (Cut, Copy, Paste, Delete)
- Zoom in/out
- Block, Insert and Overwrite modes
- Touch gestures (Pan & Zoom)
- Horizontal mouse wheel support
- File formats (ANSI, WIDE, UFT-8, UTF-16-BOM)
- Line termination (CR, LF, CRLF)
- Save/SaveAs new style dialog
- Load new style dialog
- Drag & Drop
- Control Keys
- Search modeless dialog (Dynamic Layout)
- General menu languages (English, German, Italian, Russian, Spanish)
- Toolbars (File, Edit, Window)
- Statusbar Information
- Configuration Ini-file
- Project Ini-file
- SEH protection
- Find and Replace functionality
- 32 and 64 bit release versions
- Fast loading (~100MB/s) and rendering
Regards, Biterider
I really liked the interface style.
Quote from: Biterider on April 09, 2025, 06:37:24 AMSEH protection
What's that?
Hmmmm....: Error: Unknown file format for ADE.asm
Hi
I forgot to add the 2 ini files. Without them, you only see the defaults.
All files are now in the first post. Sorry.
Biterider
Hi JJ
As for the SEH protection, I only added a Structured Exception Handling frame to a few critical code paths to prevent total loss in case of a crash.
Still not everywhere - alpha code :rolleyes:
Biterider
Can't run it in Windows 7 x64
Hi Timo
What is the problem you are seeing running it on Win7?
Biterider
Quote from: Biterider on April 09, 2025, 07:27:42 AMAs for the SEH protection, I only added a Structured Exception Handling frame to a few critical code paths to prevent total loss in case of a crash.
So what happens if user has coded some kBytes and suddenly the electricity goes off? Or he gets a BSOD, etc? When simulating a crash by killing ADE.exe from Task Manager, the edits are apparently lost.
With RichMasm what happens is that on next launch user will be asked "You may have had a crash. Use last saved version?"
Actually, it's not the last
saved version. It is what was on the screen before it crashed. RichMasm does nothing if you type like a madman, but if you stop typing for more than 5 seconds, it saves a mylastsource.tmp file. When you save and exit, the tmp file gets deleted.
Now when you restart RichMasm, and it finds mylastsource.tmp in the folder of that source, it recognises that there was a crash and offers to restore the latest version.
I rarely see crashes, but in some cases (forced logoff...) this little feature saved me ;-)
Quote from: Biterider on April 09, 2025, 04:36:12 PMHi Timo
What is the problem you are seeing running it on Win7?
Biterider
AMD CPU
(https://i.postimg.cc/XGMxr6yB/Clipboard-04-09-2025-01.png) (https://postimg.cc/XGMxr6yB)
(https://i.postimg.cc/YLM3xNRp/Clipboard-04-09-2025-02.png) (https://postimg.cc/YLM3xNRp)
Hi Timo
These screenshots helped a lot. The problem seems to be that the CPU or this particular version of Win7 does not support AVX instructions. Win7 starting with SP1 does support them, but I think the problem is the old CPU.
I can step down with the supported instruction set and only use e.g. SSE/SSE2.
Biterider
Hi Timo
Here is the same version as in the first post, but without AVX or SSE support, which is not a big deal for this application. I hope it works for you now.
Biterider
Thanks, now it works.
Toolbar tooltips could be useful.
Hi JJ
Quote from: jj2007 on April 09, 2025, 05:03:28 PMbut if you stop typing for more than 5 seconds, it saves a mylastsource.tmp file.
This is certainly an interesting and good feature that can be added without much effort.
There are 2 messages for closing a session: WM_QUERYENDSESSION (https://learn.microsoft.com/en-us/windows/win32/shutdown/wm-queryendsession)/WM_ENDSESSION (https://learn.microsoft.com/en-us/windows/win32/shutdown/wm-endsession)
I have used the former in the past to trigger such data storage tasks.
Note: The editor does not do this yet
Biterider
Hi Timo
Quote from: TimoVJL on April 09, 2025, 09:16:00 PMToolbar tooltips could be useful.
The code is there, but I do not have all the translations for the supported languages. I decided to leave that until I have all the code in place and know all the messages I need to display.
Biterider
Hi
I have implemented a few more features:
- WM_QUERYENDSESSION logic
- File->New now has the option to select the editor template
- Same functionality for the "New" toolbar button using a drop down button.
- 3 editor templates: MASM, Resource & Plain Text. Each template has its own settings in the ini file
- Information in the status bar what the application thinks it is editing
- Tooltips for the toolbars
- Drag & Drop automatically detects the file content and selects the best template.
Update on the first post.
I think it is time to implement the Undo/Redo feature. ATM I have no good idea how to implement it. Has anyone done this before?
Regards, Biterider
Quote from: Biterider on April 11, 2025, 06:43:34 AMI think it is time to implement the Undo/Redo feature
What do you mean? The RichEdit control does it automagically...
Hi JJ
Im not using the RichEdit control. The editor is coded in pure asm!
Biterider
You are courageous :thup:
ADE open sqlite3.c in blink of eyes :thumbsup:
sqlite3.c size was just 9 MB :biggrin:
So great wiewer for big files :thumbsup:
QuoteI think it is time to implement the Undo/Redo feature. ATM I have no good idea how to implement it. Has anyone done this before?...
I did it in a very special "my" way, but you will have to wait until I finish and publish my Template64 project for more details.
Quote"What do you mean? The RichEdit control does it automagically..."
You know very well that it is almost impossible to implement Do/Undo together with syntax highlighting. That is why your editor does not have syntax highlighting. :smiley:
Quote from: TimoVJL on April 11, 2025, 08:50:55 PMADE open sqlite3.c in blink of eyes :thumbsup:
sqlite3.c size was just 9 MB :biggrin:
So great wiewer for big files :thumbsup:
Some stats for you Biterider... by merging many many multiples of windows.inc from masm32 SDK.
I have made a huge file... not that I would expect any assembly source codes to be that large but who knows? :tongue:
21521600 lines of text
781929600 bytes filesize
On my computer running an i7,
1. Using ADE, around 7 seconds for file to be displayed. Scrollable in full (even to the bottom), immediately after the file is displayed. :thumbsup:
Big Huge improvement over programs that do use RichEdit.
2. Using qeditor, around 13 seconds to display the file, but
still loading in the background. Not scrollable until
fully loaded. Even then, scrolling to the bottom is nigh impossible. :thdn:
3. Using Notepad, the program still loading after 30 seconds. Had to close via Task Manager. :thdn: :thdn: :thdn: I didn't explore Notepad any further. :biggrin:
Side note:
Some time ago, I had experimented with using a couple of smaller buffers (1000 lines I think) which rotated and streamed the text into a RichEdit control from either of the two small buffers. That was even much faster than streaming into the RichEdit control in one pass. I forget a lot of the details, but do remember it was tricky to implement and get it right, as well as work transparently to the user. I may still have that code somewhere buried in my archives.
Later: I remember now, I was playing around with making a hex editor back then... custom coded ascii hex byte selection, and corresponding ascii selection (if ascii text file was open) at the same time iirc, big phun.
I looked for it btw, everything that I had before 2019 is lost. I forgot about that, too. Long story about a 64 GB micro SD card... that I used for backups, old files etc. I never found the tiny thing.
I finally had a chance to actually look at your IDE in operation.
Looks nice, but I found a minor issue.
WHen selecting a series of spaces in the whitespace, there appear to be some sort of beige highlighting the same size as the selection but elsewhere in the editor. It doesn't appear to have any effects other than looking odd.
Example the selection I made is in green:
(https://i.postimg.cc/h4rVcr3z/untitled4.png)
There are a couple more images in the attachment.
Hi Zedd
These are the things I'm interested in. The caret logic is a tricky one and needs a lot of attention.
Besides the screenshots, I'll need the file that's causing the problem. Is that OK?
Biterider
Quote from: Biterider on April 12, 2025, 04:44:53 AMI'll need the file that's causing the problem. Is that OK?
3 different files in the zip, corresponding to the images zipped and attached already above.
Attachment removed as it has served its intended purpose.
Thanks Zedd :thumbsup:
I found the problem. It was a logic error in the selection check in the highlighting implementation.
This feature highlights text in the view when a word is selected, for example when you double-click on a word. This allows you to immediately see other occurrences in a procedure. This is very useful when examining or refactoring code.
The fixed version is in the first post.
Regards, Biterider
You're welcome.
Hi
After reading what other coders have done to implement undo/redo for editors, I came up with some ideas on how it could be done.
The interesting thing is that it can be done by tracking changes on each editor separately, or globally.
This means that in the latter case, if you make changes to different files (editors) and you can undo them seamlessly. The downside is that in this case you can't just undo the changes in a particular editor and leave the rest untouched.
For now, I think I'll go with the global approach.
Biterider
Admin EDIT:
In 'approving' this rather 'Cryptic' informationless post, I thought it perhaps useful to include further information.
The provided 'link', points to an article called "Piece Chains", being a seemingly good and informative article on Editors by a chap called James Brown; https://www.catch22.net/about/ (https://www.catch22.net/about/)
A LESS Cryptic and perhaps more helpully descriptive 'link' than that posted by the member:
https://www.catch22.net/tuts/neatpad/piece-chains/ (https://www.catch22.net/tuts/neatpad/piece-chains/)
->? (https://www.catch22.net/tuts/neatpad/piece-chains/) Original 'link' ??? I mean honestly,.. ??? :rolleyes:
NB: As Many people here are often (and very possibly rightly-so), cautious about merely opening, Non Described 'links'. May I suggest if your'e intention is to provide useful and helpful information, it surely can't hurt to spend just a small amount of time and effort to provide some information regarding What the 'link' is about etc.
Hi
As my string tables are growing fast, I decided to try ChatGPT to do the job for me. Basically, I provide the English string table in the resources section, from which all displayed texts in the application come.
The idea: all other languages supported by the application should be translated by an LLM.
As a short example, I want to translate this into German, where some lines should only be partially translated:
IDLANG_ENGLISH + 00, "&File|File commands"
IDLANG_ENGLISH + 01, "&New|Create a new file"
IDLANG_ENGLISH + 02, "&Open...~Ctrl+O|Open a file"
IDLANG_ENGLISH + 03, "&Save~Ctrl+S|Save to file"
...
IDLANG_ENGLISH + 40, "&Language|Language selection"
IDLANG_ENGLISH + 41, "&English|English language"
IDLANG_ENGLISH + 42, "&Deutsch|German language"
IDLANG_ENGLISH + 43, "&Italiano|Italian language"
...
Using this ChatGPT prompt:
Translate the following lines to german following these rules:
For lines containing a number between 41 and 45 (inclusive), keep the text between the first quotation mark and the "|" character unchanged, and only translate the text after the "|" character to German.
Replace every occurrence of IDLANG_ENGLISH with IDLANG_GERMAN.
Ensure the final result is grammatically correct.
the result can be directly be pasted into the .rc file :thumbsup:
IDLANG_GERMAN + 00, "&Datei|Dateibefehle"
IDLANG_GERMAN + 01, "&Neu|Neue Datei erstellen"
IDLANG_GERMAN + 02, "&Öffnen...~Strg+O|Datei öffnen"
IDLANG_GERMAN + 03, "&Speichern~Strg+S|In Datei speichern"
...
IDLANG_GERMAN + 40, "&Sprache|Sprachauswahl"
IDLANG_GERMAN + 41, "&English|Englische Sprache"
IDLANG_GERMAN + 42, "&Deutsch|Deutsche Sprache"
IDLANG_GERMAN + 43, "&Italiano|Italienische Sprache"
...
I have done this for German, Italian, Russian and Spanish and it works like a charm. :bgrin:
Regards, Biterider
Hi
I now have a concept and strategy for implementing the Undo/Redo feature. :cool:
Initially, I was on the wrong track, thinking that Undo/Redo should be a global feature across all open editor instances.
However, if you look at modern and advanced editors, they implement this feature per editor instance—meaning each editor tracks its own changes.
This approach is much simpler!
That said, what seems simple now can become quite complex when it comes to caret manipulation.
One possible solution might be to disable caret handling after an Undo/Redo operation and require the user to manually re-position it.
Biterider
Quote from: Biterider on April 16, 2025, 02:37:00 AMInitially, I was on the wrong track, thinking that Undo/Redo should be a global feature across all open editor instances.
However, if you look at modern and advanced editors, they implement this feature per editor instance—meaning each editor tracks its own changes.
:thumbsup: Yes. Trying to track changes across several instances globally would be a monumental feat, and undoubtedly lead to hard to track bugs.
Still, even doing it per editor instance is a very ambitious plan, to do it without the benefit of any aids like RichEdits built-in Undo/Redo capacity. I applaud your determination.
Hi
Finally, I was able to implement the undo/redo feature, which was not as complicated as I expected, but not trivial either.
It boils down to having some basic insert and delete routines for characters and lines in a way that they complement each other. For example, you can undo the insert routine with the delete routine and vice versa.
Once that is in place, it is a matter of keeping track of the changes and sending them to the right routines to undo or redo an action.
A key element is the grouping and aggregation of actions. For example, deleting several lines at once needs to be perceived as a single action, not as deleting one line at a time. The solution is to group all these deletions together and process them together.
Aggregation is slightly different because it groups together single actions, such as keystrokes when typing a word. The whole sequence of keystrokes must also be perceived as a single action.
After implementing all this, I uploaded the new binary in the first post. I also added indentation/outdentation and comment/uncomment to the toolbars, and disabled SEH for the time being to make it easier to find the bugs.
Regards, Biterider
Hi
Having done "most" of the core work, there is still the project management code to do.
In this respect, I would like to know what the general preferences are.
- Should the project files be organised by category in a tree view like most IDEs?
- How fast should the project files be accessible? (max 2-3 clicks?)
- How should the tools be organised? (by menu entries, be project entries in the tree view, ...)
- How should the toolchain be organised for maximum flexibility?
Regards, Biterider
As i am a Pelles C user, so i like to see project files in tree view.
Project files should be in form, where every object files are in their own folders.
So 32 / 64 bits and release and debug having own result folders
Hi
Thanks Timo. :thumbsup:
Lets see what other people here think.
There is one thing I haven't mentioned. That is code folding.
For those who use it, I have seen it done for other modern languages by simply using indentation.
Compared to using folding rules, this can be a big advantage for asm. With indentation, the coder can manage what he wants to see and what he does not want to see.
Similar to the way rules work, you have a trigger line at a lower indentation with a + or - square to show or hide the more indented lines.
I like this way because it gives a lot of flexibility.
Regards, Biterider