beautypg.com

Xor_r (exclusive or and return) – Echelon Neuron User Manual

Page 139

background image

XOR_R (Exclusive Or and Return)

The XOR_R instruction performs a logical exclusive OR (XOR) for two numbers

and performs a return-from-call operation. The XOR_R instruction uses the

implicit addressing mode. The XOR_R instruction retrieves both TOS and

NEXT from the data stack and performs a bitwise logical XOR 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 XOR_R instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The XOR_R instruction requires no operands:

XOR_R

Table 59 describes the attributes of the XOR_R instruction.

Table 59. XOR_R Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

XOR_R

5F

1

7

Cleared


Example:
The following example performs the operation 2 XOR 3 and performs the return-

from-call operation. The example assumes that the return stack contains the

address of the caller to which the XOR_R instruction returns.

pushs #2 ; (2, -, -)

pushs #3 ; (3, 2, -)

xor_r ; (1, -, -)

The value of TOS after this code executes is 3 because 2 XOR 3 = 1. After

completing the logical XOR operation, the XOR_R instruction performs the

return-from-call operation.




Neuron Assembly Language Reference

129