From 6cab49fd0732432ce87b5f7ce4437ad8d4068bd0 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 5 May 2008 20:08:08 +0000 Subject: [PATCH] code region dump added for Musashi git-svn-id: file:///home/notaz/opt/svn/PicoDrive@439 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Sek.c | 27 +++++++++++++++++++++++++++ cpu/musashi/Makefile | 2 ++ cpu/musashi/m68kconf.h | 3 ++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Pico/Sek.c b/Pico/Sek.c index 84d78070..ac125808 100644 --- a/Pico/Sek.c +++ b/Pico/Sek.c @@ -193,3 +193,30 @@ PICO_INTERNAL void SekSetRealTAS(int use_real) #endif } +#if defined(EMU_M68K) && M68K_INSTRUCTION_HOOK == OPT_SPECIFY_HANDLER +static unsigned char op_flags[0x400000/2] = { 0, }; +static int atexit_set = 0; + +static void make_idc(void) +{ + FILE *f = fopen("idc.idc", "w"); + int i; + if (!f) return; + fprintf(f, "#include \nstatic main() {\n"); + for (i = 0; i < 0x400000/2; i++) + if (op_flags[i] != 0) + fprintf(f, " MakeCode(0x%06x);\n", i*2); + fprintf(f, "}\n"); + fclose(f); +} + +void instruction_hook(void) +{ + if (!atexit_set) { + atexit(make_idc); + atexit_set = 1; + } + if (REG_PC < 0x400000) + op_flags[REG_PC/2] = 1; +} +#endif diff --git a/cpu/musashi/Makefile b/cpu/musashi/Makefile index 10ec9527..5ace7da7 100644 --- a/cpu/musashi/Makefile +++ b/cpu/musashi/Makefile @@ -1,3 +1,5 @@ +all : m68kops.c + m68kops.c : m68kmake ./$< diff --git a/cpu/musashi/m68kconf.h b/cpu/musashi/m68kconf.h index 00798719..730cf981 100644 --- a/cpu/musashi/m68kconf.h +++ b/cpu/musashi/m68kconf.h @@ -155,7 +155,8 @@ * instruction. */ #define M68K_INSTRUCTION_HOOK OPT_OFF -#define M68K_INSTRUCTION_CALLBACK() your_instruction_hook_function() +//#define M68K_INSTRUCTION_HOOK OPT_SPECIFY_HANDLER +#define M68K_INSTRUCTION_CALLBACK() instruction_hook() /* If ON, the CPU will emulate the 4-byte prefetch queue of a real 68000 */ -- 2.39.5