Assembly Language

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 almost one-to-one to machine instructions by an assembler). Most assembly languages allow the invoking of system macros, which are functions consisting of assembly code. System macros are used for tasks performed by the operating system, such as input/output and opening/closing of named files. Also user macros, written by the end user for performing repetitive tasks, are allowed by most assemblers.

Assemblers not only relieve the programmer of remembering instruction codes, but allow symbolic reference to memory locations, further improving readability.

An example Hello World program written in pseudo-assembly for a MS-DOS-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 binary numbers, but they are much more difficult to comprehend than most general-purpose higher-level programming languages, such as the C programming language or Java.