The operation specified in an instruction is performed on all 8 bits in a byte. General format for these instructions are as follows: 
ANL destination, source // destination =destination AND source 
ORL destination, source // destination =destination OR source 
XRL destination, source // destination =destination EX-OR source 

Note that these are all bitwise operations i.e. destination bit Dn = destination bit Dn OPERATION source bit Dn 
All four addressing modes can be used for the source operand. The A or a direct address in internal RAM can be the destination. 


AND operation 


ANL A, #data // bitwise AND operation of A with data, A=A AND data 
ANL A, #10H // If A= FFH, →A= FFH AND 10H= 10H 

ANL A, Rn // bitwise AND operation of A with Rn, A=A AND Rn 
ANL A, R0 // If A=55H, R0= 4AH, →A=55H AND 4AH= 40H 

ANL A, @Ri // bitwise AND operation of A with data pointed by Ri, A=A AND (Ri) 
ANL A, @R1 // If A= 38H, R1=20H, (20H) =1FH, → A= 38H AND 1FH= 18H 

ANL A, direct // bitwise AND operation of A with data in direct, A=A AND (direct) 
ANL A, 20H // If A= E6H, (20H)=67H, → A=E6H AND 67H= 66H 

ANL direct, #data // bitwise AND of data in address direct with immediate data // (direct) = (direct) AND data (store result in address direct) 
ANL 30H, #0E6H // If (30H) = 0FH, → (30H) = 0FH AND E6H= 06H 

ANL direct, A // bitwise AND operation of data in address direct with A // (direct) = (direct)AND A 
ANL 10H, A // If (10H) = 72H, A= 0FH, → (10H) = 72H AND 0FH= 02H 


Example : Illustrate the use of ANL instruction. 

Solution: 
MOV A, #45H                 A= 45H 
ANL A, #0EH                 A= 45H AND 0EH =04H 
The operation of ANL instruction is explained below:





OR operation 


ORL A, #data // bitwise OR operation of A with data, A=A OR data 
ORL A, #10H // If A= FFH, → A= FFH OR 10H= FFH 

ORL A, Rn // bitwise OR operation of A with Rn, A=A OR Rn 
ORL A, R0 // If A = 55H, R0= 8AH, → A=55H OR 4AH= DFH 

ORL A, @Ri // bitwise OR operation of A with data pointed by Ri, A=A OR (Ri) 
ORL A, @R1 // If A= 38H, R1=20H, → (20H) =1FH, A= 38H OR 1FH= 3FH

 ORL A, direct // bitwise OR operation of A with data in direct, A=A OR (direct) 
ORL A, 20H // If A= E6H, (20H) =67H, → A=E6H OR 67H= E7H 

ORL direct, #data // bitwise OR operation of data in address direct with immediate data 
// (direct) = (direct) OR data (store result in address direct) 
ORL 30H, #0E6H // If (30H) = 0FH, → (30H) = 0FH OR E6H= EFH 

ORL direct, A // bitwise OR operation of data in address direct with A // (direct) = (direct) OR A 
ORL 10H, A // If (10H) = 72H, A= 0FH, → (10H) = 72H OR 0FH= 7FH 

Example : Illustrate the use of ORL instructions. 

Solution 
MOV A, #34H             A= 34H 
ORL A, #57H              A= 34H OR 57H =77H




EX-OR operation 


XRL A, #data // bitwise X-OR operation of A with data, A=A X-OR data 
XRL A, #10H // If A= FFH, → A= FFH X-OR 10H= EFH 

XRL A, Rn // bitwise X-OR operation of A with Rn, A=A X-OR Rn 
XRL A, R0 // If A = 55H, R0= 8AH, →A=55H X-OR 4AH= DFH 

XRL A, @Ri // bitwise X-OR op. of A with data pointed by Ri, A=A X-OR (Ri) 
XRL A, @R1 // If A= 38H, R1=20H, (20H) =1FH, → A= 38H X-OR 1FH= 27H 

XRL A, direct // bitwise X-OR of A with data in direct, A=A X-OR (direct) 
XRL A, 20H // If A= E6H, (20H) =67H, → A=E6H X-OR 67H= 81H 

XRL direct, #data // bitwise X-OR operation of data in address direct with data // (direct) = (direct) X-OR data (store result in address direct) 
XRL 30H, #0E6H // If (30H) = 0FH, → (30H) = 0FH X-OR E6H= E9H 

XRL direct, A // bitwise X-OR operation of data in address direct with A // (direct) = (direct) X-OR A 
XRL 10H, A // If (10H) = 72H, A= 0FH, → (10H) = 72H X-OR 0FH= 7DH 

Example : Illustrate use XRL instructions. 

Solution: 
MOV A, #0A4H             A= A4H 
XRL A, #71H                 A= A4H EX-OR 71H =D5H





Post a Comment

Previous Post Next Post