Category:68000 Assembly: Difference between revisions

Content added Content deleted
Line 67: Line 67:
A calculated offset can be saved to an address register with the <code>LEA</code> command, which stands for "Load Effective Address." [[x86 Assembly]] also has this command, and it serves the same purpose. The syntax for it can be a bit misleading depending on your assembler.
A calculated offset can be saved to an address register with the <code>LEA</code> command, which stands for "Load Effective Address." [[x86 Assembly]] also has this command, and it serves the same purpose. The syntax for it can be a bit misleading depending on your assembler.


<lang 68000devpac>LEA myData,A0 ;load the effective address of myData into A0
<lang 68000devpac>LEA myData,A0 ;load the effective address of myData into A0
LEA (4,A0),A1 ;load into A1 the effective address A0+4. This looks like a dereference operation but it is not!
LEA (4,A0),A1 ;load into A1 the effective address A0+4. This looks like a dereference operation but it is not!
MOVE.W (A1),D1 ;dereference A1, loading the value it points to into D1.</lang>
MOVE.W (A1),D1 ;dereference A1, loading the value it points to into D1.</lang>