您可以在 68000 中移动长字的最大位数

The maximum number of bits you can shift long word in 68000

这可能是非常愚蠢的事情,但我想问这个问题来澄清我的想法。

我正在做很棒的 68k 汇编教程 (link)。一切顺利,但我不明白一件事。让我引用:

You can shift using one data register as a shift size, for example:

      lsl.l     d0,d1

Now in this example, d1 is shifted left by the number held in d0. We’ll pretend at d0 contains 0000010F.

For the source operand, only a byte is read as the shift count. Since d0 contains 0000010F, only the 0F is used. So, the long-word of d1 is shifted left by 0F bits.

The maximum number of bits you can shift by depends on the size you chose:

.b for byte gives a maximum shift of  bits.
.w for word gives a maximum shift of  bits.
.l for long-word gives a maximum shift of F bits.

这里是这样的:为什么对于字节和 16 位字操作可以使用全长(字节为 0x08,16 位字为 0x10)而对于 32 位长字只能使用 0x1F?因此,32位长字不应该是0x20吗?

无论如何,我没有看到一个点将字节移动 8 位,因为这将始终给出 0x00 作为结果。

我仍然不明白本教程中的长词异常。

感谢任何帮助。

您最多只能使用 0x1F 作为移位大小,因为在一个长字中有 32 位,所以只有 31 位可以在完全 运行 之前将最低位移动到移动位的位置。

至于为什么处理器或至少汇编程序不接受 0x20 作为要移动的位数,这是设计芯片或汇编程序的人的设计决定。请记住,如果汇编程序是看门人,除非您手动编辑二进制规则。如果汇编程序不接受该代码,除非您手动编辑二进制文件,否则芯片是否接受它并不重要。