beautypg.com

Shr (shift right) – Echelon Neuron User Manual

Page 133

background image

SHR (Shift Right)

The SHR instruction shifts the byte in TOS one bit to the right. The SHR

instruction uses the implicit addressing mode. This instruction moves a zero into

bit 7 of TOS, and discards bit 0. This instruction also clears the Carry flag.
Figure 13 shows the operation of the SHR instruction.

TOS

7

0

0

C

0

Figure 13. The SHR Instruction

The SHR instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The SHR instruction requires no operands:

SHR

Table 54 describes the attributes of the SHR instruction.

Table 54. SHR Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

SHR

3A

1

2

Cleared


Example:
The following example pushes the number 150 (h’96) onto the data stack, and

then uses the SHR instruction to shift the TOS value right. After the SHR

instruction completes, TOS has the value 75 (h’4B) and the Carry flag is cleared.

push #d’150 ; ( d’150, -- )

shr ; ( d’75, -- )

Neuron Assembly Language Reference

123