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
One Byte Instructions needs only one Byte of memory for execution. Here, in these instructions, general purpose registers are used as operands i.e. Source Register Rs and Destination Register Rd. Example: MOV , LDAX , STAX , XCHG
Syntax: INR 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: INR B Where [B]= 10H After execution of INR B [B]= 11H
Comments
Post a Comment