What is an Assembler? We know that assembly language is a less complex and programmer-friendly language used to program the processors. In assembly language programming , the instructions are specified in the form of mnemonics rather in the form of machine code i. But the microprocessor or microcontrollers are specifically designed in a way that they can only understand machine language.
|Published (Last):||23 September 2005|
|PDF File Size:||15.39 Mb|
|ePub File Size:||3.85 Mb|
|Price:||Free* [*Free Regsitration Required]|
To generate this 20 bit physical address from 2 sixteen bit registers, the following procedure is adopted. The contents of the segment registers are shifted left four times with zeroes 0? This is similar to multiplying four hex numbers by the base The code segment registers are used to hold programs,data segment register to keep data, stack segment register for stack operations and extra segment register to keep strings of data.
This multiplication process takes place in the adder and thus a 20 bit number is generated. This is called the base address. To this a bit offset is added to generate the bit physical address. Segmentation helps in the following way.
The program is stored in code segment area. The data is stored in data segment area. In many cases the program is optimized and kept unaltered for the specific application. Normally the data is variable. So in order to test the program with a different set of data, one need not change the program but only have to alter the data. Same is the case with stack and extra segments also, which are only different type of data storage facilities.
Generally, the program does not know the exact physical address of an instruction. Directives And Operator: Assembler: is a program that accepts an assembly language program as input and converts it into an object module and prepares for loading the program into memory for execution. Loader linker further converts the object module prepared by the assembler into executable form, by linking it with other object modules and library modules. The final executable map of the assembly language program is prepared by the loader at the time of loading into the primary memory for actual execution.
The assembler prepares the relocation and linkages information subroutine, ISR for loader. The operating system that actually has the control of the memory, which is to be allotted to the program for execution, passes the memory address at which the program is to be loaded for execution and the map of the available memory to the loader.
Based on this information and the information generated by the assembler, the loader generates an executable map of the program and further physically loads it into the memory and transfers control to for execution. Thus the basic task of an assembler is to generate the object module and prepare the loading and linking information.
Procedure for assembling a program Assembling a program proceeds statement by statement sequentially. The first phase of assembling is to analyze the program to be converted. It also analyses the segments used by the program types and labels and their memory requirements. The second phase looks for the addresses and data assigned to the labels. It also finds out codes of the instructions from the instruction machine, code database and the program data. It processes the pseudo operands and directives.
It is the task of the assembler designer to select the suitable strings for using them as directives,pseudo operands or reserved words and decides syntax. Directives Also called as pseudo operations that control the assembly process. They indicate how an operand or section of a program to be processed by the assembler. They generate and store information in the memory. Assembler Memory models Each model defines the way that a program is stored in the memory system. Tiny: data fits into one segment written in.
COM format Small: has two segments data and memory. There are several other models too. But leave the bytes un-initialized. The low word, H, will be put in memory at a lower address than the high word. It will initialize the 10 bytes with the values 11, 22, 33, 44, 55, 66, 77, 88, 99, and 00 when the program is loaded into memory to be run. Additional terms are often added to a SEGMENT directive statement to indicate some special way in which we want the assembler to treat the segment.
Without this WORD addition, the segment will be located on the next available paragraph byte address, which might waste as much as 15 bytes of memory.