Gotchas: Difference between revisions

Content added Content deleted
Line 110: Line 110:


===LEA Does Not Dereference===
===LEA Does Not Dereference===
When dereferencing a pointer, it is necessary to use parentheses. For these examples,
When dereferencing a pointer using an address register, it is necessary to use parentheses. For these examples,
<syntaxhighlight lang="68000devpac">MOVEA.L #$A04000,A0 ;load the address $A04000 into A0
<syntaxhighlight lang="68000devpac">MOVEA.L #$A04000,A0 ;load the address $A04000 into A0
MOVE.L A0,D0 ;move the quantity $A04000 into D0
MOVE.L A0,D0 ;move the quantity $A04000 into D0
Line 120: Line 120:
<syntaxhighlight lang="68000devpac">LEA $A04000,A0 ;effectively MOVEA.L #$A04000,A0
<syntaxhighlight lang="68000devpac">LEA $A04000,A0 ;effectively MOVEA.L #$A04000,A0
LEA (4,A0),A0 ;effectively ADDA.L #4,A0</syntaxhighlight>
LEA (4,A0),A0 ;effectively ADDA.L #4,A0</syntaxhighlight>

Also, as we have seen before, constant pointers do not need parentheses and are automatically dereferenced.


===Partitioned Registers===
===Partitioned Registers===