And_r (and and return) – Echelon Neuron User Manual
Page 79
![background image](/manuals/735710/79/background.png)
AND_R (And and Return)
The AND_R instruction performs a logical AND for two numbers and performs a
return-from-call operation. The AND_R instruction uses the implicit addressing
mode. The AND_R instruction retrieves both TOS and NEXT from the data
stack and performs a bitwise logical AND for them. TOS and NEXT are
consumed, and the result is placed in TOS. The operation clears the Carry flag.
The return-from-call operation loads the instruction pointer (IP) with the return
address from the return stack.
The AND_R instruction applies to Series 3100, 5000, and 6000 devices.
Syntax:
The AND_R instruction requires no operands:
AND_R
Table 15 describes the attributes of the AND_R instruction.
Table 15. AND_R Instruction
Instruction
Hexadecimal
Opcode
Instruction
Size (Bytes)
CPU Cycles
Required
Affect on
Carry Flag
AND_R
5D
1
7
Cleared
Example:
The following example performs the operation 2 AND 3 and performs the return-
from-call operation. The example assumes that the return stack contains the
address of the caller to which the AND_R instruction returns.
pushs #2 ; (2, -, -)
pushs #3 ; (3, -, -)
and_r ; (2, -, -)
The value of TOS after this code executes is 2 because 2 AND 3 = 2. After
completing the logical and operation, the AND_R instruction performs the
return-from-call operation.
Neuron Assembly Language Reference
69