Assembly Language



Assembly languages were developed to alleviate many of the disadvantages of machine-language programming. When programming in an assembly language, the programmer uses mnemonics (symbolic names) to specify machine operations; thus, coding in O's and l's is no longer required. Mnemonics are alphabetic abbreviations for the machine-language op codes. The Figure below  shows some common arithmetic operations coded in assembly language and in machine language.

 

Assembly language instructions differ depending on the type and model of computer being programmed. Thus, assembly language programs, like machine language programs, can be written only for the type of computer that will execute them.
There are three basic parts to an assembly language instruction: an op code and an operand, as in machine language, and a label. The Figure below shows a section of an assembly language program with the parts of the instructions labeled.

 

The label is a programmer supplied name that represents the location in which a particular instruction will be stored. When the programmer wishes to refer to that instruction, he or she can simply specify the label, without regard to the actual address of the memory location.

The op code, as in machine language, tells the computer what operation to perform, but it is in mnemonic form. The operand, also in mnemonic form, represents the address of the item that is to be manipulated. Each instruction may contain one or two operands. The remainder of the line can be used for remarks that explain to humans the operation being performed (the remarks are optional and are simply ignored by the computer).

There are several advantages to using assembly language. The main advantage is that it can be used to develop programs that use memory space and processing time efficiently. As with machine language, the programmer is able to fully utilize the computer's processing capabilities. Second, the assembler program (the program that translates the assembly program into machine language) performs certain error checking functions and generates error messages, if appropriate, that are useful to the programmer when debugging the program.

 

The main disadvantage of assembly language is that it is more cumbersome to use than high-level languages. Generally, one assembly-language instruction is translated into one machine-language instruction; this one-for-one relationship leads to long program preparation time. However, this feature makes it easier for the computer to translate the program into machine language than to translate a high-level language into machine language. Another disadvantage of assembly language is the high level of skill required to use it effectively. As with machine language, the programmer must know the computer to be used and must be able to work with binary or hexadecimal numbers. Finally, assembly language, like machine language, is machine-dependent; a program written for one computer generally cannot be executed on another.

Assembly language is often used for writing operating system programs. Because operating systems are designed for particular computers, they are machine dependent. The potential efficiency (efficient use of memory) of assembly language also makes it well suited for operating system programming.


Last Updated Jan.8/99