Which is the best asm language for Linux? I kind've narrowed it down to as, gas or NASM.
Which is the best asm language for Linux? I kind've narrowed it down to as, gas or NASM.
as is the system assembler. On Linux, this is always gas.
What is your measure of "best"? I'm pretty sure NASM has better macro support. I'm also pretty sure that gas has better support for low-level manipulation of the ELF output.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Ok I have a few more questions if you don't mind. First, what is ELF output? Second, do you know the official website of something of gas(can't find it for my life with google)? Lastly, can gas be used on windows?
http://en.wikipedia.org/wiki/Executa...inkable_Format
http://en.wikipedia.org/wiki/GNU_Assembler This is not the official website, but just looks for the link at the bottom of the page and you'll find out.
I hate real numbers.
And yes, you can use gas in Windows if you like - it comes as part of the mingw suite.
However, for most assembler code, I tend to use inline assembler in gcc. For nearly all assembler programming, it is only a small portion of code that needs to be written in assembler, the rest can be written in C or C++, and using inline assembler is the best way to achieve that.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I eventually plan to develop for linux so should I go windows or linux gas now?
The syntax and such in gas for linux is the same as gas for windows (or perhaps I should have turned those around)- it is the same assembler, it just outputs the object file correctly for the respective OS's it is meant to output object files for. Obviously, you need to use gas for windows if you want to produce a executable on Windows, and if you want an executable for Linux, you need to use the Linux version. As long as your assembler code in itself doesn't use Windows or Linux specific features (such as calling system calls), you should be fine using the same code for both Linux and Windows.
Obviously, one important question here is "What are you planning to write, that requires assembler". There is very little code that actually NEEDS to be written in assembler.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I kind've need help seeting up the asm compiler. I downloaded MinGW and set the path variables but I'm not sure which command line argument uses gas. Any help here?
In the mingw version that Dev-Cpp includes, "gas" is actually called "as".
As for command line parameters, you may want to do something like this:
Of course, there is a whole bunch of other possible command-line arguments that CAN be useful at times. man-page here: http://linux.die.net/man/1/asCode:as -o mycode.obj mycode.s
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Ok I found it(as). The only problem is I just get a .out file when I'm looking for an .exe. Why am I getting this?
edit::Sorry late post matsp