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]


Friday, August 26, 2016

Flags in Microprocessor (8085 and 8086)


Flags is an status register containing flip-flops that shows the current status of the processor. Flags helps the processor to determine the changes made by any Arithmetic Operation.
8085 microprocessor has an 8-bit flags register with 5- bit positions. Flags namely,
  • Sign Flag
  • Zero Flag
  • Auxiliary Carry Flag
  • Parity Flag
  • Carry Flag
are present in 8085.


Sign Flag (S): It is set (1) when the result of an operation is less than 0 or the answer is negative.

Zero Flag (Z): It is set when the result obtained is zero.

Axuiliary Carry Flag (AC): It is set when there is an carry from the lower nibble to the upper nibble.

Parity Carry (P): It is set when there is an even number of 1's.

Carry Flag (C): It is set when there is an carry or borrow during an addition or subtraction operation.

8086 Microprocessor has 16-bit status register with 9-bit postions that includes all the flags provided by 8085 with the addition of 4 other flags for string manupulation, interrupt handling and debugging. The flags in 8086 microprocessor are,
  • OverFlow Flag
  • Direction Flag
  • Interrupt Flag
  • Trap Flag
  • Sign Flag
  • Zero Flag
  • Auxiliary Carry Flag
  • Parity Flag
  • Carry Flag

Overflow Flag (OF): It is set (1) when the result of an operation exceeds / overflows the capacity.

Direction Flag (DF): It is set by the user to specify the direction in which data is read. It is used in string manipulation.

Interrupt Flag (IF): It is set to disable the hardware interrupt temporarily.

Trap Flag (TF): It is used to change the exection process to Single Step Execution. It is used by debuggers for debugging process as it helps to find the source of error.

The Sign Flag (SF), Zero Flag (ZF), Auxiliary Carry Flag(AC), Parity Flag (PF) and Carry Flag (CF) has the same functionalities as the flags in 8085.

Thursday, August 25, 2016

Difference between Microprocessor and MicroController



Microprocessors are Programmable, Clock-Driven, Register-Based electronic device that takes binary input , processes them according to the instruction stored in the memory and provides result as output. Microprocessors are the heart of Modern Computers.

Micro-controllers are self-contained system that in-cooperates processor, peripherals (RAM, ROM, I/O controls , Clock/Timers, etc) and memory that can be used as an embedded system.They are used in a wide application ranging from toys to Automobiles. An automobile may contain many hundreds of micro-controllers.

Attribute Microprocessor Micro-controller
Defination Programmable, Clock-Driven, Register-Based electronic device that in-cooperates CPU within a single chip A single chip that in-cooperates processor, RAM, ROM, Timer / Clock , I/O control Unit, etc.
Used in Servers, Desktop Computers, Laptops, Mobile Devices products ranging from toys to automobile
Cost expensive cheaper
Electronic Circuit Density higher lower
Components 3 components (ALU, CU, Registers) all components inbuilt (i.e. RAM, ROM, Timers, I/O, etc.)
Additional Circuits can be added cannot be added
Designed To Perform Huge set of general functions Small set of Specific functions