7.7.55 SHIFT LEFT (<<)
Function
STL
Load the
L D8
double word
D8 into the
word
accumulator.
Shift the
<<K+1
content of the
<<K+1
word
<<K+1
accumulator to
<<K+1
the left by the
number of bits
that are
specified in
the operand.
Assign the
= D12
result to
double word
D12.
December 2001
Syntax:
<< (SHIFT LEFT)
Operands:
B, W, D, K
Action:
A SHIFT LEFT instruction multiplies the content of the word accumulator by
two. This is done by simply shifting the bits by one place to the left. The result
must lie in the range of -2 147 483 648 to +2 147 483 647, otherwise the
accumulator contains an undefined value. You define the number of shifts
through the operand. The TNC fills the right end of the accumulator with zeros.
This instruction is one of the arithmetic commands because it includes the
sign bit. For this reason, and to save time, you should not use this command
to isolate bits.
Example:
Shift the content of double word D8 four times to the left, then assign it to
double word 12.
Initial state:
Double word D8
= 3E 80 (hex)
Double word D12
= ?
The accumulator content is shown here in binary notation; the operand
content in hexadecimal notation.
Accumulator contents [bit]
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 3 E 8 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 E8 0 0
Instead of using the << K+1 command four times, simply use the << K+4
command.
Commands
Operand
content (hex)
7 – 135