The MASM Forum

General => The Campus => Topic started by: Mikl__ on March 04, 2023, 03:15:53 PM

Title: Notepad++ and assembler
Post by: Mikl__ on March 04, 2023, 03:15:53 PM
Hello everyone!
Decided to switch from compiling. linking and editing asm files in Far.exe to Notepad++.exe. Installed NppExec. Created a script
cls
set masm64=d:\masm39
cd "$(CURRENT_DIRECTORY)"
cmd /c if exist errors.txt del errors.txt // removed program garbage from the previous one
cmd /c if exist $(NAME_PART).obj del $(NAME_PART).obj // success or failure
cmd /c if exist $(NAME_PART).exe del $(NAME_PART).exe // project
cmd /c $(masm64)\bin\ml64 /Cp /c /I"$(masm64)\Include" $(FILE_NAME) >> errors.txt
if $(EXITCODE) !=0 goto exit // exit if there are errors
cmd /c $(masm64)\bin\link /SUBSYSTEM:windows /LIBPATH:"$(masm64)\Lib" /entry:WinMain $(NAME_PART).obj /LARGEADDRESSAWARE:NO  /BASE:0x400000 /STUB:$(masm64)\bin\stubby.exe >> errors.txt
if $(EXITCODE) !=0 goto exit // exit if there are errors
cmd /c $(NAME_PART).exe // run the resulting executable
del errors.txt // in case of launch, delete unnecessary files
del $(NAME_PART).obj
:exit
In order not to produce a bunch of different bat files to create GUI, CONSOLE, DLL, SYS, I wrote the first line in the asm file; GUI#and in the bat-file there was a parsingfor /f "eol=# tokens=2-3" %%A in (%filename%.asm) do (
set kind_of_file=%%A
if %%B == # exit /b )
goto %kind_of_file%
where there is a transition to the label in the bat-file :CONSOLE, :GUI, :DLL and then the exe-/dll-/sys-file is assembled according to its own rules. How to organize this in Notepad++? How to provide creation of exe(GUI/CONSOLE), dll, sys in one script?
How to output long strings in a script? In the bat file, I escaped the transition to another line with the symbol "^"
Title: Re: Notepad++ and assembler
Post by: avcaballero on March 04, 2023, 08:43:56 PM
Notepad++ is the best editor ever and free  :thumbsup:
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 04, 2023, 10:04:26 PM
Hi  caballero!
can you tell us how you work with Notepad++? I'm just a beginner in Notepad++, I need something to build on
¡Hola caballero!
¿Puedes decirme cómo trabajas con Notepad++? Solo soy un principiante, necesito algo para construir
Title: Re: Notepad++ and assembler
Post by: avcaballero on March 04, 2023, 10:24:12 PM
Well, nothing special, just as a text editor, using syntax highlighting, etc. To compile I use an external bat. I don't use most of the functions it has, even for the text file comparer I use an external program.

To program, I could perfectly use notepad, but I really like, for example, that when you highlight a word, notepad++ marks that word in all the places in the text file. Very useful also with the tags in xml/html.
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 05, 2023, 03:29:43 PM
cls // clear the NppExec console
set masm64=d:\masm39
cd "$(CURRENT_DIRECTORY)"
cmd /c if exist errors.txt del errors.txt // removed program garbage from the previous one
cmd /c if exist $(NAME_PART).obj del $(NAME_PART).obj // success or failure
cmd /c if exist $(NAME_PART).exe del $(NAME_PART).exe // project
cmd /c $(masm64)\bin\ml64 /Cp /c /I"$(masm64)\Include" $(FILE_NAME) >> errors.txt
if $(EXITCODE) !=0 goto exit // if there are errors, print them to the console NppExec
cmd /c $(masm64)\bin\link /SUBSYSTEM:windows /LIBPATH:"$(masm64)\Lib" /entry:WinMain $(NAME_PART).obj /LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:$(masm64 )\bin\stubby.exe >> errors.txt
if $(EXITCODE) !=0 goto exit // if there are errors, print them to the console NppExec
cmd /c $(NAME_PART).exe // run the resulting executable
del errors.txt // in case of launch, delete unnecessary files
del $(NAME_PART).obj
exit // if there are no errors, exit
:exit // if there are errors, then output errors to the NppExec console
con_loadfrom errors.txt
Suppose there are errors during compilation. List of errors in the errors.txt file. How to highlight, for example, in red, the lines with errors in the tut_03a.asm file in notepad++? Assembly: tut_03a.asm
tut_03a.asm(9) : error A2006:undefined symbol : ebt
tut_03a.asm(16) : error A2008:syntax error : in instruction
tut_03a.asm(19) : error A2006:undefined symbol : rsx

Skip the first line, in the second and other lines in brackets are the numbers of lines with errors
Title: Re: Notepad++ and assembler
Post by: mikeburr on March 08, 2023, 10:02:42 AM
same as caballero.. great editor .. functions like ctr-alt to select columns of text for example ..but same use a bat file to compile and link run from the cmd you can then kick the program off from the same and using up arrow just rapidly repeat compile and test
regards mike b
ps thanks for the stuff you sent me regarding 64 bit ages ago.. i got round to setting it up and its working very well to the point where ive generated some fairly hefty programs .. programming for large addressware was a bit of a culture shock as its almost revert to basics in terms of addressing
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 10, 2023, 12:18:11 PM
Hello All!
Does anyone know how to add the ability to fold procedures/structures for assembly language to Notepad++?
Title: Re: Notepad++ and assembler
Post by: Greenhorn on March 10, 2023, 11:41:26 PM
Quote from: Mikl__ on March 10, 2023, 12:18:11 PM
Hello All!
Does anyone know how to add the ability to fold procedures/structures for assembly language to Notepad++?

Many years ago I modified the Assembly DLL for Scintilla, so that it was able to fold MASM assembly directives.
Maybe I still have it on my old hard disk. If you like to, I can search for it and give you the relevant code to modify the current SciLexer module ...
Title: Re: Notepad++ and assembler
Post by: Greenhorn on March 11, 2023, 12:23:01 AM
Hi Mikl__,

found it ...

You have to download the Notepad++ source code and rebuild the Scintilla.dll with the modified LexAsm.cxx ...

Edit: If I recall correctly, you have to declare the FoldASMDoc function in one of the Scintilla headers ... will investigate it ...

EDIT #2: See post here (http://masm32.com/board/index.php?topic=10708.msg118970#msg118970)

Deleted attachment, because it was for Scintilla v1.76 ...
Title: Re: Notepad++ and assembler
Post by: Greenhorn on March 11, 2023, 07:00:32 AM
It seems to be OK with only the LexAsm.cxx.

However, after every update the Scintilla.dll will be overwritten.
So, either you keep a copy of the customised Scintilla.dll or you may contact the developers of Notepad++ or the developers of Scintilla and ask for implementing the FoldAsmDoc function into their source code.

Kind regards
Greenhorn
Title: Re: Notepad++ and assembler
Post by: Greenhorn on March 11, 2023, 07:04:51 AM
Found a more recent version of the LexAsm.cxx ...
I've did it for SciTE v2.27.

EDIT: It's possible that it is from Scintilla developers and since v2.27 you can implement folding via properties file asm.properties ...
END EDIT


See attachment.
(deleted)
Please let me know if it still works with the current Scintilla.dll.

Kind regards
Greenhorn
Title: Re: Notepad++ and assembler
Post by: Greenhorn on March 11, 2023, 07:39:07 AM
To implement code folding from v2.27 and higher, see Scintilla documentation, section "How to implement folding" (https://sphere.sourceforge.net/flik/docs/scintilla-folding.html)
Title: Re: Notepad++ and assembler
Post by: Greenhorn on March 11, 2023, 08:20:48 AM
WTF !  :dazzled:
A lot of things changed in Scintilla. I guess that was the reason why I dropped implementing asm folding from v2.27 ...

These are now the options in the properties file for SciTE (https://www.scintilla.org/SciTEDoc.html):

fold.asm.comment.explicit    This option enables folding explicit fold points when using the Asm lexer. Explicit fold points allows adding extra folding by placing a ;{ comment at the start and a ;} at the end of a section that should fold.
fold.asm.comment.multiline    Set this property to 1 to enable folding multi-line comments.
fold.asm.explicit.anywhere    Set this property to 1 to enable explicit fold points anywhere, not just in line comments.
fold.asm.explicit.end    The string to use for explicit fold end points, replacing the standard ;}.
fold.asm.explicit.start    The string to use for explicit fold start points, replacing the standard ;{.
fold.asm.syntax.based    Set this property to 0 to disable syntax based folding.

However, Notepad++ uses a customized version of Scintilla which uses XML files insted of *.properties files.

Mikl__, it seems you must study the source code of Notepad++ ... https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/lexilla/lexers/LexAsm.cxx
Code is the same as it is in SciTE. Maybe you should ask the developers of Notepad++ ...
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 12, 2023, 11:12:27 AM
Hi, Greenhorn!
Thanks a lot! (https://wasm.in/styles/smiles_s/thank_you2.gif)
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 18, 2023, 08:58:14 PM
Hi All! Can someone tell me how to run hiew32 + asm-file in Notepad++?
Via "Run... (F5)" it is clear how (There is picture in attachment)
How can I will do the same with NppExec?
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 18, 2023, 10:19:32 PM
I figured it out (https://wasm.in/styles/smiles_s/boast.gif)cls
set masm64=d:\first_folder_on_drive\second_folder_on_drive\...
cd "$(CURRENT_DIRECTORY)"
npp_run  $(MASM64)\hiew32.exe $(NAME_PART).exe
Title: Re: Notepad++ and assembler
Post by: Mikl__ on March 19, 2023, 01:22:50 PM
Hello everyone!
Question about syntax highlighting in Notepad++. Standard delivery Menu item "Syntaxes" "A" "Assembly". It seems that the coloring suits, but how to add a fold by procedure (proc-endp), structure/union (struct/union-ends), comment block (comment character-character), entire section (.data, .data?, .code). While I found an incomprehensible functionList asm.xml, the coloring of keywords in stylers.model.xml, the keywords themselves in langs.model.xml
Title: Re: Notepad++ and assembler
Post by: satpro on June 29, 2023, 08:34:13 PM
I am a couple of minutes late  :eusa_boohoo:  to this topic, but I would like to address code folding on NPP.  It does it!  There are keyboard shortcuts to use, but you can see all the options right in the "View" menu.  You will want to look through the plugins (a menu option also), too, because while it is not full of "assembly" stuff, it is loaded with useful tools.  Building any-sized programs is just so easy and hassle-free.

You can mess with the XML files no problem, provided you work with the right ones (there are two sets in the installed version).  You can also work within the program to display ONLY those languages you are interested in, which cleans up the menu a bunch.

After a decade+ I have yet to find its equal.
Title: Re: Notepad++ and assembler
Post by: Greenhorn on June 29, 2023, 09:14:42 PM
Quote from: Mikl__ on March 19, 2023, 01:22:50 PM
Hello everyone!
Question about syntax highlighting in Notepad++. Standard delivery Menu item "Syntaxes" "A" "Assembly". It seems that the coloring suits, but how to add a fold by procedure (proc-endp), structure/union (struct/union-ends), comment block (comment character-character), entire section (.data, .data?, .code). While I found an incomprehensible functionList asm.xml, the coloring of keywords in stylers.model.xml, the keywords themselves in langs.model.xml

Mikl,

you can define code folding via "User Defined Language" in the "Language" menu.

https://notepad-plus-plus.org/resources/
QuoteUser Defined Language files

For some reasons that some languages are not supported by Notepad++, User Language Define System can help you out in this case. This system allows user to define his own language : not only the syntax highlighting keywords definition, but also the syntax folding keywords definition, comment keywords definition and the operators definition.

You can define your language via User Language Define Dialog. However, the language you need may be already defined by someone-else in this User Defined Languages Collection.

https://npp-user-manual.org/docs/user-defined-language-system/
QuoteExt.: ____ will accept a list of zero or more extensions (without the period). Files that match these extensions will be interpreted as belonging to the currently-selected UDL, and will be styled appropriately. These extensions override the default extensions for pre-defined Languages, so if your UDL's extension conflicts with another language's extension, the UDL will take priority. For example Ext.: md mkdn will associate file.mkdn or something.md with your selected UDL.
Title: Re: Notepad++ and assembler
Post by: Mikl__ on June 30, 2023, 06:01:14 PM
Hi Greenhorn!
Thank you very much for your answer. I'll try your tips.