$NetBSD: patch-ar,v 1.1 2007/03/17 13:44:19 tsutsui Exp $

--- ic/m68k/m68k-execute.c.orig	2006-10-01 08:23:58.000000000 -0400
+++ ic/m68k/m68k-execute.c	2006-10-01 08:27:17.000000000 -0400
@@ -591,6 +591,18 @@
 	  _TME_M68K_EXECUTE_FETCH_S16(ea_bd);
 	  /* XXX simulates preincremented pc: */
 	  ea_address = ic->tme_m68k_ireg_pc + first_ea_extword_offset + ea_bd;
+
+          /* if instruction has immediate, then we need to add either 2 bytes
+             (for byte or word) or 4 bytes (for lword) to get the effective
+             address
+          */
+          if (TME_M68K_OPCODE_HAS_IMM(params)) {
+            if (TME_FIELD_EXTRACTU(TME_M68K_INSN_OPCODE,6,2) == 2)
+              ea_address = ea_address + 4;
+            else
+              ea_address = ea_address + 2;
+          }
+
 	  ea_function_code = function_code_program;
 	  break;
 	}
