Processed m68k

This commit is contained in:
SergioMartin86 2024-03-30 11:01:03 +01:00
parent 62ad660ee7
commit df8e3991a6
7 changed files with 43 additions and 21 deletions

View File

@ -38,6 +38,7 @@
#include <string.h>
#include "../genesis.h"
#include "../state.h"
#include "../m68k/m68k.h"
/* IFSTAT register bitmasks */

View File

@ -38,6 +38,7 @@
#include <string.h>
#include "../genesis.h"
#include "../state.h"
#include "../m68k/m68k.h"
/***************************************************************/

View File

@ -260,10 +260,6 @@ typedef struct
void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */
} m68ki_cpu_core;
/* CPU cores */
extern m68ki_cpu_core m68k;
extern m68ki_cpu_core s68k;
/* ======================================================================== */
/* ============================== CALLBACKS =============================== */

View File

@ -2,6 +2,8 @@
/* MAIN 68K CORE */
/* ======================================================================== */
#include "../state.h"
extern int vdp_68k_irq_ack(int int_level);
#define m68ki_cpu m68k
@ -18,6 +20,7 @@ extern int vdp_68k_irq_ack(int int_level);
#include "m68kconf.h"
#include "m68kcpu.h"
#include "m68kops.h"
#include "../state.h"
/* ======================================================================== */
/* ================================= DATA ================================= */
@ -27,11 +30,6 @@ extern int vdp_68k_irq_ack(int int_level);
unsigned char m68ki_cycles[0x10000];
#endif
static int irq_latency;
m68ki_cpu_core m68k;
/* ======================================================================== */
/* =============================== CALLBACKS ============================== */
/* ======================================================================== */
@ -222,7 +220,7 @@ void m68k_set_irq(unsigned int int_level)
void m68k_set_irq_delay(unsigned int int_level)
{
/* Prevent reentrance */
if (!irq_latency)
if (!m68k_irq_latency)
{
/* This is always triggered from MOVE instructions (VDP CTRL port write) */
/* We just make sure this is not a MOVE.L instruction as we could be in */
@ -233,13 +231,13 @@ void m68k_set_irq_delay(unsigned int int_level)
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
/* One instruction delay before interrupt */
irq_latency = 1;
m68k_irq_latency = 1;
m68ki_trace_t1() /* auto-disable (see m68kcpu.h) */
m68ki_use_data_space() /* auto-disable (see m68kcpu.h) */
REG_IR = m68ki_read_imm_16();
m68ki_instruction_jump_table[REG_IR]();
m68ki_exception_if_trace() /* auto-disable (see m68kcpu.h) */
irq_latency = 0;
m68k_irq_latency = 0;
}
/* Set IRQ level */
@ -367,7 +365,7 @@ void m68k_pulse_reset(void)
/* Interrupt mask to level 7 */
FLAG_INT_MASK = 0x0700;
CPU_INT_LEVEL = 0;
irq_latency = 0;
m68k_irq_latency = 0;
/* Go to supervisor mode */
m68ki_set_s_flag(SFLAG_SET);

View File

@ -2,6 +2,8 @@
/* SUB 68K CORE */
/* ======================================================================== */
#include "../state.h"
extern int scd_68k_irq_ack(int level);
#define m68ki_cpu s68k
@ -26,7 +28,6 @@ extern int scd_68k_irq_ack(int level);
#ifdef BUILD_TABLES
static unsigned char s68ki_cycles[0x10000];
#endif
static int irq_latency;
/* IRQ priority */
static const uint8_t irq_level[0x40] =
@ -41,8 +42,6 @@ static const uint8_t irq_level[0x40] =
6, 6, 6, 6, 6, 6, 6, 6
};
m68ki_cpu_core s68k;
/* ======================================================================== */
/* =============================== CALLBACKS ============================== */
@ -321,7 +320,7 @@ void s68k_pulse_reset(void)
/* Interrupt mask to level 7 */
FLAG_INT_MASK = 0x0700;
CPU_INT_LEVEL = 0;
irq_latency = 0;
s68k_irq_latency = 0;
/* Go to supervisor mode */
m68ki_set_s_flag(SFLAG_SET);

View File

@ -67,14 +67,27 @@ struct sportspad_t sportspad[2];
struct teamplayer_t teamplayer[2];
// input terebi_oekaki.c
// input_hw/terebi_oekaki.c
struct tablet_t tablet;
// input xe_1ap.c
// input_hw/xe_1ap.c
struct xe_1ap_t xe_1ap[2];
// m68k/m68k.c
m68ki_cpu_core m68k;
m68ki_cpu_core s68k;
// m68k/m68kcpu.c
int m68k_irq_latency;
// m68k/s68kcpu.c
int s68k_irq_latency;
// genesis.c
uint8_t boot_rom[0x800];

View File

@ -19,6 +19,7 @@
#include "input_hw/teamplayer.h"
#include "input_hw/terebi_oekaki.h"
#include "input_hw/xe_1ap.h"
#include "m68k/m68k.h"
#include "sound/eq.h"
#include "genesis.h"
#include "io_ctrl.h"
@ -101,14 +102,27 @@ extern struct sportspad_t sportspad[2];
extern struct teamplayer_t teamplayer[2];
// input terebi_oekaki.h
// input_hw/terebi_oekaki.h
extern struct tablet_t tablet;
// input xe_1ap.c
// input_hw/xe_1ap.c
extern struct xe_1ap_t xe_1ap[2];
// m68k/m68k.h
extern m68ki_cpu_core m68k;
extern m68ki_cpu_core s68k;
// m68k/m68kcpu.c
extern int m68k_irq_latency;
// m68k/s68kcpu.c
extern int s68k_irq_latency;
// genesis.h
extern uint8_t boot_rom[0x800];