Reputation: 29
I want to do system programming, and I need assembly for some of the stuff I am going to do. The problem is, I cannot find an assembler for a 64-bit computer. I have tried TASM and NASM. With TASM, it won't let me assemble anything, and with NASM, the resulting executable says it's not compatible with my computer. Is there any other assemblers I can use? (I do not want to use one that requires AT&T syntax)
Upvotes: 0
Views: 255
Reputation: 21
If you were using Linux x86_64
$ nasm -f elf -g -F stabs FOO.asm
$ ld -o FOO FOO.o -melf_i386
produces a 32 bit file which can run on 32 bit or 64 bit computer.
$
is the command line prompt for the Linux OS "bash" console. (FOO is an example file name)
$ nasm -f elf64 -g -F stabs FOO.asm
$ ld -o FOO FOO.o
produces a 64 bit executable again for the Linux OS. MS windows would use a different command like win32 or win64 in place of elf or elf64, for example.
$nasm -hf
will give you more info. Sorry, I dumped Windows for Linux 15 years ago. I'm just an assembly beginner myself, so this is about all I can offer. Hope it helps.
Upvotes: 2
Reputation: 28826
If you're running windows, Visual Studio Express (which is free) includes ml64.exe, a 64 bit assembler. A custom build step is needed to invoke ml64.exe, which I think you'll get prompted for the first time you try this, but I create the step manually. I first create an empty project, then choose project, properties, configuration manager, < new >, and select x64 to produce a 64 bit executable. For the custom build step
For debug build:
Command Line:
ml64 /c /Zi /Fo$(OutDir)\example.obj example.asm
Outputs:
$(OutDir)\example.obj
For release build:
Command Line:
ml64 /c /Fo$(OutDir)\example.obj example.asm
Outputs:
$(OutDir)\example.obj
Upvotes: 1