#if 0\r
static const char* copyright_notice =\r
"MUSASHI\n"\r
-"Version 3.3 (2001-01-29)\n"\r
+"Version 3.31 (2007-07-09)\n"\r
"A portable Motorola M680x0 processor emulation engine.\n"\r
-"Copyright 1998-2001 Karl Stenerud. All rights reserved.\n"\r
+"Copyright 1998-2007 Karl Stenerud. All rights reserved.\n"\r
"\n"\r
"This code may be freely used for non-commercial purpooses as long as this\n"\r
"copyright notice remains unaltered in the source code and any binary files\n"\r
/* ================================ INCLUDES ============================== */\r
/* ======================================================================== */\r
\r
+extern void m68040_fpu_op0(void);\r
+extern void m68040_fpu_op1(void);\r
+\r
#include "m68kops.h"\r
#include "m68kcpu.h"\r
+//#include "m68kfpu.c"\r
\r
/* ======================================================================== */\r
/* ================================= DATA ================================= */\r
/* ======================================================================== */\r
\r
int m68ki_initial_cycles;\r
-int m68ki_remaining_cycles = 0; /* Number of clocks remaining */\r
+//int m68ki_remaining_cycles = 0; /* Number of clocks remaining */\r
uint m68ki_tracing = 0;\r
uint m68ki_address_space;\r
\r
#endif /* M68K_LOG_ENABLE */\r
\r
/* The CPU core */\r
-// m68ki_cpu_core m68ki_cpu = {0};\r
+// notaz\r
m68ki_cpu_core *m68ki_cpu_p = NULL;\r
+//m68ki_cpu_core m68ki_cpu = {0};\r
\r
\r
#if M68K_EMULATE_ADDRESS_ERROR\r
{\r
}\r
\r
+/* Called when a tas instruction is executed */\r
+static int default_tas_instr_callback(void)\r
+{\r
+ return 1; // allow writeback\r
+}\r
+\r
/* Called when the program counter changed by a large value */\r
static unsigned int default_pc_changed_callback_data;\r
static void default_pc_changed_callback(unsigned int new_pc)\r
CALLBACK_RTE_INSTR = callback ? callback : default_rte_instr_callback;\r
}\r
\r
+void m68k_set_tas_instr_callback(int (*callback)(void))\r
+{\r
+ CALLBACK_TAS_INSTR = callback ? callback : default_tas_instr_callback;\r
+}\r
+\r
void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc))\r
{\r
CALLBACK_PC_CHANGED = callback ? callback : default_pc_changed_callback;\r
/* Make sure we're not stopped */\r
if(!CPU_STOPPED)\r
{\r
+ // notaz\r
+ m68ki_check_interrupts();\r
+\r
/* Set our pool of clock cycles available */\r
SET_CYCLES(num_cycles);\r
m68ki_initial_cycles = num_cycles;\r
m68ki_set_address_error_trap(); /* auto-disable (see m68kcpu.h) */\r
\r
/* Main loop. Keep going until we run out of clock cycles */\r
- while(GET_CYCLES() > 0)\r
+ // notaz\r
+ m68ki_trace_t1();\r
+\r
+ while(GET_CYCLES() >= 0)\r
+// do\r
{\r
/* Set tracing accodring to T1. (T0 is done inside instruction) */\r
- m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */\r
+ //m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */\r
\r
/* Set the address space for reads */\r
m68ki_use_data_space(); /* auto-disable (see m68kcpu.h) */\r
/* Read an instruction and call its handler */\r
REG_IR = m68ki_read_imm_16();\r
m68ki_instruction_jump_table[REG_IR]();\r
- USE_CYCLES(CYC_INSTRUCTION[REG_IR]);\r
+ USE_CYCLES(CYC_INSTRUCTION[REG_IR]); // moving this up may cause a deadlock\r
\r
/* Trace m68k_exception, if necessary */\r
m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */\r
- }\r
+\r
+ m68ki_trace_t1(); /* notaz */\r
+\r
+ m68ki_cpu_p->not_polling = 1;\r
+ } // while(GET_CYCLES() > 0); // notaz\r
\r
/* set previous PC to current PC for the next entry into the loop */\r
REG_PPC = REG_PC;\r
m68k_set_reset_instr_callback(NULL);\r
m68k_set_cmpild_instr_callback(NULL);\r
m68k_set_rte_instr_callback(NULL);\r
+ m68k_set_tas_instr_callback(NULL);\r
m68k_set_pc_changed_callback(NULL);\r
m68k_set_fc_callback(NULL);\r
m68k_set_instr_hook_callback(NULL);\r
return sizeof(m68ki_cpu_core);\r
}\r
\r
-/*\r
unsigned int m68k_get_context(void* dst)\r
{\r
if(dst) *(m68ki_cpu_core*)dst = m68ki_cpu;\r
return sizeof(m68ki_cpu_core);\r
}\r
-*/\r
\r
void m68k_set_context(void* src)\r
{\r
+ // notaz\r
if(src) m68ki_cpu_p = src;\r
+// if(src) m68ki_cpu = *(m68ki_cpu_core*)src;\r
}\r
\r
\r
\r
#if M68K_COMPILE_FOR_MAME == OPT_ON\r
\r
-#include "state.h"\r
-\r
static struct {\r
UINT16 sr;\r
UINT8 stopped;\r