News:

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

Main Menu

Notepad++ and assembler

Started by Mikl__, March 04, 2023, 03:15:53 PM

Previous topic - Next topic

Mikl__

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 "^"

avcaballero

Notepad++ is the best editor ever and free  :thumbsup:

Mikl__

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

avcaballero

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.

Mikl__

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

mikeburr

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

Mikl__

Hello All!
Does anyone know how to add the ability to fold procedures/structures for assembly language to Notepad++?

Greenhorn

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 ...
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Greenhorn

#8
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

Deleted attachment, because it was for Scintilla v1.76 ...
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Greenhorn

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
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Greenhorn

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
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Greenhorn

To implement code folding from v2.27 and higher, see Scintilla documentation, section "How to implement folding"
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Greenhorn

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:

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++ ...
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

Mikl__


Mikl__

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?