Assembly language programming is a low-level programming language in which the instructions are written in the form of mnemonics. More simply, we can say the language in the form of mnemonics is known as assembly language. This programming language allows the creation of human-readable program equivalent to machine code.
Now a question arises:
What are mnemonics?
Basically mnemonics are the short form of the words that are used to specify the operation performed by an instruction. In assembly language, the instruction to be performed is represented by 2,3 or 4 letters or a word.
For example: for addition, the mnemonics used in assembly language is ADD, for transferring data from one location to another, the mnemonics used is MOV.
So we can say that assembly language allows coding in symbolic language.
Content: Assembly Language Programming
Need of Assembly language Programming
We know that programs are a well-defined set of instructions used by programming devices like microprocessor, to perform a specific task.
The instructions in machine level language are written in binary form i.e., using 0 and 1. However, machine level language is quite complex and is not very much user-friendly, leading to cause difficulty in program development.
Hence, a less complex and user-friendly language was developed in which the instructions are specified using a few letters of an English word, thus making it quite easier. This language is known as assembly level language.
But it is noteworthy here that a microprocessor does not hold the ability to execute the programs written in assembly language. Thus it becomes necessary to convert assembly language programs into machine language so that the microprocessor can execute it.
So, a software tool known as assembler is used for converting assembly language into a machine language.
Thus a program written in assembly language is first converted into machine language and then these programs are executed by the microprocessor.
Syntax for Assembly Language Instruction
Assembly language programming follows a unique syntax, in which the instructions are written in the format:
Label is an optional field of instruction in assembly language and acts as an identifier that provides a symbolic name to the first byte of the instruction and is generally used at the time of branching.
Mnemonics provide the information about the instruction to be performed and is a compulsory field of the instruction format.
Operand specifies the data over which operation is performed. It is to be noted here that the number of operations in an instruction depends on the type of instruction.
This is so because some hold no operand while some hold one or two operands. A comma is used to separate two operands of an instruction.
The comment field starts with a semicolon and it signifies the objective of a particular instruction.
For understanding consider the instruction given below:
Assembly language program development tools
Basically, before the fabrication of a microprocessor-based system, the designers first need to design and test the software and hardware of the system. So the development system requires a set of tools. In this section, we will discuss the various tools.
- Editor: An editor is a software tool that allows user, the construction of an assembly language program by providing a set of commands. By using this tool, the user can type and modify the program in assembly code. The program created by an editor is termed as source program.
- Assembler: We have already discussed that an assembler allows conversion of assembly level language into machine language. Assemblers are of different types like one pass, two pass, cross, meta macro and resident assembler.
Source program generated by editor acts as input to the assembler. - Library Builder: Library builder is a tool used to generate library files. Basically library files contain the functions that are frequently used by a program.
For any particular application, whenever software is developed, then the programmers can link the library files with the programs. Linking library files with the program permits the copying of procedure needed by the program from library files to the program. - Linker: A linker allows the combining of relocatable object files of program modules with the library functions to generate a single executable file.
Basically program modules are nothing but separate procedures of subdivisions of a large program into smaller tasks. This is so because whenever a program is divided into smaller tasks then each task has its individual procedure. Library files are also used by certain tasks according to their availability.
Each program module allows separate assembling, testing and debugging. Further to have a complete executable file the object files of the modules and library files are linked together. The linker creates a link map file the holds the information about the address of the linked files. - Debugger: A debugger executes a program according to the controlling of the user. A debugger allows the location and correction of errors if present in any program, and this is known as debugging.
- Simulator: A program that runs on the PC for simulating the operations of the recently designed system is known as a simulator. It also displays the contents of registers and memory locations on the computer screen. So, as the program operates, the change in contents can be monitored.
- Emulator: An emulator is a tool utilized for testing and debugging both hardware and software of a microprocessor-based system. The system designer loads and runs the program on the emulator, and allows examining and changing of information inside the registers and memory locations.
It is to be noted here that assembly language programs are machine-dependent. This is so because every microprocessor supports different mnemonics. Thus different programs are developed for different microprocessors.
However, upward compatibility is provided by the manufacturers to the same class of microprocessors. This means programs that are developed for lower versions of the processor can be supportable even on higher versions without introducing any modifications.