SHIFTS


Back to:
index table

LEFT SHIFT instruction

Coding:
bin: 00001110 1010 OP
hex: 0 E A OP
(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:
index table top


RIGH SHIFT instruction

Coding:
bin: 00001011 1011 OP
hex: 0 E B OP
(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:
index table top


ARITHMETIC RIGHT SHIFT instruction

Coding:
bin: 00001110 1100 OP
hex: 0 E C OP
(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:
index table top