Mike Webb
Mike Webb

Reputation: 9003

Is there a free, small assembly code compiler/assembler for Windows?

What I want is something like g++ where I can type:

compiler_name my_assembly_code.extention

...and have it compile my assembly code. It does not matter whether it's 32 or 64 bit. Just needs to be for Windows.

Does anyone know of one that I can get that does this? I'm open to other suggestions as well, I just want to stay away from having to use MS Visual Studio for doing this.

Upvotes: 2

Views: 4784

Answers (3)

Jerry Coffin
Jerry Coffin

Reputation: 490108

(Almost) any normal distribution of g++ will/should include a copy of gas, the GNU Assembler. Depending on the distribution you get, the command you use may be as or gas (and some include both).

Unfortunately, at least the last time I tried it gas had quite a few bugs. It works fine for code that's generated by gcc/g++, but if you depart much from what it can/does produce, you can run into all sorts of problems. That, however, was some time ago, so these problems may have been fixed -- I don't know for sure.

There are quite a few alternatives as well. NASM is probably the most widely used and gets updated (e.g., for new instruction sets) reasonably dependably.

Upvotes: 4

BlackBear
BlackBear

Reputation: 22979

I personally use TASM, I find it easier that MASM.

Upvotes: -1

user257111
user257111

Reputation:

There's lots.

All of which are capable of generating PE files. However, in order to do that, you need to understand the mode of operation required by said assembler. For example, it is entirely possible to use each assembler to generate obj files for linking, or you can write a pure binary output. If you do that, you'll need to create the appropriate executable header.

Flat assembler provides the FORMAT PE directive (see here) which greatly simplifies this process.

Upvotes: 10

Related Questions