This question really is can you output assembly for a C or C++ program using gcc?
And if so what dialect is it?
If it can be done with gcc could you give me a demonstration of what you enter in the terminal/command prompt?
If it cannot be done how are others looking at the assembly produced by a C or C++ programs? In particularly what are they using and where can I get it?
To convert into normal x86 syntax:
1. Remove the % from in front of the registers: movl $LC0, (%esp) => movl $LC0, (esp)
2. Remove the $ from in front of constants: movl $LC0, (esp) => movl LC0, (esp)
3. Change () to []: movl LC0, (esp) => movl LC0, [esp]
4. Reverse the order of operands: movl LC0, [esp] => movl [esp], LC0
5. Convert instruction size suffixes into prefixes: mov [esp], dword LC0.
GNU as uses AT&T syntax for compatibility with the original UNIX as. It can assemble normal (Intel) syntax code if you put the directives
1 2
.intel_syntax
.noprefix
before the code in Intel syntax, but gcc can't produce Intel syntax code, so if you're using embedded assembly in your C code, you either have to write in AT&T syntax, or set it to use AT&T syntax after a block of Intel syntax code with .att_syntax.
Thank you chrismane but that is not what I am trying to do.
What I am trying to do is learn to do some simple programming in assembly.
But all I have been able to find for references is either old, or manuals. So I wanted to learn how to create some simple assembly and translate it to nasm. If I can do that I think I will have enough information to use the old references and make them work for me.
This tread is been very useful so far and any additional help would be appreciated.
NASM uses x86 assembly as well, it just uses Intel syntax instead of AT&T. I just told you how to convert from AT&T (GNU as) syntax to Intel (NASM) syntax.