简体   繁体   中英

68k ASM addressing modes

I learned some 68k/Coldfire at the Uni, and having difficult understanding the more complex addressing modes (with the numbers near the parentheses of dereference).

I think example are the best here:

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

Could anyone please explain me in plain words what happends in each instruction?

Please elaborate more if needed (pre/post incrementations, etc.).

Thanks!! ;)

Ad lea instructions:

  • A1) A0 will be set to A1+A2+5
  • A2) A0 will bet set to 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. Eg 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM