Next: , Previous: , Up: MIX instruction set   [Contents][Index]

#### 2.1.2.10 Shift operators

The following instructions perform byte-wise shifts of the contents of ‘rA’ and ‘rX’.

`SLA`
`SRA`
`SLAX`
`SRAX`
`SLC`
`SRC`

Shift rA or rAX left, right, or rAX circularly (see example below) left or right. M specifies the number of bytes to be shifted. OPCODE = 6, MOD = 0, 1, 2, 3, 4, 5.

The following instructions perform binary shifts of the contents of ‘rA’ and ‘rX’.

`SLB`
`SRB`

Shift rAX left or right binary. M specifies the number of binary places to shift. OPCODE = 6, MOD = 6, 7

If we begin with, say, ‘[rA]’ = - 01 02 03 04 05, we would have the following modifications to ‘rA’ contents when performing the instructions on the left column:

 SLA 2 [rA] = - 03 04 05 00 00 SLA 6 [rA] = - 00 00 00 00 00 SRA 1 [rA] = - 00 01 02 03 04

Note that the sign is unaffected by shift operations. On the other hand, ‘SLC’, ‘SRC’, ‘SLAX’, ‘SRAX’, ‘SLB’ and ‘SRB’ treat ‘rA’ and ‘rX’ as a single 10-bytes register (ignoring again the signs). For instance, if we begin with ‘[rA]’ = + 01 02 03 04 05 and ‘[rX]’ = - 06 07 08 09 10, we would have:

 SLC 3 [rA] = + 04 05 06 07 08 [rX] = - 09 10 01 02 03 SLAX 3 [rA] = + 04 05 06 07 08 [rX] = - 09 10 00 00 00 SRC 4 [rA] = + 07 08 09 10 01 [rX] = - 02 03 04 05 06 SRAX 4 [rA] = + 00 00 00 00 01 [rX] = - 02 03 04 05 06 SLB 1 [rA] = + 02 04 06 08 10 [rX] = - 12 14 16 18 20

Next: , Previous: , Up: MIX instruction set   [Contents][Index]