3

As the title states really, is it possible to write assembly code in visual studio?

Im looking for an easy to use IDE for writing intel assembly language. I looked at a few IDEs a few months ago and unless they required lots of configuration settings (I copy and pasted examples into the IDE) they wouldnt work......

There must be a simple IDE very similar to VS where you can write your assembly, pick CPU and then execute?

user997112
  • 29,025
  • 43
  • 182
  • 361

2 Answers2

3

The inline assembler in Visual Studio isn't reliable, but you can use Visual Studio in conjunction with MASM (the Microsoft Macro Assembler) to write straight assembly programs.

Writing the "glue" code that opens a window, sets up output, etc in assembly is rather painful, so you may find it more comfortable to write most of your program in C++, and just a couple of files in assembly. That way you can start by writing simple test functions in straight assembly, and call them from your C++ framework.

Crashworks
  • 40,496
  • 12
  • 101
  • 170
  • 1
    @Nocturn : It isn't supported on x64. ( http://msdn.microsoft.com/en-us/library/4ks26t93.aspx ) Also, I've noticed some code generation bugs in cases where I inline assemble into the middle of a C++ function - like if I have a big function, and in the middle of it I use an __asm block that tries to load the C++ variables onto registers, occasionally the wrong variable will be loaded, or the registers will be clobbered. It doesn't happen often; I think it's simply that Microsoft isn't supporting the inline assembler much any more, and rare bugs are starting to creep in. – Crashworks Jan 15 '12 at 02:05
  • 1
    @Nocturn What *still* works for me (in x86 anyway), is writing __declspec(naked) functions that are all assembly, and then calling them from C. I haven't hit any compiler bugs doing that yet. I do still sometimes use ordinary inline assembly too, but I have to go and check the generated code (eg with /FACS) afterwards to make sure it came out right. – Crashworks Jan 15 '12 at 02:22
1

This should help you out Setting Up Visual Studio 10 for MASM32 Programming

Romaine Carter
  • 637
  • 11
  • 23