Sunday, December 31, 2017

Difference Between SAP-I and SAP-II

SAP stands for Simple As Possible computer. It is the basic model of an micro-computer. It can perform all the basic functionalities of an microprocessor but has an limited, small and simple set of instructions. It's main purpose is to show how an computer operates without burying you into unnecessary details.

Attribute SAP-I SAP-II
Counter 0H to FH 0000H to FFFFH
Opcode 4-bit 8-bit
Address 8-bit 16-bit
Registers B-register only B,C and Temp register
I/O ports 2 4
W-bus 8-bit 16-bit
Display Binary Display Hexa-Decimal Display
No. of Instruction 5 42
Logical Operations cannot be performed can be performed
Memory 16 Byte RAM 62 KB RAM and 2 KB ROM

Basic Direct Memory Access Operation and data tranfers

Direct Memory Access (DMA) :

The DMAC (Direct Memory Access Controller) allows the devices to read/write from/to the memory location without the use of processor. They are used in Sound cards, Video cards, Disk controllers, etc.

An Basic Direct Memory Access operation goes like,


  1. The I/O interface requests DMAC for an DMA operation.
  2. DMAC sends hold signal to the processor requesting for the data and address bus
  3. The processor sends the hold acknowaldge signal to the DMAC indicating the data and address bus were given.
  4. DMAC send the address of the data to the address bus
  5. Then DMAC requests I/O interface for the data
  6. Data recieved is sent to the data bus
  7. DMAC latches the interface
  8. Sends hold low signal to drop the hold cycle to the processor
  9. Processor drops the HLDA signal
  10. Increases the address register by one 
  11. Increases the Program counter by one  

DMAC uses two signals for requesting and acknowladging the DMA operations:

HOLD: If active, indicates the data bus and address bus were given to the DMAC and the processor is in hold.

HLDA: If active, indicates the processor that the DMA operation is active.

DMAC allows different types of data transfer processes,

Cycle steal:

DMAC can use the data bus either when the Processor is not using it or it can force the CPU to suspend it's current operation and use the data bus. The Latter method is called cycle stealing. Note: Cycle Stealing can be only done in certain break points in the instruction cycle.

Brust Transfer:

In brust mode, the DMAC forces the operations of Processor to be halted for the duration of data transfer.

Hidden DMA:

DMAC allows Hidden DMA operation as well. DMAC monitor's every execution of the processor's instruction and when it reconizes that there is an instruction with sufficient empty clock cycle for a byte of data transfer, it waits until the processor is decoding the opcode then grabs the bus for the data transfer... 

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