Assembly: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m Turn the first section into the introduction
Remove references to two somewhat useless "bare bone" tutorials and clean up wiki source a bit
Line 34:
There are also some other differences with operands:
 
* Literal values such as 123 are prefixed with '$' (see example above).
* Memory locations have no prefix: mov 123, %eax. Moves the value stored at 123 to eax.
* Registers are prefixed with '%'
* When using a register as a pointer, it is put in parenthesis: mov (%eax), %ebx. Moves the value stored at the pointer stored in eax to ebx.
* When using a statement with memory locations (with no register present), a suffix is needed after the instruction. For example: movl $123, 123. The 'l' (stands for long) is needed to tell the assembler that the values are 32 bits.
* Pointers can be offset by constants by prefixing them: 4(%eax) points to 4+%eax.
* Pointers can be offset by another register by writing them as: (%eax,%ebx) points to %eax+%ebx
* Finally you can combine it all and throw in a scale if you want: 4(%eax,%ebx,2) would be 4+%eax+%ebx*2
 
== See Also ==
===Articles===
*[[:Category:Assemblers|Assemblers]]
*[[Inline Assembly]]
*[[Opcode syntax]] for more detail on AT&T syntax differences
*[[Real mode assembly bare bones]] for a quick starter on writing a kernel in assembly
*[[32-bit assembler bare bones]]: same as above, but for 32-bit protected mode.
*[[Learning 80x86 Assembly]]: list of freely available online resources to help with learning 80x86 assembly language programming
 
===External LinksArticles ===
* [[:Category:Assemblers|Assemblers]]
*[http://www.gnu.org/software/binutils/ GNU Binutils] - An open source collection of software including the GNU assembler (gas)
* [[Inline Assembly]]
*[http://sourceware.org/binutils/docs/as gas manual] - Official manual for the GNU assembler (gas)
* [[Opcode syntax]] for more detail on AT&T syntax differences
*[http://www.nasm.us/ NASM] - Official site of Netwide Assembler:NASM
* [[Learning 80x86 Assembly]]: list of freely available online resources to help with learning 80x86 assembly language programming
*[[wikibooks:X86_Assembly|x86_Assembly]] - A wikibook on writing assembly for x86 based PCs
 
*[http://www.plantation-productions.com/Webster/www.artofasm.com/index.html The Art of Assembly Language Programming], online book, 16-bit DOS edition. (Later editions focus on a high-level assembler dialect created by the author.)
=== External Links ===
*[http://www.drpaulcarter.com/pcasm/ PC ASM], online book, 32 bit protected mode assembly on x86
* [http://www.gnu.org/software/binutils/ GNU Binutils] - An open source collection of software including the GNU assembler (gas)
* [http://sourceware.org/binutils/docs/as gas manual] - Official manual for the GNU assembler (gas)
* [http://www.nasm.us/ NASM] - Official site of Netwide Assembler:NASM
* [[wikibooks:X86_Assembly|x86_Assembly]] - A wikibook on writing assembly for x86 based PCs
* [http://www.plantation-productions.com/Webster/www.artofasm.com/index.html The Art of Assembly Language Programming], online book, 16-bit DOS edition. (Later editions focus on a high-level assembler dialect created by the author.)
* [http://www.drpaulcarter.com/pcasm/ PC ASM], online book, 32 bit protected mode assembly on x86
 
[[Category:Assembly]]