Assembly Language: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Markus Baumeister
(linkified and some improvements)
imported>Paul Derry
No edit summary
Line 4: Line 4:


-----
-----
.data
  .data
hello_message db 'Hello, World!',0dh,0ah,'$'
    hello_message db 'Hello, World!',0dh,0ah,'$'
 
 
.code
  .code
main proc
  main proc
  mov ax,@data
    mov ax,@data
  mov ds,ax
    mov ds,ax
 
 
  mov ah,9
    mov ah,9
  mov dx,offset hello_message
    mov dx,offset hello_message
  int 21h
    int 21h
 
 
  mov ax,4C00h
    mov ax,4C00h
  int 21h
    int 21h
main endp
  main endp
end main
  end main
-----
-----



Revision as of 20:15, 11 March 2007

Assembly Language is a method of abstracting machine code instructions for a computer into commands recognizable by a human. Instead of dealing directly with bit sequences, programmers write programs in assembly by generating blocks of code using a small set of keywords (which are mapped to machine instructions by an assembler).

An example Hello World program written in pseudo-assembly for a MSDOS-based system is listed below. Original source: Assembly Language for the IBM-PC.


 .data
   hello_message db 'Hello, World!',0dh,0ah,'$'
 
 .code
 main proc
   mov ax,@data
   mov ds,ax
 
   mov ah,9
   mov dx,offset hello_message
   int 21h
 
   mov ax,4C00h
   int 21h
 main endp
 end main

Assembly programs are much easier to understand than their corresponding machine code instruction streams, which are just numbers, but they are much more difficult to comprehend than, higher-level programming languages like, for example, PHP.