Assembly/Low Level/Symbolic Language:
One of the first steps in improving the program preparation process was to substitute letter symbols mnemonics for the numeric operation codes of machine language. To ease programmer's burdens, mnemonic operation codes and symbolic addresses were developed. A mnemonic is a word or set of letters which can be represent a function code and which is easy to remember. A mnemonic (or memory aid) is any kind of mental trick we use to help us remember. Mnemonics comes in various shapes and sizes, all of them useful in their them own way. For example, a computer may be designed to interpret the machine code of 1111 (binary) or 15 (decimal) as the operation "subtract", but it is easer for a human being to remember it as SUB.
A symbolic address is a name invented by a programmer to identify the location. Without this idea the programmer would have to use absolute address in binary. The assembly language is machine dependent. The program written is assembly language is converted into machine language before execution by software called Assembler.
All computer have the power of handling letters as well as numbers. Hence, a computer can be taught to recognize certain combination of letters or numbers. It can be taught (by means of a program) to substitute the number 1110 every time it sees the symbol ADD, substitute the number 1111 every time it sees the symbol SUB, and so forth. In this way, the computer can be trained to translate a program written with symbol instead of numbers into the computer's own machine language. Then we can write program for the computer using symbol instead of numbers, and have the computer to do its own translating. This makes it easier for the programmer because he can use letters, symbols, and mnemonic instead of numbers for writing his programs.
For example, the procedure program that was written in machine language for adding two numbers and printing out the result could be written in the following ways:
|Load A into the A register
|ADD B to the A register
|Store the some in the temporary location
|Load C into A register
|Store the final result in the C
Which means "take A, add B, store the result in the C, type C, and halt." The computer, by means of a translating program, would translate each line of this program into the corresponding machine language program.
At this point we must learn a few more terms. The language which substitutes letters and symbol for the number in the machine language program is called an assembly language or symbolic language. A program written in symbolic language that uses symbols instead of numbers is called an assembly code or a symbolic program. The translator program that translates an assembly code into the computer's machine code is called an assembler. The assembler is a system program which is supplied by the computer manufacturer. It is written by system programmers with great care. A symbolic program written by a programmer in assembly language is called a source program. After the source program has been converted into machine language by an assemble, it is referred to as an object program which is in machine language. Since the assembler translates each assembly language instruction into an equivalent machine language instruction, there is a one-to-one correspondence between the assembly instructions of source program and the machine instructions of object program.
Advantages of Assembly Language Over Machine Language:
- Easy to Understand and use
Assembly languages are easier to understand and use because mnemonic are used instead of numeric OP codes and suitable names are used for data. The use of mnemonics means that comments are usually not needed; the program itself is understandable. Symbolic programming also saves a lot of time and effort of the programmer because it is easies to write as compared to machine language programs.
- Easy to Locate and Correct Errors: (Debugging)
While writing programs in assembly language, fewer errors are made and those that are made are easier to find and correct because of the use of mnemonics and symbolic field names. Furthermore, assemblers are so designed that they automatically catch errors. If we use an invalid mnemonic or a name that has never been defined, the assembler will print out an error indication. For example, suppose one instruction in the symbolic program reads ADD AREA, and we forget to defined what AREA is, the assembler will look through its table to find AREA and not finding it will indicate the error.
- Easier to Modify
Assembly language programs are easier for people to modify than machine language programs. This mainly because they are easies to understand and hence it is easier to locate, correct, and modify instructions as and when desired.
- Lower Program Preparation cost
Writing programs in assembly language requires less time and effort which ultimately leads to lower program preparation cost. Generally, the cost of all phases of program preparation (coding, debugging, testing. etc.) is lower with an assembly language than with the machine language.
- Easily Re-Locatable
Suppose that an assembly language program start at address 1000 and we suddenly find that we have another program to be used with this program and this program also starts at location 1000. Obviously, one of the two programs will have to be rewritten or to be moved somewhere else. In machine language, this can be complicated job. But in case of assembly language, we merely have to change the first statement. And run the symbolic program once more through the assembler. The equivalent machine language program will this time start at memory location 3000 instead of 1000, and there will be no conflict with the other program. In other words, using system language we can easily move programs from one section of the memory to another, we say that assembly language programs are easily re-locatable because their location is easily changed by changing the first instruction. This is not easily done with machine language programming.
- Efficiency of Machine Language
In addition to the above mentioned advantages, an assembly language programs also enjoys the efficiency of its corresponding machine code because there is one to one correspondence between the instructions of an assembly language program and its corresponding machine language program.
Limitations of Assembly Language:
The following disadvantages of machine language are not solved by using assembly language:
- Machine Dependent
Because each instruction in the symbolic language is translated into exactly one machine language instruction, assembly language are machine dependent. That is, they are designed for the specific make and model of the processor being used. A decision to change to another computer still usually requires learning a new language and the conversion of all existing programs; a very expensive undertaking.
- Knowledge of Hardware Required
Since assembly language are also machine dependent, so the programmer must be aware of a particular machine's characteristics and requirements as the program is written. An assembly language programmer must know how his machine works and should have a good knowledge of the logical structure of his computer in order to write a good assembly language program.
- Machine Level Coding
In case of an assembly language, instruction are still written at the machine code level, that is, one assembler instruction is substituted for one machine code instruction.
- Need of Translator: (Assembler)
we discus earlier that computer can only understand the language of 0, 1. While symbols and addresses are used in assembly language which are not understandable by the computer. To convert assembly language instructions into computer readable form a translator is used. The type of translator which converts assembly language into machine language is called assembler. Machine and assembly languages being machine dependent, are referred to as low-level language.
- Slow as Compared to Machine Language
We discussed earlier that the only language understood is the machine language which is not further translated. While symbols and addresses are used in assembly language which are not understandable by the computer readable form a translator called assembler is used which reads the instructions into computer readable form a translator called assembler is used which read the instructions convert it into machine language and execute the instructions. An extra step of translation of instructions is added which slow the execution of the program written in assembly language.