Microprocessor Assignment Topics and Solutions

Microprocessor Assignment Topics and Solutions

1. Assembler Instruction format, different programming models

An assembler is a software, which converts assembly language program codes to machine language. Assemblers are available in different types.

In one pass assembler, the source code is processed only once, and we can use only backward reference. In one pass assembler as the source code is processed, any labels encountered are given an address and stored in a table. Whenever a label is encountered, the assembler may look backward to find the address of the label.

In two pass assembler, the first pass is made through source code3 for the purpose of assigning an address to all the labels and to store this information in a symbol table. The second pass is made to actually translate the source code into machine code.

The interrupt for the assembler is the source program which is saved with file extension ‘ASM’. The assembler usually generates two output files called object file and list file. The object file consists of relocatable machine codes of the program and it is saved with file extension “OBJ”. The list file contains the assembly language statements, the binary codes for each instruction and address for each instruction. The list file is saved with file extension ‘LST’.

The list file also indicates any syntax errors in the source program. The assembler will not identify the logical errors in the source program. In order to correct the errors indicated on the list files, the user have to use the editor again. The corrected source program is saved again and then reassembled. Usually, it may take several times through edit – assemble loop to eliminate the syntax errors from the source program.

Some examples of assemblers are TASM (Borland’s Turbo Assembler), MASM (Microsoft’s Macro Assembler), ASM86 (INTEL’s 8086 Assembler) etc.

2. Assembly LINKER:

The liner is a software tool which is used to combine relocatable object files of program modules and library functions into a single executable file.

While developing a program for particular application, it is much more efficient to develop the program in modules. The entire task of the program can be divided into smaller task and procedures for each task can be developed individually. These procedures are called program modules. For certain task, we can use library files, if they are available. Each module can be individually assembled, tested and debugged. Then the object files of program modules and the library files can be linked to get executable file.


The linker also generates a link map file which contains the address information about the linked files. Some examples of linkers are microsoft’s linker LINK, Borland’s Turbo linker TLINK etc.

3. PROCEDURES AND MACROS:

When a group of instructions are to be used several times to perform a same fraction in a program, then we can write them as a separate subprogram called Procedure or Subroutine.

The procedures are written and assembled as separate program modules and stored in memory. When a procedure is called in the main program, the program control is transferred back to main program. In 8086 Processor, the instruction CALL is used to called a procedure in the main program and the instruction RET is used to return the control to main program.

A macro is a small group of instructions enclosed by the assembler directives MACRO and ENDM.

The macros are identified by their name and usually defined at the start of a program.
The macro is called by its name in the program, the assembler will insert the defined group of instructions in place of the call. In otherwords, the macro call is like Short hand expression which tells the assembler “Every time you see a macro name in the program, replace it with the group of instructions defined as Macros”.

Procedure
MACRO
1. Accessed by CALL and RET mechanism during execution.
1. Accessed during assembly with name given to macro when defined.
2. Machine code for instructions are stored in memory once.
2. Machine codes are generated for instructions in macro each time, it is called.
3. Parameters are passed in registers, memory locations or stack.
3. Parameters are passed as part of statement which calls Macro.

4. ASSEMBLER DIRECTIVES

Assembler Directive
Function
ASSUME
Indicates the name of each segment to the assembler.
BYTE
Indicates a byte sized operand
DB
Define byte. Used to define byte type variable.
DD
Define double word. Used to define 32 bit variable.
DQ
Define quad word. Used to define 64 bit variable.
DT
Define ten bytes. Used to define ten bytes of a variable.
DUP
Duplicate. Generate duplicates of characters or numbers.
DW
Define word. Used to define 16-bit variable.
END
Indicates the end of program.



Sreejith Hrishikesan

Sreejith Hrishikesan is a ME post graduate and has been worked as an Assistant Professor in Electronics Department in KMP College of Engineering, Ernakulam. For Assignments and Projects, Whatsapp on 8289838099.

Post a Comment

Previous Post Next Post