Writing assembly code for the .Net platform

I am an experienced C # developer who wants, for fun, to write some assembly code. I was wondering if it is easier to just write in byte code and somehow use the C # compiler, the linker. I'm a little unsure of how to do this.

Or maybe there is a decent assembly language with a step debugger and other nice things sent on Wednesday that I have to pick up?

Basically, I want to write code to perform calculations and output to the console window.

+6
source share
5 answers

You can write it to MSIL and assemble it through the MSIL assembler ( ilasm.exe ).

As for the debugger, I previously used DILE (DotNet IL Editor) to get through the IL code, it's a bit outdated though .

It seems that DILE is still updated weekly builds.

+2
source

You can write IL code and compile it with ILASM

+6
source

you can use the .net assembly language called CIL

http://en.wikipedia.org/wiki/Common_Intermediate_Language

+3
source

You cannot use the C # compiler to write assembly code. However, you can create Visual Studio "CLR" projects that will compile native C / C ++ with built-in build blocks that you can write in a managed shell so that you can invoke through C #. See CLI / C ++ Tutorials for more details.

You can also look at masm32 , which you can use to write your own x86 build libraries, then use p / invoke to execute them through C #.

Good luck

+2
source

It may be useful to others.

As for editing MSIL, we can dump the assembly file into the IL file using the ILDASM utility and recompile it into the assembly file using the ILASM utility.

Two utilities are included in the .NET SDK.

  • C: \ Program Files \ Microsoft Visual Studio 8 \ VC> ildasm.
  • Open the assembly, for example. my.dll
  • After opening the file, select "File-> Dump". Make sure all the checkboxes are highlighted, and then click OK. You will be prompted to save it as an IL file. I recommend creating a new directory to save as my.IL
  • Open my.IL with your favorite editing tool (I am using Visual Studio .NET 2005/2003).
  • Edit your my.IL and then save it.
  • C: \ Program Files \ Microsoft Visual Studio 8 \ VC> ilasm / DLL X: \ Folder \ my.IL
0
source

Source: https://habr.com/ru/post/890229/


All Articles