AND
The AND instruction provides bit manipulation by logically ANDing the source with the destination and storing the result over the destination. It uses one of the following formats:
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
source1
Required. A previously defined Character String Variable single character Literal decimal constant, or equivalent {ctrl} character that is ANDed with the {dest} operand.
sep
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
dest1
Required. A previously defined Character String Variable that is ANDed with the {source} operand contains the results.
source2
Required. A previously defined INTEGER variable that is ANDed with the {dest} operand.
dest2
Required. A previously defined INTEGER that is ANDed with the {source} operand contains the results.
Flags Affected: EOS, ZERO
Note the following:
The {source} operand remains unchanged.
If the {source} or {dest} is a Null String, the EOS Condition Flag is set.
If the result is zero, the ZERO Condition Flag is set.
Any bit in the character may be manipulated.
Enhanced ARRAY processing is supported for the AND instruction.
The following truth table indicates the results of the operation on each bit:
|
Source |
Dest |
Result |
|
0 |
0 |
0 |
|
0 |
1 |
0 |
|
1 |
0 |
0 |
|
1 |
1 |
1 |
Example 1:
|
|
|
|
|
|
Variable |
PL |
FP |
LP |
Contents |
|
Before: |
SENDING |
6 |
3 |
6 |
ABCDEF |
|
|
RECVING |
8 |
1 |
8 |
N2345678 |
|
| |||||
|
After: |
SENDING |
6 |
3 |
6 |
ABCDEF |
|
|
RECVING |
8 |
1 |
8 |
B2345678 |
No Condition Flags are set (all FALSE).
'C' ==> 0100 0011
'N' ==> 0100 1110
--------------------
'B' ==> 0100 0010
Example 2:
|
|
|
|
|
|
Variable |
PL |
FP |
LP |
Contents |
|
Before: |
HEX_FFF0 |
2 |
|
|
0x11111111 11110000 |
|
|
COUNTER |
2 |
|
|
0x0 01110111 |
|
After: |
COUNTER |
2 |
|
|
0x0 01110000 |
No Condition Flags are set (all FALSE).
0xFFF0 ==> 1111 1111 1111 0000
119 ==> 0000 0000 0111 0111
-------------------------------
116 ==> 0000 0000 0111 0000
See Also: NOT, OR, TEST, XOR, Character String Instructions
![]() |