Posts

Microprocessor 8085 Instructions

Image
Instructions of 8085 can be classified on three basis:  First Classification on basis of their byte length i.e. size of instruction. 1.  1-byte instructions 2. 2-byte instructions 3.  3-byte instructions Second Classification on basis of their addressing modes i.e. kinds of approaches to fetch and execute. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Implicit Addressing There are five sets of instructions for 8085mp  Programming:  1. Data Transfer group 2. Arithmetic group 3. Logical group 4. Branching group 5. Machine Control group

SBI

Syntax: SBI 8bit  Where 8-bit is an immediate data operand.  Byte: 2byte Addressing Mode: Immediate   Addressing Working:  1.  2. A= A- 8bit -b 3.  4. Flag Example: SBI 10H where  [A]= 22H and [c flag]= 1 After execution of SBI   10H [A] = 11H  // A= A-8bit-b => 22-10-1 =11H Program: write an ALP for subtraction of 30H value from Registers A  Where A carries 44H and Cy flag carries borrow value 1. Store result at memory location 5000H. Label  Mnemonics  Comments Start:   SBI 30H        ;  a= a-8bit- cy...                                    ; A= 44- 30 -1 = 13h             STA 5000H   Stop: HLT Output: [5000H]= 13H      

SBB

Syntax: SBB R Where R can be any of the general purpose registers (A,B,C,D,E,H andL) Byte: 1byte Addressing Mode: Register   Addressing Working:  1.  2. A= A- R-b 3.  4. Flag Example: SBB D where  [D] = 10H , [A]= 22H and [c flag]= 1 After execution of SBB  B [A] = 11H  [D] = 10H // A= A-R-b => 22-10-1 =11H Program: write an ALP for subtraction of values present in Registers A ,B and C. Where A carries 44H and B carries 30H and C carries 10H. Store result at memory location 5000H. Label  Mnemonics  Comments Start: SUB B ;  a=a - b// 44-30= 14h            SBB  C ;  a= a - c - cy... A= 14-10-0 = 4h           STA 5000H   Stop: HLT Output: [5000H]= 04H      

SUI

Syntax: SUI 8-bit Where 8-bit is an immediate data operand.  Byte: 2byte Addressing Mode: Immediate   Addressing Working:  1.  2.  3.  4. Flag Example: SUI 11H where    [A]= 22H After execution of SUI 11H [A] = 11H  Program: write an ALP for 8bit subtraction of value present in Register A that is 44H with an immediate value 30H. Store result at memory location 5000H. Label  Mnemonics  Comments Start: SUI 30H           STA 5000H   Stop: HLT Output: [5000H]= 14H                        

SUB

Syntax: SUB R Where R can be any of the general purpose registers (A,B,C,D,E,H andL) Byte: 1byte Addressing Mode: Register   Addressing Working:  1.  2.  3.  4. Flag Example: SUB B   where  [B] = 11H  and [A]= 22H After execution of  SUB  B [A] = 11H  [B] = 22H Program: write an ALP for 8bit subtraction  of values present in Registers A and B where A carries 44H and B carries 30H. Store result at memory location 5000H. Label  Mnemonics  Comments Start: SUB B            STA 5000H   Stop: HLT Output: [5000H]= 14H LXI H, 4000H ;  4000= 90h MOV A,M ; a = 90h INX H ;  4001h where 4001= 40h MOV B, M ; b= 4 0h SUB B ; a = a - b ... A = 90 - 40= 50h INX H ;  4002h MOV M,A ;  4002h = 50h HLT            

Branching Group Of Instruction

 JUMP Instruction 1. JMP       : Unconditional Conditional Jump 1. JNZ        2. JZ  3. JNC 4. JC 5. JPO 6. JPE 7. JP 8. JM CALL Instruction   1.  CALL      : Unconditional Conditional Call 1. CNZ        2. CZ  3. CNC 4. CC 5. CPO 6. CPE 7. CP 8. CM   Return Instruction 1. RET       : Unconditional Conditional Return 1. RNZ        2. RZ  3. RNC 4. RC 5. RPO 6. RPE 7. RP 8. RM Restart Instruction  RST n ......(8 -restart instruction in 8085) 1. RST 0 2. RST 1 3. RST 2 4. RST 3 5. RST 4 6. RST 5 7. RST 6 8. RST 7 PCHL ( LOAD PROGRAM COUNTER WITH HL )             

XRI

  Syntax: XRI 8-bit Where 8- bit is an immediate operand data. Byte: 2byte Addressing Mode: Immediate Addressing Working:  1.This is 2 byte instruction. 2. Microprocessor will allocate first byte for opcode and second byte for immediate data. 3. During execution of this instruction, microprocessor will perform Logical XORing operation between content of Accumulator and Immediate data. 4. S, Z and  P  are modified . Cy and Ac are reset .   Example: XRI 22H where [A]= 11H After execution of XRI 22H [A] = 33H     A= 11 =  0001 0001  =  22 =  0010 0010  A=33= 0011  0011 FLAG= 00 0 0 0 1 0 0 = 04H

ORI

  Syntax: ORI 8-bit Where 8- bit is an immediate operand data. Byte: 2byte Addressing Mode: Immediate Addressing Working:  1.This is 2 byte instruction. 2. Microprocessor will allocate first byte for opcode and second byte for immediate data. 3. During execution of this instruction, microprocessor will perform Logical ORing operation between content of Accumulator and Immediate data. 4. S, Z, P are modified. Cy and Ac are reset (Cy = Ac= 0) . Example: ORI 22H where [A]= 11H After execution of ORI 22H [A] = 33H     A= 11 =  0001 0001  =  22 =  0010 0010  A=33= 0011  0011 FLAG= 00 0 0 0 1 0 0 = 04H