More 680x0 Fundamental Instructions

LEA (Load Effective Address)

lea <ea>,Ai

The first operand (<ea> or "effective address") must refer directly to an address in memory. It cannot be Di, Ai, (Ai)+, -(Ai), or #const. But no memory access is done. Instead, the address that would have been used by a normal instruction (move, add, etc.) is placed in Ai.

lea Junk,A3 ;Put the address Junk into A3 (right)
movea.l #Junk,A3 ;Put the address Junk into A3 (wrong)

Under "normal" conditions, the above two instructions would accomplish the same thing. However, due to "relocatability" in real-life systems (Mac + MAS), the second one will generate an error message. Always use the first one.

CLR (Clear)

clr{.size} dst

Clears the destination to 0. The destination (dst) operand must be a "data alterable mode" (it cannot be an A register, an immediate operand (#const), or a PC-relative address).

clr.w D3 ;Initialize D3 to 0
clr.l Count ;Initialize Count to 0
clr.w (A4)+ ;Clear the next word in the array

NEG (Negate)

neg{.size} dst

Negates the destination (twos complements it). The destination (dst) operand must be a "data alterable mode" (it cannot be an A register, an immediate operand (#const), or a PC-relative address).

neg.w D3 ;Negate D3
neg.l X ;Negate X
neg.w (A4)+ ;Negate the next word in the array

JSR (Jump to SubRoutine)

jsr addresss

This is not a complete description of this instruction. That will be done later. For now, we will only use it to call built-in library routines (for things such as I/O).

jsr stop ;terminate this program
jsr decin ;read in a deciman number
jsr strout ;write out a character string