Difference between revisions of "Assembly Language"

From CDOT Wiki
Jump to: navigation, search
(Created page with 'Category:Computer Architecture ''Assembly language'' is a symbolic representation of machine language. It is therefore [[Portable|architecture-specif…')
 
(= x86)
Line 6: Line 6:
 
== Examples ==
 
== Examples ==
  
=== x86 ==
+
=== x86 ===
  
 
Here is a "Hello, World!" program in x86 assembler for a Linux system:
 
Here is a "Hello, World!" program in x86 assembler for a Linux system:

Revision as of 10:37, 7 January 2014

Assembly language is a symbolic representation of machine language. It is therefore architecture-specific.

Each instruction is represented by a short mnemonic word such as "LDR" for Load Register, "MOV" for move, or "MUL" for multiply, followed by (optional) arguments. The addressing mode is implied by the format of the arguments.

Examples

x86

Here is a "Hello, World!" program in x86 assembler for a Linux system:

 section    .text
global    _start

_start:
    mov    edx,len          ; message length
    mov    ecx,msg          ; message location
    mov    ebx,1            ; file descriptor stdout
    mov    eax,4            ; syscall sys_write
    int    0x80

    mov    eax,1            ; syscall sys_exit
    int    0x80

section    .rodata

msg    db    'Hello, world!',0xa
len    equ    $ - msg