Syntax: CMP R Where R can be any of the general purpose registers (A,B,C,D,E,H and L) Byte: 1byte Addressing Mode: Register Addressing Working: 1. This is one byte instruction. 2. microprocessor will allocate one byte for opcode CMP and operands are registers i.e. operands don't need memory allocations for execution here. 3. T his instruction compares the content of the register R with content of the Accumulator. The comparison is done using subtraction of the content of register from the Accumulator . The content of Accumulator remains unchanged . Conditions of Comarison: 1. If [A] < [R] then Cy flag is set i.e. Cy =1 . 2. If [A] = [R] then Z flag is set i.e Z=1. 3. If [A] > [R] then Cy and Z flags are reset. i.e Cy = 0 and Z = 0 4. Flag Example: CMP B where [B] = 22H and [A]= 11H After execution of CMP B [A] = 11H [B] = 22H 2's complement subtraction: A= 11 = 0001 0001 B= 22 = 0010 0010 1'...
Syntax: CMC Byte: 1byte Addressing Mode: Implied Addressing Flag: Carry Working: 1. Microprocessor will allocate one byte for opcode for execution. 2. During the execution of the instruction microprocessor will complement or perform 1's complement on content of Carry flag. Example: CMC where [Cy] = set = 1 After execution of CMC [Cy] = 0
Syntax: RRC Byte: 1byte Addressing Mode: Implicit Addressing Working: 1. This is one byte instruction. 2. Microproccessor will allocate one byte for opcode RRC 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 Right. i.e. The bit A0 is stored in carry flag AS WELL AS will get stored in A7 bit position. 4. C Flag will get affected. Example: RRC where [A]= 21H After execution of RRC [A] = 90H A= 21 = 0010 0001 A7 -> A6 -> A5 -> A4 -> A3 -> A2 -> A1 -> A0 -> Cy |___<-____________________________<-_ __| 0 0 1 0 0 ...
Comments
Post a Comment