I've searched through many places for getting started with assembly, and the only assembler that makes a lick of sense is the one that comes with GNU CC (GCC). If you could please, hear me out and see how much I understand, I will make it entertaining.
I assembled the following working code (project.s) by:
gcc -o Program.exe project.s
.ascii "Hello, world!
.string "line$: 2"
movl %esp, %ebp
movl $CALLED, (%esp)
movl $0, %eax
To start off around the main, < .globl _main > basically sets the _main label globally so that the assembler can find it, since thats what it looks for first.
The _main label shows the start of every assembly program of this type.
pushl is a command to put the frame pointer (Footnote:1) into the stack. This somehow is required for some unknown fairy dust reason. The suffix 'l' stands for long which denotes 32bit (Footnote:2).
movl copies the stack pointer(esp) to the frame pointer (ebp). This is also because of how fairy dust controls the AT&T System V/386 assembler language.
the next movl command calls the CALLED label, and puts all those pretty variables into the stack pointer address in memory. (%address) is for RAM, %address is for registers.
now the printf function is finally called with the (%esp) as the parameter. Maybe also %ebp is a parameter I'm not clear.
Next line just puts 0 into the return register. All values that are to be returned or that are returned from calls go into the %eax register.
ret just says the program is over, go home.
A random question:
What is the purpose of assembled object files built by AS.exe?
A few shouts of starting ASM:
Lots of people say to start with TASM, NASM, FASM, basically put a couple random letters in front of ASM and I've heard it. But the most documentation is what I've seen with 'The Art of Assembly Language'. However I have stereotyped HLA (high level assembly) just as the same thing as using C or C++. I'm sure there are some good background info that can be learned from The Art.. but I don't see any 'assembly language'.
I've footnoted all my sources for this AT&T language, which sums up to be not a lot. If GCC changes everything from C++ into this AT&T language then its a very powerful low level language that I want to learn.
What places if any has tutorials for specifically this AT&T language that is used by GNU AS (GAS)?
Footnote 1: http://www.gnu.org/software/binutils/manual/gas-2.9.1/html_mono/as.html#SEC200