3.2. Bitwise Logic 2

3.2.1. EOR

The EOR instruction compares the individual bits of two patterns using logical exclusive or: produce a 1 if one of the two inputs is 1, produce 0 if the input bits are the same. In these two patterns:

313029282726252423222120191817161514131211109876543210
00000000000000000000000010101100
000000AC
313029282726252423222120191817161514131211109876543210
00000000000000000000000011110110
000000F6

Bits number 1, 3, 4, and 6 are 1 in exactly one of the inputs:

313029282726252423222120191817161514131211109876543210
00000000000000000000000001011010
0000005A
EORrd, rn, rm / #

Combine the bits of rn and the bits of rm or # with exclusive or. Result in rd.

3.2.2. NOT

Thgere is no instruction named NOT, but the MVN instruction does the job of logical NOT. It takes a pattern and flips all the bits so 1’s become 0’s and vice verse. This pattern:

313029282726252423222120191817161514131211109876543210
00000000000000000000000010101100
000000AC

Produces this when negated:

313029282726252423222120191817161514131211109876543210
11111111111111111111111101010011
FFFFFF53
MVNrd, rn / #

Place the bitwise negation of rm or # in rd. Does logical NOT.


@EOR gives 1 if bits are different
MOV   r7,      #0xac              @ r7 = 0000 ... 1010 1100
@              #0xFD                     0000 ... 1111 0110
EOR   r8, r7,  #0xFF              @ r8 = 0000 ... 0101 1010

MOV   r9,      #0xAC              @ r9 = 0000 ... 1010 1100
MVN   r10, r9                     @ r10= 1111 ... 0101 0011
MVN   r11, r10                    @ r11= 0000 ... 1010 1100
Try sample
You have attempted of activities on this page
Next Section - 3.3. Masking