beautypg.com

Shra (shift right arithmetically) – Echelon Neuron User Manual

Page 134

background image

SHRA (Shift Right Arithmetically)

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

The SHRA instruction uses the implicit addressing mode. This instruction

moves bit 0 of TOS into the Carry flag, and leaves bit 7 of TOS unchanged.
Figure 14 shows the operation of the SHRA instruction.

TOS

7

0

C

6

Figure 14. The SHRA Instruction

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

Syntax:
The SHRA instruction requires no operands:

SHRA

Table 55 describes the attributes of the SHRA instruction.

Table 55. SHRA Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

SHRA

3C

1

2

Modified


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

then uses the SHRA instruction to shift the TOS value right arithmetically.

After the SHRA instruction completes, TOS has the value 203 (h’CB) and the

Carry flag is set to 0 (the previous value of bit 0 in TOS).

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

shra ; ( d’203, -- )

124

Neuron Assembly Language Instruction Statements