From b5e5172d049a83251874fb33e65a53c9654dc0bc Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 10 Nov 2007 15:49:07 +0000 Subject: [PATCH] famec hack, CPU debug in CD mode git-svn-id: file:///home/notaz/opt/svn/PicoDrive@292 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Debug.c | 50 ++++++++++-------- Pico/Memory.c | 43 ++++++++------- Pico/Pico.c | 4 +- Pico/PicoInt.h | 2 +- Pico/Sek.c | 3 +- Pico/cd/Memory.c | 89 +++++++++++++++++++++++++++----- Pico/cd/Pico.c | 8 ++- Pico/cd/Sek.c | 21 ++++++++ cpu/fame/famec.c | 13 +++-- cpu/fame/famec_opcodes.h | 109 ++++++++++++++++++++++++++++++++++++++- cpu/musashi/m68kcpu.h | 3 +- 11 files changed, 279 insertions(+), 66 deletions(-) diff --git a/Pico/Debug.c b/Pico/Debug.c index 1c22122..8c9db8d 100644 --- a/Pico/Debug.c +++ b/Pico/Debug.c @@ -7,7 +7,8 @@ typedef unsigned char u8; static unsigned int pppc, ops=0; extern unsigned int lastread_a, lastread_d[16], lastwrite_cyc_d[16], lastwrite_mus_d[16]; extern int lrp_cyc, lrp_mus, lwp_cyc, lwp_mus; -unsigned int old_regs[16], old_sr, ppop, have_illegal = 0, dbg_irq_level = 0; +unsigned int old_regs[16], old_sr, ppop, have_illegal = 0; +int dbg_irq_level = 0, dbg_irq_level_sub = 0; #undef dprintf #define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) @@ -21,13 +22,14 @@ unsigned int old_regs[16], old_sr, ppop, have_illegal = 0, dbg_irq_level = 0; #define other_is_stopped() (PicoCpuCM68k.state_flags&1) #define other_is_tracing() ((PicoCpuCM68k.state_flags&2)?1:0) #elif defined(EMU_F68K) -#define other_get_sr() PicoCpuFM68k.sr -#define other_dar(i) ((unsigned int*)PicoCpuFM68k.dreg)[i] -#define other_osp PicoCpuFM68k.asp -#define other_get_irq() PicoCpuFM68k.interrupts[0] -#define other_set_irq(irq) PicoCpuFM68k.interrupts[0]=irq -#define other_is_stopped() ((PicoCpuFM68k.execinfo&FM68K_HALTED)?1:0) -#define other_is_tracing() ((PicoCpuFM68k.execinfo&FM68K_EMULATE_TRACE)?1:0) +#define other_set_sub(s) g_m68kcontext=(s)?&PicoCpuFS68k:&PicoCpuFM68k; +#define other_get_sr() g_m68kcontext->sr +#define other_dar(i) ((unsigned int*)g_m68kcontext->dreg)[i] +#define other_osp g_m68kcontext->asp +#define other_get_irq() g_m68kcontext->interrupts[0] +#define other_set_irq(irq) g_m68kcontext->interrupts[0]=irq +#define other_is_stopped() ((g_m68kcontext->execinfo&FM68K_HALTED)?1:0) +#define other_is_tracing() ((g_m68kcontext->execinfo&FM68K_EMULATE_TRACE)?1:0) #else #error other core missing, don't compile this file #endif @@ -44,7 +46,7 @@ static int otherRun(void) } //static -void dumpPCandExit() +void dumpPCandExit(int is_sub) { char buff[128]; int i; @@ -56,19 +58,21 @@ void dumpPCandExit() dprintf("d%i=%08x, a%i=%08x | d%i=%08x, a%i=%08x", i, other_dar(i), i, other_dar(i+8), i, old_regs[i], i, old_regs[i+8]); dprintf("SR: %04x | %04x (??s? 0iii 000x nzvc)", other_get_sr(), old_sr); dprintf("last_read: %08x @ %06x", lastread_d[--lrp_cyc&15], lastread_a); - dprintf("ops done: %i", ops); + dprintf("ops done: %i, is_sub: %i", ops, is_sub); exit(1); } -int CM_compareRun(int cyc) +int CM_compareRun(int cyc, int is_sub) { char *str; - int cyc_done=0, cyc_other, cyc_musashi, err=0; - unsigned int i, mu_sr; + int cyc_done=0, cyc_other, cyc_musashi, *irq_level, err=0; + unsigned int i, pc, mu_sr; + m68ki_cpu_p=is_sub?&PicoCpuMS68k:&PicoCpuMM68k; + other_set_sub(is_sub); lrp_cyc = lrp_mus = 0; - while(cyc > cyc_done) + while (cyc_done < cyc) { if (have_illegal && m68k_read_disassembler_16(m68ki_cpu.pc) != 0x4e73) // not rte { @@ -87,7 +91,7 @@ int CM_compareRun(int cyc) //PicoCpuCM68k.srh|=0x20; } - pppc = SekPc; + pppc = is_sub ? SekPcS68k : SekPc; ppop = m68k_read_disassembler_16(pppc); memcpy(old_regs, &other_dar(0), 4*16); old_sr = other_get_sr(); @@ -102,11 +106,12 @@ int CM_compareRun(int cyc) } #endif - if (dbg_irq_level) + irq_level = is_sub ? &dbg_irq_level_sub : &dbg_irq_level; + if (*irq_level) { - other_set_irq(dbg_irq_level); - m68k_set_irq(dbg_irq_level); - dbg_irq_level=0; + other_set_irq(*irq_level); + m68k_set_irq(*irq_level); + *irq_level=0; } cyc_other=otherRun(); @@ -136,9 +141,10 @@ int CM_compareRun(int cyc) } // compare PC + pc = is_sub ? SekPcS68k : SekPc; m68ki_cpu.pc&=~1; - if (SekPc != m68ki_cpu.pc) { - dprintf("PC: %06x vs %06x", SekPc, m68ki_cpu.pc); + if (pc != m68ki_cpu.pc) { + dprintf("PC: %06x vs %06x", pc, m68ki_cpu.pc); err=1; } @@ -188,7 +194,7 @@ int CM_compareRun(int cyc) err=1; } - if(err) dumpPCandExit(); + if(err) dumpPCandExit(is_sub); #if 0 if (PicoCpuCM68k.a[7] < 0x00ff0000 || PicoCpuCM68k.a[7] >= 0x01000000) diff --git a/Pico/Memory.c b/Pico/Memory.c index 26be012..ca92e81 100644 --- a/Pico/Memory.c +++ b/Pico/Memory.c @@ -7,7 +7,7 @@ // For commercial use, separate licencing terms must be obtained. -#define __debug_io +//#define __debug_io #include "PicoInt.h" @@ -323,7 +323,7 @@ PICO_INTERNAL_ASM u32 PicoRead8(u32 a) #ifndef EMU_CORE_DEBUG // sram - if(a >= SRam.start && a <= SRam.end && (Pico.m.sram_reg&5)) { + if (a >= SRam.start && a <= SRam.end && (Pico.m.sram_reg&5)) { d = SRAMRead(a); elprintf(EL_SRAMIO, "sram r8 [%06x] %02x @ %06x", a, d, SekPc); goto end; @@ -341,7 +341,7 @@ end: dprintf("r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPc); #endif #ifdef EMU_CORE_DEBUG - if(a>=Pico.romsize/*&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b*/) { + if (a>=Pico.romsize) { lastread_a = a; lastread_d[lrp_cyc++&15] = (u8)d; } @@ -359,7 +359,7 @@ PICO_INTERNAL_ASM u32 PicoRead16(u32 a) #ifndef EMU_CORE_DEBUG // sram - if(a >= SRam.start && a <= SRam.end && (Pico.m.sram_reg&5)) { + if (a >= SRam.start && a <= SRam.end && (Pico.m.sram_reg&5)) { d = SRAMRead(a); d |= d<<8; elprintf(EL_SRAMIO, "sram r16 [%06x] %04x @ %06x", a, d, SekPc); @@ -377,7 +377,7 @@ end: dprintf("r16: %06x, %04x @%06x", a&0xffffff, d, SekPc); #endif #ifdef EMU_CORE_DEBUG - if(a>=Pico.romsize/*&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b*/) { + if (a>=Pico.romsize) { lastread_a = a; lastread_d[lrp_cyc++&15] = d; } @@ -411,7 +411,7 @@ end: dprintf("r32: %06x, %08x @%06x", a&0xffffff, d, SekPc); #endif #ifdef EMU_CORE_DEBUG - if(a>=Pico.romsize/*&&(ppop&0x3f)!=0x3a&&(ppop&0x3f)!=0x3b*/) { + if (a>=Pico.romsize) { lastread_a = a; lastread_d[lrp_cyc++&15] = d; } @@ -525,33 +525,36 @@ unsigned int m68k_read_pcrelative_CD16(unsigned int a); unsigned int m68k_read_pcrelative_CD32(unsigned int a); // these are allowed to access RAM -static unsigned int m68k_read_8 (unsigned int a, int do_fake) { +static unsigned int m68k_read_8 (unsigned int a, int do_fake) +{ a&=0xffffff; - if(PicoMCD&1) return m68k_read_pcrelative_CD8(a); - if(a=Pico.romsize) { + lastread_a = a; + lastread_d[lrp_cyc++&15] = d; + } #endif return d; } @@ -522,6 +530,12 @@ static u32 PicoReadM68k16(u32 a) #ifdef __debug_io dprintf("r16: %06x, %04x @%06x", a&0xffffff, d, SekPc); +#endif +#ifdef EMU_CORE_DEBUG + if (a>=Pico.romsize) { + lastread_a = a; + lastread_d[lrp_cyc++&15] = d; + } #endif return d; } @@ -583,6 +597,12 @@ static u32 PicoReadM68k32(u32 a) end: #ifdef __debug_io dprintf("r32: %06x, %08x @%06x", a&0xffffff, d, SekPc); +#endif +#ifdef EMU_CORE_DEBUG + if (a>=Pico.romsize) { + lastread_a = a; + lastread_d[lrp_cyc++&15] = d; + } #endif return d; } @@ -599,9 +619,9 @@ static void PicoWriteM68k8(u32 a,u8 d) #ifdef __debug_io dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc); #endif - //if ((a&0xe0ffff)==0xe0a9ba+0x69c) - // dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc); - +#ifdef EMU_CORE_DEBUG + lastwrite_cyc_d[lwp_cyc++&15] = d; +#endif if ((a&0xe00000)==0xe00000) { // Ram *(u8 *)(Pico.ram+((a^1)&0xffff)) = d; @@ -652,7 +672,9 @@ static void PicoWriteM68k16(u32 a,u16 d) #ifdef __debug_io dprintf("w16: %06x, %04x", a&0xffffff, d); #endif - // dprintf("w16: %06x, %04x @%06x", a&0xffffff, d, SekPc); +#ifdef EMU_CORE_DEBUG + lastwrite_cyc_d[lwp_cyc++&15] = d; +#endif if ((a&0xe00000)==0xe00000) { // Ram *(u16 *)(Pico.ram+(a&0xfffe))=d; @@ -716,6 +738,9 @@ static void PicoWriteM68k32(u32 a,u32 d) #ifdef __debug_io dprintf("w32: %06x, %08x", a&0xffffff, d); #endif +#ifdef EMU_CORE_DEBUG + lastwrite_cyc_d[lwp_cyc++&15] = d; +#endif if ((a&0xe00000)==0xe00000) { @@ -782,6 +807,9 @@ static u32 PicoReadS68k8(u32 a) { u32 d=0; +#ifdef EMU_CORE_DEBUG + u32 ab=a&0xfffffe; +#endif a&=0xffffff; // prg RAM @@ -865,6 +893,10 @@ static u32 PicoReadS68k8(u32 a) #ifdef __debug_io2 dprintf("s68k r8 : %06x, %02x @%06x", a&0xffffff, (u8)d, SekPcS68k); +#endif +#ifdef EMU_CORE_DEBUG + lastread_a = ab; + lastread_d[lrp_cyc++&15] = d; #endif return d; } @@ -878,6 +910,9 @@ static u32 PicoReadS68k16(u32 a) { u32 d=0; +#ifdef EMU_CORE_DEBUG + u32 ab=a&0xfffffe; +#endif a&=0xfffffe; // prg RAM @@ -958,6 +993,10 @@ static u32 PicoReadS68k16(u32 a) #ifdef __debug_io2 dprintf("s68k r16: %06x, %04x @%06x", a&0xffffff, d, SekPcS68k); +#endif +#ifdef EMU_CORE_DEBUG + lastread_a = ab; + lastread_d[lrp_cyc++&15] = d; #endif return d; } @@ -971,6 +1010,9 @@ static u32 PicoReadS68k32(u32 a) { u32 d=0; +#ifdef EMU_CORE_DEBUG + u32 ab=a&0xfffffe; +#endif a&=0xfffffe; // prg RAM @@ -1061,6 +1103,12 @@ static u32 PicoReadS68k32(u32 a) #ifdef __debug_io2 dprintf("s68k r32: %06x, %08x @%06x", a&0xffffff, d, SekPcS68k); +#endif +#ifdef EMU_CORE_DEBUG + if (ab > 0x78) { // not vectors and stuff + lastread_a = ab; + lastread_d[lrp_cyc++&15] = d; + } #endif return d; } @@ -1131,6 +1179,10 @@ static void PicoWriteS68k8(u32 a,u8 d) a&=0xffffff; +#ifdef EMU_CORE_DEBUG + lastwrite_cyc_d[lwp_cyc++&15] = d; +#endif + // prg RAM if (a < 0x80000) { u8 *pm=(u8 *)(Pico_mcd->prg_ram+(a^1)); @@ -1207,6 +1259,10 @@ static void PicoWriteS68k16(u32 a,u16 d) a&=0xfffffe; +#ifdef EMU_CORE_DEBUG + lastwrite_cyc_d[lwp_cyc++&15] = d; +#endif + // prg RAM if (a < 0x80000) { wrdprintf("s68k_prgram w16: [%06x] %04x @%06x", a, d, SekPcS68k); @@ -1293,6 +1349,10 @@ static void PicoWriteS68k32(u32 a,u32 d) a&=0xfffffe; +#ifdef EMU_CORE_DEBUG + lastwrite_cyc_d[lwp_cyc++&15] = d; +#endif + // prg RAM if (a < 0x80000) { if (a >= (Pico_mcd->s68k_regs[2]<<8)) { @@ -1563,7 +1623,8 @@ void PicoWriteCD32w(unsigned int a, unsigned int d) { } // these are allowed to access RAM -unsigned int m68k_read_pcrelative_CD8 (unsigned int a) { +unsigned int m68k_read_pcrelative_CD8 (unsigned int a) +{ a&=0xffffff; if(m68ki_cpu_p == &PicoCpuMS68k) { if (a < 0x80000) return *(u8 *)(Pico_mcd->prg_ram+(a^1)); // PRG Ram @@ -1589,7 +1650,8 @@ unsigned int m68k_read_pcrelative_CD8 (unsigned int a) { } return 0;//(u8) lastread_d; } -unsigned int m68k_read_pcrelative_CD16(unsigned int a) { +unsigned int m68k_read_pcrelative_CD16(unsigned int a) +{ a&=0xffffff; if(m68ki_cpu_p == &PicoCpuMS68k) { if (a < 0x80000) return *(u16 *)(Pico_mcd->prg_ram+(a&~1)); // PRG Ram @@ -1615,7 +1677,8 @@ unsigned int m68k_read_pcrelative_CD16(unsigned int a) { } return 0; } -unsigned int m68k_read_pcrelative_CD32(unsigned int a) { +unsigned int m68k_read_pcrelative_CD32(unsigned int a) +{ u16 *pm; a&=0xffffff; if(m68ki_cpu_p == &PicoCpuMS68k) { diff --git a/Pico/cd/Pico.c b/Pico/cd/Pico.c index 92dfe85..6db7e6a 100644 --- a/Pico/cd/Pico.c +++ b/Pico/cd/Pico.c @@ -88,7 +88,9 @@ static __inline void SekRunM68k(int cyc) int cyc_do; SekCycleAim+=cyc; if ((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return; -#if defined(EMU_C68K) +#if defined(EMU_CORE_DEBUG) + SekCycleCnt+=CM_compareRun(cyc_do, 0); +#elif defined(EMU_C68K) PicoCpuCM68k.cycles=cyc_do; CycloneRun(&PicoCpuCM68k); SekCycleCnt+=cyc_do-PicoCpuCM68k.cycles; @@ -106,7 +108,9 @@ static __inline void SekRunS68k(int cyc) int cyc_do; SekCycleAimS68k+=cyc; if ((cyc_do=SekCycleAimS68k-SekCycleCntS68k) <= 0) return; -#if defined(EMU_C68K) +#if defined(EMU_CORE_DEBUG) + SekCycleCntS68k+=CM_compareRun(cyc_do, 1); +#elif defined(EMU_C68K) PicoCpuCS68k.cycles=cyc_do; CycloneRun(&PicoCpuCS68k); SekCycleCntS68k+=cyc_do-PicoCpuCS68k.cycles; diff --git a/Pico/cd/Sek.c b/Pico/cd/Sek.c index dc714e8..ba85533 100644 --- a/Pico/cd/Sek.c +++ b/Pico/cd/Sek.c @@ -64,9 +64,13 @@ static int SekUnrecognizedOpcodeS68k(void) #ifdef EMU_M68K static int SekIntAckMS68k(int level) { +#ifndef EMU_CORE_DEBUG int level_new = new_irq_level(level); dprintf("s68kACK %i -> %i", level, level_new); CPU_INT_LEVEL = level_new << 8; +#else + CPU_INT_LEVEL = 0; +#endif return M68K_INT_ACK_AUTOVECTOR; } #endif @@ -76,7 +80,15 @@ static void SekIntAckFS68k(unsigned level) { int level_new = new_irq_level(level); dprintf("s68kACK %i -> %i", level, level_new); +#ifndef EMU_CORE_DEBUG PicoCpuFS68k.interrupts[0] = level_new; +#else + { + extern int dbg_irq_level_sub; + dbg_irq_level_sub = level_new; + PicoCpuFS68k.interrupts[0] = 0; + } +#endif } #endif @@ -109,6 +121,7 @@ PICO_INTERNAL int SekInitS68k() memset(&PicoCpuFS68k, 0, sizeof(PicoCpuFS68k)); fm68k_init(); PicoCpuFS68k.iack_handler = SekIntAckFS68k; + PicoCpuFS68k.sr = 0x2704; // Z flag g_m68kcontext = oldcontext; } #endif @@ -161,6 +174,14 @@ PICO_INTERNAL int SekInterruptS68k(int irq) irqs = Pico_mcd->m.s68k_pend_ints >> 1; while ((irqs >>= 1)) real_irq++; +#ifdef EMU_CORE_DEBUG + { + extern int dbg_irq_level_sub; + dbg_irq_level_sub=real_irq; + elprintf(EL_ANOMALY, "s68k irq %i", real_irq); + return 0; + } +#endif #ifdef EMU_C68K PicoCpuCS68k.irq=real_irq; #endif diff --git a/cpu/fame/famec.c b/cpu/fame/famec.c index 2549147..041413f 100644 --- a/cpu/fame/famec.c +++ b/cpu/fame/famec.c @@ -28,6 +28,7 @@ #define USE_CYCLONE_TIMING #define USE_CYCLONE_TIMING_DIV +#define PICODRIVE_HACK // Options // @@ -521,6 +522,10 @@ static u32 flag_I; static u32 initialised = 0; +#ifdef PICODRIVE_HACK +extern M68K_CONTEXT PicoCpuFS68k; +#endif + /* Custom function handler */ typedef void (*opcode_func)(void); @@ -793,6 +798,9 @@ int fm68k_emulate(s32 cycles) // won't emulate double fault // if (m68kcontext.execinfo & M68K_FAULTED) return -1; + // Cache PPL + flag_I = M68K_PPL; + if (m68kcontext.execinfo & FM68K_HALTED) { if (interrupt_chk__() <= 0) @@ -812,9 +820,6 @@ int fm68k_emulate(s32 cycles) // Cache SR SET_SR(m68kcontext.sr) - // Cache PPL - flag_I = M68K_PPL; - // Fijar PC SET_PC(m68kcontext.pc) @@ -943,8 +948,6 @@ init_jump_table: #endif u32 i, j; - m68kcontext.sr = 0x2704; // Z flag - for(i = 0x0000; i <= 0xFFFF; i += 0x0001) JumpTable[0x0000 + i] = CAST_OP(0x4AFC); for(i = 0x0000; i <= 0x0007; i += 0x0001) diff --git a/cpu/fame/famec_opcodes.h b/cpu/fame/famec_opcodes.h index 8586603..03a64de 100644 --- a/cpu/fame/famec_opcodes.h +++ b/cpu/fame/famec_opcodes.h @@ -18292,8 +18292,19 @@ OPCODE(0x4AD0) flag_V = 0; flag_NotZ = res; flag_N = res; +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(18) +#else RET(8) +#endif } // TAS @@ -18310,8 +18321,20 @@ OPCODE(0x4AD8) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(18) +#else RET(8) +#endif } // TAS @@ -18328,8 +18351,20 @@ OPCODE(0x4AE0) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(20) +#else RET(10) +#endif } // TAS @@ -18346,8 +18381,20 @@ OPCODE(0x4AE8) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(22) +#else RET(12) +#endif } // TAS @@ -18364,8 +18411,20 @@ OPCODE(0x4AF0) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(24) +#else RET(14) +#endif } // TAS @@ -18381,8 +18440,20 @@ OPCODE(0x4AF8) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(22) +#else RET(12) +#endif } // TAS @@ -18398,8 +18469,20 @@ OPCODE(0x4AF9) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(26) +#else RET(16) +#endif } // TAS @@ -18416,8 +18499,20 @@ OPCODE(0x4ADF) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO +#ifdef USE_CYCLONE_TIMING +RET(18) +#else RET(8) +#endif } // TAS @@ -18434,8 +18529,20 @@ OPCODE(0x4AE7) flag_V = 0; flag_NotZ = res; flag_N = res; + +#ifdef PICODRIVE_HACK + if (g_m68kcontext == &PicoCpuFS68k) { + res |= 0x80; + WRITE_BYTE_F(adr, res); + } +#endif + POST_IO -RET(10) +#ifdef USE_CYCLONE_TIMING +RET(20) +#else +RET(8) +#endif } // ILLEGAL diff --git a/cpu/musashi/m68kcpu.h b/cpu/musashi/m68kcpu.h index 39ceb53..eb7a513 100644 --- a/cpu/musashi/m68kcpu.h +++ b/cpu/musashi/m68kcpu.h @@ -2011,7 +2011,8 @@ void m68ki_exception_interrupt(uint int_level) FLAG_INT_MASK = int_level<<8; /* Get the new PC */ - new_pc = m68ki_read_data_32((vector<<2) + REG_VBR); + //new_pc = m68ki_read_data_32((vector<<2) + REG_VBR); + new_pc = m68k_read_immediate_32((vector<<2) + REG_VBR); // notaz hack /* If vector is uninitialized, call the uninitialized interrupt vector */ if(new_pc == 0) -- 2.39.2