How to implement a logical shift (to the left) by 8 bits?

Lexy Feito picture Lexy Feito · Mar 27, 2013 · Viewed 7.5k times · Source

I am trying to determine how to shift the last 8 bits (i.e. byte) of a 16 bit (two byte) word to the left using the LC-3 instruction set.

For example,

0000 0000 1111 1111 -> 1111 1111 0000 0000

Answer

Jordan Dea-Mattson picture Jordan Dea-Mattson · Mar 27, 2013

Now understanding that you are talking about LC-3, I found the LC-3b Miroarchitecture and this presentation on the Instruction Set referenced.

You need to implement a logical shift. Specifically a logical shift left. A number of ways are available to do this.

If you understand binary arithmetic, you will be able to do this in a straightforward way.