X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FSek.c;h=ac125808a85b06b6219e2406861fece01ef4ebc6;hb=6cab49fd0732432ce87b5f7ce4437ad8d4068bd0;hp=e77128087310fdeb18711dde8d8539b4b0ac5954;hpb=fad248933b6676d30ccf419858b4ee10cc123fc5;p=picodrive.git diff --git a/Pico/Sek.c b/Pico/Sek.c index e771280..ac12580 100644 --- a/Pico/Sek.c +++ b/Pico/Sek.c @@ -114,7 +114,7 @@ PICO_INTERNAL int SekInit() m68k_init(); m68k_set_int_ack_callback(SekIntAckM68K); m68k_set_tas_instr_callback(SekTasCallback); - m68k_pulse_reset(); // Init cpu emulator + //m68k_pulse_reset(); m68k_set_context(oldcontext); } #endif @@ -153,6 +153,7 @@ PICO_INTERNAL int SekReset() m68ki_cpu.sp[0]=0; m68k_set_irq(0); m68k_pulse_reset(); + REG_USP = 0; // ? #endif #ifdef EMU_F68K { @@ -192,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