link

Link and allocate

Pushes an address register onto the stack, copies a7 into it, then adds a signed displacement to a7.

XNZVC –––––
  • Changes no flag

Forms

  • link ,

68020 only

These forms require the 68020. Select opt p=68020 before any code or data.

  • link , Size .w
  • link , Size .l

Operands

Use a negative displacement to reserve space for local values.

On the 68020, link.w is the same instruction as link, and link.l accepts a signed 32-bit displacement. On the 68000 and 68010, write link without a size suffix.

* --- Create stack frame with 8 bytes of local space ---
link a6, #-8
; a6 now points to the old a6 (frame pointer)
; sp = a6 - 8 (room for locals)
move.l #$1234, -4(a6) ; local variable 1
move.l #$5678, -8(a6) ; local variable 2
unlk a6 ; restore sp and a6