LOGIC OPERATIONS


Back to:
index table

AND instruction

Coding:
bin: MOD0111 OP1OP2
hex: MOD7 OP1OP2
(MOD - modifier: affects on operands type - word/byte, or maybe specifies "short constant"; OP1 and OP2 - operands)

Description:
OP2 and OP1 ==> OP2
This instruction makes a logical AND between R2 and R1. The result is stored to R2. Flags N and Z are set accoring to the result.

Examples:
0712 R2 and R1 ==> R2 the result of logical AND between R2 and R1 will be stored to R2
0750 R0 and (R1) ==> R0 logical AND between two values: from R0 and from the memory, which address is stored in R1; the result will be placed into R0
07D3
FFFE
R3 and FFFE ==> R3 reset the least significant bit of R3 (if a bit of the constant is set, the result will repeat the same bit in R3; in other case, the result bit will be zero without reference to the second operand!)
3723 R3 and (-2) ==> R3 this instruction will do exastly the same action, because the "short constant" -2 is presented as FFFE

Back to:
index table top


OR instruction

Coding:
bin: MOD1000 OP1OP2
hex: MOD8 OP1OP2
(MOD - modifier: affects on operands type - word/byte, or maybe specifies "short constant"; OP1 and OP2 - operands)

Description:
OP2 or OP1 ==> OP2
This instruction makes a logical operation OR between OP1 and OP2 and writes the result to OP2. Flags N and Z are set accoring to the result.

Examples:
0812 R2 or R1 ==> R2 the result of logical OR between R2 and R1 will be stored to R2
083D
C000
R3 or C000 ==> R3 this command will set two most significant bits in R3 (if a bit of the constant is reset, the result will repeat the same bit in R3; but if it is set, the result bit will be equal to 1 without reference to second operand!)

Back to:
index table top


XOR instruction

Coding:
bin: MOD1001 OP1OP2
hex: MOD9 OP1OP2
(MOD - modifier: affects on operands type - word/byte, or maybe specifies "short constant"; OP1 and OP2 - operands)

Description:
OP2 xor OP1 ==> OP2
This instruction makes a logical operation XOR (eXclusive OR) between OP1 and OP2 and writes the result to OP2. Flags N and Z are set accoring to the result.

Examples:
0912 R2 xor R1 ==> R2 the result of logical XOR between R2 and R1 will be stored to R2
09D3
A5A5
R3 xor A5A5 ==> R3
this instruction will give zero result, if R3 value is equal to constant A5A5 from the second word of command;in all other cases, the different bits will be set

Back to:
index table top



NOT instruction

Logical operation NOT has only one operand. So it is described in the topic "Unary operations".

Back to:
index table top