68k ASM寻址模式

Lal*_*oyo 1 assembly 68000 coldfire addressing-mode

我在大学学习了68k / Coldfire,并且难以理解更复杂的寻址模式(数字位于取消引用的括号附近)。

我认为最好的例子是:

A) lea:
A1) lea $5(a1,a2.l), a0
A2) lea -1(a1,a2), a0

B) move:
B1) move.b 1(a1),d0
B2) move.b -2(a1),d0
Run Code Online (Sandbox Code Playgroud)

谁能用简单的语言解释我,每条指令中发生了什么?

如果需要,请详细说明(增加/增加前后等)。

谢谢!!;)

小智 6

广告说明:

  • A1)A0将设置为A1 + A2 + 5
  • A2)A0将下注设置为A1 + A2-1

As the name of the lea instructions implies, it is used to load an address into an address register. It will not move data from indirect addressing. I haven't checked if those instructions are valid and my 68k skills are quite rusty now, so I assume they are. Not specifying the index register width in A2 introduces ambiguity. From the top of my head I cannot recollect if .W or .L was the default register width here, so specifying that might be a good idea.

Ad move instructions:

  • B1) D0 will be set to the byte that immediately follows the address stored in A1. E.g. if A1 is set to $1000, the byte that will be read is the one at address $1001.
  • B2) As in B1, but the content will be readm from 2-bytes ahead the A1 address. Again assuming A1 will be preloaded with $1000, the byte that will be read is the one at location $FFE.

For completeness, the addressing modes are:

  • A1) Register indirect with index and displacement
  • A2) dito
  • B1) Register indirect with displacement
  • B2) dito

  • 无需在Coldfire中指定索引寄存器的宽度-此处,索引寄存器始终为`.l'-同样支持68k的字宽。 (2认同)