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
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
Syntax: RLC Byte: 1byte Addressing Mode: Implicit Addressing Working: 1. This is one byte instruction. 2. Microproccessor will allocate one byte for opcode RLC and operand is Accumulator i.e. operand will not need memory allocation during execution. 3. Thi s instruction rotates content of Accumulator one bit position towards left. i.e. The bit A7 is stored in bit position A0 as well as in carry flag. 4. C flag will get affected. Example: RLC where [A]= 21H After execution of RLC [A] =42H A= 21 = 0010 0001 Cy <- A7<-A6<-A5<-A4<-A3<-A2<-A1<-A0 |___->__________________________->_| 0 0 1 0...
Comments
Post a Comment