EXAMPLES: CMP M ......... Register Indirect Addressing MOV A, M MOV M, A ANA M ORA M XRA M SUB M ADD M ADC M SBB M LXI H 3000H ; HL = 3000H MOV A,M ; M = 10H ; M -> A INX H ; HL = 3001H CMP M ; M = 11H, IF [A] ? [M] ----- ----- [3000H] = 10 [3001H] = 11
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: ADC 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+c 3. 4. Flag Example: ADC B where [B] = 22H , [A]= 11H and [c flag]= 1 After execution of ADC B [A] = 34H [B] = 22H Program: write an ALP for addition 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: ADD B ; a=a+b ADC C ; a= a+c+cy... A = 74+ 10+ 0 STA 5000H Stop: HLT Output: [5000H]= 84H
Comments
Post a Comment