Addressing Modes

There are 12 modes in 68000 and 18 modes in 68020-68040.
 

1) Absolute Long

It specifies a 24/32 bit address directly.  The data is read or written to that address.
Eg.          MOVE.W    $A56C20, D3    copies contents of address A56C20, A56C21 to D3.W
               MOVE.W     JUNK,D3          copies contents of address JUNK to D3.W
               MOVE.W     JUNK+2,D3      copies contents of address JUNK+2 and address JUNK+3 i.e. the same thing can be done with:
       MOVE.W  OTHER,D3

JUNK:    DS.W            1
OTHER: DS.W            1

The last two examples are quite common with programmers but real assemblers always translate "absolute long" to a PC-relative mode. (relocability problems).

2) Absolute Short

It specifies a 16 bit address, sign extended to 24/32 bits.  This gives addresses in 0000-7FFF lowest 32K  memory and
FFFF8000-FFFFFFFF highest 32K memory.  These areas often contain special system data which the operating system does not want wiped out.  Do NOT use.
Eg. MOVE.W                                               $2F3C.W,D2
      MOVE.W                                                 JUNK.W, D2
W refers to size of data                             W refers to size of address
If JUNK had address 0001A800 the effective address is FFFFA800.
 

3) Data Register Direct

It specifies a data register (i.e. D). Syntax Di
Eg.  MOVE.W	 D3,D4    copies register D3 into register
D4

4) Address Register Direct

It specifies an address(A) register.
Eg.	MOVE.L 	A3,D4 
copies A3 into D4. Does not access memory.

5) Immediate

It specifies data that is embedded in the instruction. Syntax #value.
Eg.
MOVE.L 		#$A56C20,D3   copies $00A56C20 into D3
whereas
MOVE.L 		$A56C20,D3    copies contents of memory at A56C20 into D3

MOVE.W 		JUNK,D3       copies contents of memory at JUNK into D3
whereas
MOVE.W 		#JUNK,D3      copies address JUNK into D3
In a real system the last instruction would not be allowed due to relocatibility problems. It works fine on the Simulator but use
LEA             JUNK,D3  

6) 7) 8) Data Register Direct

It specifies the contents of memory at an address contained in an A register. Syntax
 (Ai)  or  (Ai)+  or   -(Ai)
(Ai)+ increments Ai by the size of DATA after using the address
-(Ai) decrements Ai by the size of DATA before using the address

Useful for stacks and arrays. You can get easy sequential access to data items in consecutive memory locations.

Eg.
Suppose A5 contains 00ABCDE0
Suppose memory is address   content
                  ABCDDE    0000
                  ABCDE0    1234
                  ABCDE2    5678
then
MOVE.W	(A5),D3   	moves 1234 into D3.W
MOVE.W  (A5)+,D4	moves 1234 into D4.W, then increments A5 by 2
MOVE.W  (A5)+,D6        moves 5678 into D6.W, then increments A5 by 2
MOVE.W  -(A5),D3	decrements A5 by 2, then moves 5678 into D3
MOVE.W  -(A5),D4	decrements A5 by 2, then moves 1234 into D4
MOVE.W  -(A5),D2        decrements A5 by 2, then moves 0000 into D2

9) Register Indirect with Displacement

It refers to contents of memory at address formed by adding a displacement to contents of An. Syntax: disp(An) or modern assemblers accept (disp,Ai). The displacement is a 16 bit 2's complement signed integer constant that is embedded in the instruction.
Eg.
If A3 contains $00ABC000 then
MOVE.W  $0F3(A3),D3   will copy the word at address $00ABC0F3 into
D3.W
MOVE.L  -1(A3),D1     will copy the long at address $00ABBFFF into D1.L
It is used for many data structures like structures and records. It is used for accessing portions of any block of memory whose location (first byte) is stored in a register. It is used a lot.

10) Address Register indirect with Index

disp(An,Rn) accesses the memory at (An+disp+Rn). Rn is the index and may be D or A register. Although complicated it is useful.

11) & 12) Program Counter Addressing Modes.

Not really used much by programmers but necessary for relocatability. More later.

Note that this gives access to memory + or - 32K from an address in An. This is the reason for many 32K byte limits on blocks of data. Eg. local variables in THINK Pascal.

Allowable modes

Only the above modes are allowed. All operands must have a syntax which EXACTLY matches one of these modes. The "Ai", "Di", and "const" values must be exactly that. They are not general-purpose "expressions" as used in high-level languages.

move.w 47(A3),D4 ;OK
move.w 47(D3),D3 ;no such mode - invalid
move.w D3(A3),D2 ;no such mode - invalid
move.w (A4+3),D1 ;no such mode - invalid
move.w 3+2(A4),D0 ;OK because "3+2" is still a "constant"