Back to:
LEFT SHIFT instruction
Coding:
(OP - operand)
Description:
left shift OP ==> OP
This instruction makes left shift of OP for one bit (for example,
0001 0010 0011 0100 ==> 0010 0100 0110 1000) and stores the result
back to OP. Flags N and Z are set according to the result.
Examples:
0EA0 |
left shift R0 ==> R0 |
will shift R0 value |
Back to:
Coding:
(OP - operand)
Description:
right shift OP ==> OP
This instruction makes right shift of OP for one bit (for example,
0100 0011 0010 0001 ==> 0010 0001 1001 0000) and stores the result
back to OP. Flags N and Z are set according to the result.
Examples:
0EB0 |
righ shift R0 ==> R0 |
will shift R0 value |
Back to:
Coding:
(OP - operand)
Description:
arithetic righ shift of OP ==> OP
This instruction makes arithmetic right shift of OP for one bit
(for example, 1111 0100 0011 0010 ==> 1111 1010 0001 1001: the high
bit keeps its value) and stores the result back to OP. Flags N and Z
are set according to the result.
Let's compare EB and EC shift instructions:
OP: |
1111 0000 1111 0000 |
EB instruction result: |
0111 1000 0111 1000 |
EC instruction result: |
1111 1000 0111 1000 |
Examples:
0EC0 |
arithmetic right shift R0 ==> R0 |
will shift R0 value, conserving sign bit value |
Back to:
|