Assembly Language

From CDOT Wiki
Revision as of 10:36, 7 January 2014 by Chris Tyler (talk | contribs) (Created page with 'Category:Computer Architecture ''Assembly language'' is a symbolic representation of machine language. It is therefore [[Portable|architecture-specif…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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