Friday, September 16, 2016

Directives of 8086 microprocessor

Directives are used to control how an assembler assembles the source program. The directives of microprocessor are:

PAGE:
           PAGE is used for the list formatting of the pages.
     Syntax:
          PAGE[length][width]
                          here, length = number of lines per page and
                                   width = number of characters per line
           i.e. it specifies the dimension of the page in terms of number of characters.

TITLE:
          It specfies the title of the page, any text written after TITLE will be displayed at the top of the page.

.DOSSEG:
        It is used to standardize the memory occupied by each segment.

.model:
          It is used to standardize the memory occupied by the entire program.
 types of model:
          .tiny - Both code and data must be less than 64 KB.
          .small (default) - code and data can be equal to 64 KB.
          .medium -  Only code can be greater than 64 KB.
          .compact -  Only data can be greater than 64 KB.
          .large - Both data and code can be greater than 64 KB.
          .huge - All available memory in the system can be used.

.stack:
         It specifies the size of the program stack

.code:
        It carries the actual instructions of the program.

.PROC:
        Contains the starting address and name of the procedure.

.END :
       specifies the end of the entire program.

.ENDP:
       specifies the end of the procedure.

.ENDS:
       specifies the end of the segment.

Data Directive:
          All the variables used in the program is defined in this directive.

Data defination directive:
           It is used to specify the size of each variable.

                DB - data byte (1B)
                DW - data word (2B)
                DD - double word (4B)
                DQ- quad word (8B)
                DT - ten byte (10B)

EQU directive:
               It is used to give a name to an constant value
        eg:
               FACTOR EQU 12

Thursday, September 8, 2016

Addressing modes in microprocessor (8085 and 8086)

Addressing modes:

An instruction is the command given to the computer to perform an specific task. In assembly language, an instruction has two parts, an operation code (opcode) that tells what operation to be carried out and an data to be operated on (operand). In 8085, operand may be source, destination or both. Source may be register, memory or input port and destination may be register, memory or output port. The various ways of specifying the operands are called addressing modes 
          Addressing modes are the various ways in which the data to be worked on can be addressed.

There are different addressing modes namely,

Immediate Addressing mode:

In this addressing mode , the operand is the data itself. Here, the data to be worked on is directly passed hence, called immediate.
                        example : MVI A,23H

Direct Addressing mode:

In this mode, the memory location of the data to be worked on is passed as the operand.
                           example: LXI H,2050H 

Register Direct Addressing mode:

In this addressing mode, the register containing the data is passed in as the operand.Since, the register is directly passed, it's called register direct addressing mode.
                       example: MOV A,B

Register Indirect Addressing mode:

In this addressing mode, the memory location of the address of the data is passed as the operand. The address of the address is passed instead of the address of the data.
                        example: MOV A,M

Implied Addressing mode:

In this mode, no operands are passed.
                           example: NOP

Based Addressing mode:

In this mode, the offset address of the operand is found by the sum  of BI or BP with the 8-bit or 16-bit displacement.
                        example: MOV AX,[BP+06H]

Indexed Addressing mode:

In this mode , the offset address of the operand is found by the sum of SI or DI with the 8-bit or 16-bit displacement.
                           example: MOV AX,[SI+06H]

Based-Indexed Addressing mode:

In this mode, the offset address of the operand is found by the sum of Index value and the base register.
                            example: MOV AX,[BI+DI]

Based-Indexed Addressing mode with displacement:

In this mode, the offset address of the operand is found by the sum of Index value and base register along with the 8-bit or 16-bit displacement.
                           example: MOV AX,[BI+DI+06H]