From 3335750a7df62a52857348365e9dbbf6f23a0d29 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 5 Aug 2007 19:37:36 +0000 Subject: [PATCH] PicoDrive hacks git-svn-id: file:///home/notaz/opt/svn/PicoDrive@216 be3aeb3a-fb24-0410-a615-afba39da0efa --- cpu/musashi/Makefile | 4 ++++ cpu/musashi/m68k_in.c | 11 +++++++---- cpu/musashi/m68kconf.h | 2 +- cpu/musashi/m68kcpu.c | 11 +++++++++-- cpu/musashi/m68kcpu.h | 3 ++- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/cpu/musashi/Makefile b/cpu/musashi/Makefile index ceecc97..10ec952 100644 --- a/cpu/musashi/Makefile +++ b/cpu/musashi/Makefile @@ -1,6 +1,10 @@ m68kops.c : m68kmake ./$< +m68kmake : m68kmake.c m68k_in.c + $(CC) -o $@ $< + + clean: $(RM) m68kops.c m68kops.h m68kmake *.o diff --git a/cpu/musashi/m68k_in.c b/cpu/musashi/m68k_in.c index 9379643..d0ec8a1 100644 --- a/cpu/musashi/m68k_in.c +++ b/cpu/musashi/m68k_in.c @@ -1262,8 +1262,9 @@ M68KMAKE_OP(adda, 32, ., a) M68KMAKE_OP(adda, 32, ., .) { uint* r_dst = &AX; + uint src = M68KMAKE_GET_OPER_AY_32; // notaz - *r_dst = MASK_OUT_ABOVE_32(*r_dst + M68KMAKE_GET_OPER_AY_32); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } @@ -7132,8 +7133,9 @@ M68KMAKE_OP(movem, 32, re, pd) if(register_list & (1 << i)) { ea -= 4; - m68ki_write_16(ea+2, REG_DA[15-i] & 0xFFFF ); - m68ki_write_16(ea, (REG_DA[15-i] >> 16) & 0xFFFF ); + m68ki_write_16(ea, REG_DA[15-i] ); // notaz Cyclone hack + //m68ki_write_16(ea+2, REG_DA[15-i] & 0xFFFF ); + //m68ki_write_16(ea, (REG_DA[15-i] >> 16) & 0xFFFF ); count++; } AY = ea; @@ -9785,8 +9787,9 @@ M68KMAKE_OP(suba, 32, ., a) M68KMAKE_OP(suba, 32, ., .) { uint* r_dst = &AX; + uint src = M68KMAKE_GET_OPER_AY_32; // notaz - *r_dst = MASK_OUT_ABOVE_32(*r_dst - M68KMAKE_GET_OPER_AY_32); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } diff --git a/cpu/musashi/m68kconf.h b/cpu/musashi/m68kconf.h index 53e940f..0079871 100644 --- a/cpu/musashi/m68kconf.h +++ b/cpu/musashi/m68kconf.h @@ -102,7 +102,7 @@ /* If ON, the CPU will monitor the trace flags and take trace exceptions */ -#define M68K_EMULATE_TRACE OPT_OFF +#define M68K_EMULATE_TRACE OPT_ON /* If ON, CPU will call the output reset callback when it encounters a reset diff --git a/cpu/musashi/m68kcpu.c b/cpu/musashi/m68kcpu.c index c3f9fb8..7564c11 100644 --- a/cpu/musashi/m68kcpu.c +++ b/cpu/musashi/m68kcpu.c @@ -790,6 +790,9 @@ int m68k_execute(int num_cycles) /* Make sure we're not stopped */ if(!CPU_STOPPED) { + // notaz + m68ki_check_interrupts(); + /* Set our pool of clock cycles available */ SET_CYCLES(num_cycles); m68ki_initial_cycles = num_cycles; @@ -803,11 +806,13 @@ int m68k_execute(int num_cycles) /* Main loop. Keep going until we run out of clock cycles */ // notaz + m68ki_trace_t1(); + while(GET_CYCLES() >= 0) // do { /* Set tracing accodring to T1. (T0 is done inside instruction) */ - m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */ + //m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */ /* Set the address space for reads */ m68ki_use_data_space(); /* auto-disable (see m68kcpu.h) */ @@ -820,11 +825,13 @@ int m68k_execute(int num_cycles) /* Read an instruction and call its handler */ REG_IR = m68ki_read_imm_16(); + USE_CYCLES(CYC_INSTRUCTION[REG_IR]); // notaz m68ki_instruction_jump_table[REG_IR](); - USE_CYCLES(CYC_INSTRUCTION[REG_IR]); /* Trace m68k_exception, if necessary */ m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ + + m68ki_trace_t1(); /* notaz */ } // while(GET_CYCLES() > 0); // notaz /* set previous PC to current PC for the next entry into the loop */ diff --git a/cpu/musashi/m68kcpu.h b/cpu/musashi/m68kcpu.h index 350c975..50aa6ce 100644 --- a/cpu/musashi/m68kcpu.h +++ b/cpu/musashi/m68kcpu.h @@ -1534,7 +1534,8 @@ INLINE void m68ki_set_sr_noint_nosp(uint value) INLINE void m68ki_set_sr(uint value) { m68ki_set_sr_noint(value); - m68ki_check_interrupts(); + if (GET_CYCLES() >= 0) // notaz + m68ki_check_interrupts(); } -- 2.39.2