#endif\r
}\r
\r
+#if defined(EMU_M68K) && M68K_INSTRUCTION_HOOK == OPT_SPECIFY_HANDLER\r
+static unsigned char op_flags[0x400000/2] = { 0, };\r
+static int atexit_set = 0;\r
+\r
+static void make_idc(void)\r
+{\r
+ FILE *f = fopen("idc.idc", "w");\r
+ int i;\r
+ if (!f) return;\r
+ fprintf(f, "#include <idc.idc>\nstatic main() {\n");\r
+ for (i = 0; i < 0x400000/2; i++)\r
+ if (op_flags[i] != 0)\r
+ fprintf(f, " MakeCode(0x%06x);\n", i*2);\r
+ fprintf(f, "}\n");\r
+ fclose(f);\r
+}\r
+\r
+void instruction_hook(void)\r
+{\r
+ if (!atexit_set) {\r
+ atexit(make_idc);\r
+ atexit_set = 1;\r
+ }\r
+ if (REG_PC < 0x400000)\r
+ op_flags[REG_PC/2] = 1;\r
+}\r
+#endif\r
* instruction.\r
*/\r
#define M68K_INSTRUCTION_HOOK OPT_OFF\r
-#define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function()\r
+//#define M68K_INSTRUCTION_HOOK OPT_SPECIFY_HANDLER\r
+#define M68K_INSTRUCTION_CALLBACK() instruction_hook()\r
\r
\r
/* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */\r