mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
68k, synchronize timing in fame and musashi (for debugging)
This commit is contained in:
parent
b26071be31
commit
5e04c2f37f
6 changed files with 15 additions and 9 deletions
|
@ -19318,6 +19318,7 @@ OPCODE(0x4E73)
|
||||||
AREG(7) = ASP;
|
AREG(7) = ASP;
|
||||||
ASP = res;
|
ASP = res;
|
||||||
}
|
}
|
||||||
|
CHECK_BRANCH_EXCEPTION(res)
|
||||||
POST_IO
|
POST_IO
|
||||||
ctx->execinfo &= ~(FM68K_EMULATE_GROUP_0|FM68K_EMULATE_TRACE|FM68K_DO_TRACE);
|
ctx->execinfo &= ~(FM68K_EMULATE_GROUP_0|FM68K_EMULATE_TRACE|FM68K_DO_TRACE);
|
||||||
CHECK_INT_TO_JUMP(20)
|
CHECK_INT_TO_JUMP(20)
|
||||||
|
|
|
@ -389,7 +389,7 @@ addi 32 . . 0000011010...... A+-DXWL... U U U U 20 20 4 4
|
||||||
addq 8 . d 0101...000000... .......... U U U U 4 4 2 2
|
addq 8 . d 0101...000000... .......... U U U U 4 4 2 2
|
||||||
addq 8 . . 0101...000...... A+-DXWL... U U U U 8 8 4 4
|
addq 8 . . 0101...000...... A+-DXWL... U U U U 8 8 4 4
|
||||||
addq 16 . d 0101...001000... .......... U U U U 4 4 2 2
|
addq 16 . d 0101...001000... .......... U U U U 4 4 2 2
|
||||||
addq 16 . a 0101...001001... .......... U U U U 4 4 2 2
|
addq 16 . a 0101...001001... .......... U U U U 8 8 2 2
|
||||||
addq 16 . . 0101...001...... A+-DXWL... U U U U 8 8 4 4
|
addq 16 . . 0101...001...... A+-DXWL... U U U U 8 8 4 4
|
||||||
addq 32 . d 0101...010000... .......... U U U U 8 8 2 2
|
addq 32 . d 0101...010000... .......... U U U U 8 8 2 2
|
||||||
addq 32 . a 0101...010001... .......... U U U U 8 8 2 2
|
addq 32 . a 0101...010001... .......... U U U U 8 8 2 2
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern void m68040_fpu_op1(void);
|
||||||
/* ================================= DATA ================================= */
|
/* ================================= DATA ================================= */
|
||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
|
||||||
int m68ki_initial_cycles;
|
//int m68ki_initial_cycles;
|
||||||
//int m68ki_remaining_cycles = 0; /* Number of clocks remaining */
|
//int m68ki_remaining_cycles = 0; /* Number of clocks remaining */
|
||||||
uint m68ki_tracing = 0;
|
uint m68ki_tracing = 0;
|
||||||
uint m68ki_address_space;
|
uint m68ki_address_space;
|
||||||
|
@ -828,6 +828,10 @@ int m68k_execute(int num_cycles)
|
||||||
m68ki_instruction_jump_table[REG_IR]();
|
m68ki_instruction_jump_table[REG_IR]();
|
||||||
USE_CYCLES(CYC_INSTRUCTION[REG_IR]); // moving this up may cause a deadlock
|
USE_CYCLES(CYC_INSTRUCTION[REG_IR]); // moving this up may cause a deadlock
|
||||||
|
|
||||||
|
/* ASG: update cycles */
|
||||||
|
USE_CYCLES(CPU_INT_CYCLES);
|
||||||
|
CPU_INT_CYCLES = 0;
|
||||||
|
|
||||||
/* Trace m68k_exception, if necessary */
|
/* Trace m68k_exception, if necessary */
|
||||||
m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */
|
m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */
|
||||||
|
|
||||||
|
@ -839,10 +843,6 @@ int m68k_execute(int num_cycles)
|
||||||
/* set previous PC to current PC for the next entry into the loop */
|
/* set previous PC to current PC for the next entry into the loop */
|
||||||
REG_PPC = REG_PC;
|
REG_PPC = REG_PC;
|
||||||
|
|
||||||
/* ASG: update cycles */
|
|
||||||
USE_CYCLES(CPU_INT_CYCLES);
|
|
||||||
CPU_INT_CYCLES = 0;
|
|
||||||
|
|
||||||
/* return how many clocks we used */
|
/* return how many clocks we used */
|
||||||
return m68ki_initial_cycles - GET_CYCLES();
|
return m68ki_initial_cycles - GET_CYCLES();
|
||||||
}
|
}
|
||||||
|
|
|
@ -916,6 +916,7 @@ typedef struct
|
||||||
void (*instr_hook_callback)(void); /* Called every instruction cycle prior to execution */
|
void (*instr_hook_callback)(void); /* Called every instruction cycle prior to execution */
|
||||||
|
|
||||||
// notaz
|
// notaz
|
||||||
|
sint cyc_initial_cycles;
|
||||||
sint cyc_remaining_cycles;
|
sint cyc_remaining_cycles;
|
||||||
sint not_polling;
|
sint not_polling;
|
||||||
} m68ki_cpu_core;
|
} m68ki_cpu_core;
|
||||||
|
@ -923,6 +924,7 @@ typedef struct
|
||||||
// notaz
|
// notaz
|
||||||
extern m68ki_cpu_core *m68ki_cpu_p;
|
extern m68ki_cpu_core *m68ki_cpu_p;
|
||||||
#define m68ki_cpu (*m68ki_cpu_p)
|
#define m68ki_cpu (*m68ki_cpu_p)
|
||||||
|
#define m68ki_initial_cycles m68ki_cpu_p->cyc_initial_cycles
|
||||||
#define m68ki_remaining_cycles m68ki_cpu_p->cyc_remaining_cycles
|
#define m68ki_remaining_cycles m68ki_cpu_p->cyc_remaining_cycles
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -641,6 +641,9 @@ int get_oper_cycles(opcode_struct* op, int ea_mode, int cpu_type)
|
||||||
strcmp(op->name, "suba") == 0))
|
strcmp(op->name, "suba") == 0))
|
||||||
return op->cycles[cpu_type] + g_ea_cycle_table[ea_mode][cpu_type][size] + 2;
|
return op->cycles[cpu_type] + g_ea_cycle_table[ea_mode][cpu_type][size] + 2;
|
||||||
|
|
||||||
|
if(cpu_type == CPU_TYPE_000 && ea_mode == EA_MODE_I && op->size == 8 && strcmp(op->name, "btst") == 0)
|
||||||
|
return op->cycles[cpu_type] + g_ea_cycle_table[ea_mode][cpu_type][size] + 2;
|
||||||
|
|
||||||
if(strcmp(op->name, "jmp") == 0)
|
if(strcmp(op->name, "jmp") == 0)
|
||||||
return op->cycles[cpu_type] + g_jmp_cycle_table[ea_mode];
|
return op->cycles[cpu_type] + g_jmp_cycle_table[ea_mode];
|
||||||
if(strcmp(op->name, "jsr") == 0)
|
if(strcmp(op->name, "jsr") == 0)
|
||||||
|
|
|
@ -102,16 +102,16 @@ extern m68ki_cpu_core PicoCpuMM68k, PicoCpuMS68k;
|
||||||
#define SekSr m68k_get_reg(&PicoCpuMM68k, M68K_REG_SR)
|
#define SekSr m68k_get_reg(&PicoCpuMM68k, M68K_REG_SR)
|
||||||
#define SekSrS68k m68k_get_reg(&PicoCpuMS68k, M68K_REG_SR)
|
#define SekSrS68k m68k_get_reg(&PicoCpuMS68k, M68K_REG_SR)
|
||||||
#define SekSetStop(x) { \
|
#define SekSetStop(x) { \
|
||||||
if(x) { SET_CYCLES(0); PicoCpuMM68k.stopped=STOP_LEVEL_STOP; } \
|
if(x) { PicoCpuMM68k.cyc_remaining_cycles = 0; PicoCpuMM68k.stopped=STOP_LEVEL_STOP; } \
|
||||||
else PicoCpuMM68k.stopped=0; \
|
else PicoCpuMM68k.stopped=0; \
|
||||||
}
|
}
|
||||||
#define SekSetStopS68k(x) { \
|
#define SekSetStopS68k(x) { \
|
||||||
if(x) { SET_CYCLES(0); PicoCpuMS68k.stopped=STOP_LEVEL_STOP; } \
|
if(x) { PicoCpuMS68k.cyc_remaining_cycles = 0; PicoCpuMS68k.stopped=STOP_LEVEL_STOP; } \
|
||||||
else PicoCpuMS68k.stopped=0; \
|
else PicoCpuMS68k.stopped=0; \
|
||||||
}
|
}
|
||||||
#define SekIsStoppedM68k() (PicoCpuMM68k.stopped==STOP_LEVEL_STOP)
|
#define SekIsStoppedM68k() (PicoCpuMM68k.stopped==STOP_LEVEL_STOP)
|
||||||
#define SekIsStoppedS68k() (PicoCpuMS68k.stopped==STOP_LEVEL_STOP)
|
#define SekIsStoppedS68k() (PicoCpuMS68k.stopped==STOP_LEVEL_STOP)
|
||||||
#define SekShouldInterrupt() (CPU_INT_LEVEL > FLAG_INT_MASK)
|
#define SekShouldInterrupt() (PicoCpuMM68k.int_level > PicoCpuMM68k.int_mask)
|
||||||
|
|
||||||
#define SekNotPolling PicoCpuMM68k.not_polling
|
#define SekNotPolling PicoCpuMM68k.not_polling
|
||||||
#define SekNotPollingS68k PicoCpuMS68k.not_polling
|
#define SekNotPollingS68k PicoCpuMS68k.not_polling
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue