Syntax: ADI 8-bit Where 8-bit is an immediate data operand. Byte: 2byte Addressing Mode: Immediate Addressing Working: 1. 2. 3. 4. Flag Example: ADI 22H where [A]= 11H After execution of ADI 22H [A] = 33H Program: write an ALP for 8bit addition of value present in Register A that is 44H with an immediate value 30H. Store result at memory location 5000H. Label Mnemonics Comments Start: ADI 30H STA 5000H Stop: HLT Output: [5000H]= 74H
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
Syntax: ADD 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: ADD B where [B] = 22H and [A]= 11H After execution of ADD B [A] = 33H [B] = 22H Program: write an ALP for 8bit addition 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: ADD B STA 5000H Stop: HLT Output: [5000H]= 74H LXI H, 4000H ; 4000= 50h MOV A,M ; a = 50h INX H ; 4001h where 4001= 90h MOV B, M ; b= 90h ADD B ; a = a+b ... A = 50+90= E0h INX H ; 4002h MOV M,A ; 4002h = E0h HLT
Comments
Post a Comment