mirror of
https://github.com/libretro/FBNeo.git
synced 2025-03-03 15:48:30 +00:00
wip
This commit is contained in:
parent
fef32c8395
commit
4963b339bb
@ -913,6 +913,8 @@ void I8039Exit()
|
||||
DebugCPU_I8039Initted = 0;
|
||||
}
|
||||
|
||||
static int end_run = 0;
|
||||
|
||||
int I8039Run(int cycles)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
@ -925,6 +927,7 @@ int I8039Run(int cycles)
|
||||
i8039_ICount_cycles = cycles;
|
||||
i8039_ICount = (cycles - R.irq_extra_cycles);
|
||||
R.irq_extra_cycles = 0;
|
||||
end_run = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@ -973,7 +976,7 @@ int I8039Run(int cycles)
|
||||
i8039_ICount -= count;
|
||||
}
|
||||
|
||||
} while (i8039_ICount>0);
|
||||
} while (i8039_ICount>0 && !end_run);
|
||||
|
||||
i8039_ICount -= R.irq_extra_cycles;
|
||||
R.total_cycles += cycles - i8039_ICount;
|
||||
@ -990,6 +993,13 @@ INT32 I8039TotalCycles()
|
||||
return (INT32)R.total_cycles + (i8039_ICount_cycles - i8039_ICount);
|
||||
}
|
||||
|
||||
INT32 I8039Idle(INT32 cycles)
|
||||
{
|
||||
R.total_cycles += cycles;
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
void I8039NewFrame()
|
||||
{
|
||||
i8039_ICount_cycles = 0;
|
||||
|
@ -54,6 +54,7 @@ extern void I8039Open(INT32 nCpu);
|
||||
extern void I8039Close();
|
||||
extern INT32 I8039GetActive();
|
||||
extern INT32 I8039TotalCycles();
|
||||
extern INT32 I8039Idle(INT32 cycles);
|
||||
extern void I8039NewFrame();
|
||||
|
||||
extern void N7751Init(INT32 nCpu);
|
||||
@ -73,7 +74,7 @@ extern void N7751Init(INT32 nCpu);
|
||||
#define N7751GetActive I8039GetActive
|
||||
#define N7751TotalCycles I8039TotalCycles
|
||||
#define N7751NewFrame I8039NewFrame
|
||||
|
||||
#define N7751Idle I8039Idle
|
||||
|
||||
extern void I8035Init(INT32 nCpu);
|
||||
#define I8035Run I8039Run
|
||||
@ -92,6 +93,7 @@ extern void I8035Init(INT32 nCpu);
|
||||
#define I8035GetActive I8039GetActive
|
||||
#define I8035TotalCycles I8039TotalCycles
|
||||
#define I8035NewFrame I8039NewFrame
|
||||
#define I8035Idle I8039Idle
|
||||
|
||||
/*
|
||||
* Input a UINT8 from given I/O port
|
||||
|
@ -318,12 +318,15 @@ struct _mcs51_state_t
|
||||
UINT8 irq_prio[8]; /* interrupt priority */
|
||||
|
||||
int icount;
|
||||
int cycle_start;
|
||||
int end_run;
|
||||
|
||||
mcs51_uart uart; /* internal uart */
|
||||
|
||||
/* Internal Ram */
|
||||
UINT8 internal_ram[0xff+1]; /* 128 RAM (8031/51) + 128 RAM in second bank (8032/52) */
|
||||
UINT8 sfr_ram[0xff]; /* 128 SFR - these are in 0x80 - 0xFF */
|
||||
INT32 total_cycles;
|
||||
|
||||
/* DS5002FP */
|
||||
struct {
|
||||
@ -1973,6 +1976,9 @@ INT32 mcs51Run(int cycles) // divide cycles by 12! -dink
|
||||
UINT8 op;
|
||||
|
||||
mcs51_state.icount = cycles;
|
||||
mcs51_state.cycle_start = cycles;
|
||||
mcs51_state.end_run = 0;
|
||||
|
||||
/* external interrupts may have been set since we last checked */
|
||||
mcs51_state.inst_cycles = 0;
|
||||
check_irqs();
|
||||
@ -2026,14 +2032,35 @@ INT32 mcs51Run(int cycles) // divide cycles by 12! -dink
|
||||
if ((mcs51_state.features & FEATURE_CMOS) && GET_IDL)
|
||||
return 0;
|
||||
|
||||
} while( mcs51_state.icount > 0 );
|
||||
} while( mcs51_state.icount > 0 && !mcs51_state.end_run );
|
||||
|
||||
return cycles - mcs51_state.icount;
|
||||
cycles = cycles - mcs51_state.icount;
|
||||
mcs51_state.cycle_start = mcs51_state.icount = 0;
|
||||
mcs51_state.total_cycles += cycles;
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
INT32 mcs51Idle(INT32 cycles)
|
||||
{
|
||||
mcs51_state.total_cycles += cycles;
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
INT32 mcs51TotalCycles()
|
||||
{
|
||||
return mcs51_state.total_cycles + (mcs51_state.cycle_start - mcs51_state.icount);
|
||||
}
|
||||
|
||||
void mcs51NewFrame()
|
||||
{
|
||||
mcs51_state.total_cycles = 0;
|
||||
}
|
||||
|
||||
void mcs51RunEnd(void)
|
||||
{
|
||||
mcs51_state.icount = 0;
|
||||
mcs51_state.end_run = 1;
|
||||
}
|
||||
|
||||
void mcs51_scan(INT32 nAction)
|
||||
|
@ -88,12 +88,16 @@ struct _ds5002fp_config
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
extern void mcs51_init(void); /* Initialize cpu */
|
||||
extern void mcs51_reset(void); /* Reset registers to the initial values */
|
||||
extern void mcs51_exit(void); /* Shut down CPU core */
|
||||
extern void mcs51_init(void); /* Initialize cpu */
|
||||
extern void mcs51_reset(void); /* Reset registers to the initial values */
|
||||
extern void mcs51_exit(void); /* Shut down CPU core */
|
||||
extern INT32 mcs51Run(int cycles); /* /12 ! Execute cycles - returns number of cycles actually run */
|
||||
extern void mcs51RunEnd(void); /* stop execution */
|
||||
extern void mcs51_set_irq_line(int irqline, int state);
|
||||
extern void mcs51RunEnd(void); /* stop execution */
|
||||
extern INT32 mcs51TotalCycles();
|
||||
extern void mcs51NewFrame();
|
||||
extern INT32 mcs51Idle(INT32 cycles);
|
||||
|
||||
extern void mcs51_set_irq_line(int irqline, int state);
|
||||
void mcs51_iram_fill(UINT8 *src, UINT32 size);
|
||||
void mcs51_iram_get(UINT8 *dst, UINT32 size);
|
||||
void mcs51_set_write_handler(void (*pointer)(INT32,UINT8));
|
||||
@ -106,6 +110,9 @@ extern void ds5002fp_init(UINT8 mcon, UINT8 rpctl, UINT8 crc); // default: 0, 0,
|
||||
#define ds5002fp_exit mcs51_exit
|
||||
#define ds5002fpRun mcs51Run
|
||||
#define ds5002fpRunEnd mcs51RunEnd
|
||||
#define ds5002fpTotalCycles mcs51TotalCycles
|
||||
#define ds5002fpNewFrame mcs51NewFrame
|
||||
#define ds5002fpIdle mcs51Idle
|
||||
#define ds5002fp_set_irq_line mcs51_set_irq_line
|
||||
#define ds5002fp_set_write_handler mcs51_set_write_handler
|
||||
#define ds5002fp_set_read_handler mcs51_set_read_handler
|
||||
|
@ -148,12 +148,15 @@ typedef struct {
|
||||
UINT8 p1;
|
||||
UINT8 p2;
|
||||
UINT8 p2_hs;
|
||||
INT32 total_cycles;
|
||||
|
||||
UINT8 *ram;
|
||||
INT32 (*irq_callback)(INT32 irqline);
|
||||
} I8X41;
|
||||
|
||||
int i8x41_ICount;
|
||||
int i8x41_ICount = 0;
|
||||
int i8x41_cycle_start = 0;
|
||||
int i8x41_end_run = 0;
|
||||
|
||||
static I8X41 i8x41;
|
||||
|
||||
@ -163,7 +166,7 @@ void i8x41_scan(INT32 nAction)
|
||||
struct BurnArea ba;
|
||||
memset(&ba, 0, sizeof(ba));
|
||||
ba.Data = &i8x41;
|
||||
ba.nLen = STRUCT_SIZE_HELPER(I8X41, p2_hs);
|
||||
ba.nLen = STRUCT_SIZE_HELPER(I8X41, total_cycles);
|
||||
ba.szName = "i8x41 Regs";
|
||||
BurnAcb(&ba);
|
||||
}
|
||||
@ -1428,7 +1431,9 @@ INT32 i8x41_run(INT32 cycles)
|
||||
{
|
||||
int inst_cycles, T1_level;
|
||||
|
||||
i8x41_cycle_start = cycles;
|
||||
i8x41_ICount = cycles;
|
||||
i8x41_end_run = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@ -2064,11 +2069,37 @@ INT32 i8x41_run(INT32 cycles)
|
||||
}
|
||||
|
||||
|
||||
} while( i8x41_ICount > 0 );
|
||||
} while( i8x41_ICount > 0 && !i8x41_end_run );
|
||||
|
||||
return cycles - i8x41_ICount;
|
||||
cycles = cycles - i8x41_ICount;
|
||||
i8x41_ICount = i8x41_cycle_start = 0;
|
||||
|
||||
i8x41.total_cycles += cycles;
|
||||
|
||||
return cycles; //xxxdinkx
|
||||
}
|
||||
|
||||
void i8x41RunEnd()
|
||||
{
|
||||
i8x41_end_run = 1;
|
||||
}
|
||||
|
||||
INT32 i8x41TotalCycles()
|
||||
{
|
||||
return i8x41.total_cycles + (i8x41_cycle_start - i8x41_ICount);
|
||||
}
|
||||
|
||||
void i8x41NewFrame()
|
||||
{
|
||||
i8x41.total_cycles = 0;
|
||||
}
|
||||
|
||||
INT32 i8x41Idle(INT32 cycles)
|
||||
{
|
||||
i8x41.total_cycles += cycles;
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get all registers in given buffer
|
||||
|
@ -97,6 +97,11 @@ void i8x41_init(int (*irqcallback)(int));
|
||||
void i8x41_reset();
|
||||
void i8x41_exit();
|
||||
INT32 i8x41_run(INT32 cycles);
|
||||
void i8x41RunEnd();
|
||||
INT32 i8x41TotalCycles();
|
||||
void i8x41NewFrame();
|
||||
INT32 i8x41Idle(INT32 cycles);
|
||||
|
||||
UINT8 i8x41_get_register(UINT32 reg);
|
||||
void i8x41_set_register(UINT32 reg, UINT8 data);
|
||||
void i8x41_scan(INT32 nAction);
|
||||
|
@ -394,11 +394,17 @@ INT32 upd96050Scan(INT32 /*nAction*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 total_cycles = 0;
|
||||
static INT32 cycle_start = 0;
|
||||
static INT32 end_run = 0;
|
||||
|
||||
INT32 upd96050Run(INT32 cycles)
|
||||
{
|
||||
UINT32 opcode;
|
||||
|
||||
cycle_start = cycles;
|
||||
m_icount = cycles;
|
||||
end_run = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@ -420,7 +426,33 @@ INT32 upd96050Run(INT32 cycles)
|
||||
|
||||
} while (m_icount > 0);
|
||||
|
||||
return cycles - m_icount;
|
||||
cycles = cycles - m_icount;
|
||||
m_icount = cycle_start = 0;
|
||||
total_cycles += cycles;
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
INT32 upd96050Idle(INT32 cycles)
|
||||
{
|
||||
total_cycles += cycles;
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
void upd96050RunEnd()
|
||||
{
|
||||
end_run = 1;
|
||||
}
|
||||
|
||||
INT32 upd96050TotalCycles()
|
||||
{
|
||||
return total_cycles + (cycle_start - m_icount);
|
||||
}
|
||||
|
||||
void upd96050NewFrame()
|
||||
{
|
||||
total_cycles = 0;
|
||||
}
|
||||
|
||||
UINT8 snesdsp_read(bool mode)
|
||||
|
@ -1,6 +1,11 @@
|
||||
void upd96050Init(INT32 type, UINT8 *opcode, UINT8 *data, UINT8 *ram, void (*p0_cb)(INT32), void (*p1_cb)(INT32));
|
||||
void upd96050Reset();
|
||||
void upd96050Init(INT32 type, UINT8 *opcode, UINT8 *data, UINT8 *ram, void (*p0_cb)(INT32), void (*p1_cb)(INT32));
|
||||
void upd96050Reset();
|
||||
INT32 upd96050Run(INT32 cycles);
|
||||
INT32 upd96050Idle(INT32 cycles);
|
||||
void upd96050RunEnd();
|
||||
INT32 upd96050TotalCycles();
|
||||
void upd96050NewFrame();
|
||||
|
||||
UINT8 snesdsp_read(bool mode);
|
||||
void snesdsp_write(bool mode, UINT8 data);
|
||||
void snesdsp_write(bool mode, UINT8 data);
|
||||
INT32 upd96050Scan(INT32 /*nAction*/);
|
||||
|
@ -2162,6 +2162,13 @@ again:
|
||||
return ret;
|
||||
}
|
||||
|
||||
INT32 z180_idle(INT32 cyc)
|
||||
{
|
||||
total_cycles += cyc;
|
||||
|
||||
return cyc;
|
||||
}
|
||||
|
||||
void z180_run_end()
|
||||
{
|
||||
end_run = 1;
|
||||
|
@ -160,6 +160,7 @@ void z180_init(int index, int clock, /*const void *config,*/ int (*irqcallback)(
|
||||
void z180_exit();
|
||||
void z180_reset(void);
|
||||
int z180_execute(int cycles);
|
||||
INT32 z180_idle(INT32 cyc);
|
||||
void z180_burn(int cycles);
|
||||
void z180_set_irq_line(int irqline, int state);
|
||||
void z180_write_iolines(UINT32 data);
|
||||
|
@ -24,13 +24,6 @@ static INT32 DebugCPU_Z180Initted = 0;
|
||||
#define PORT_RANGE (1 << PORT_ADDRESS_BITS)
|
||||
#define PORT_MASK (PORT_RANGE - 1)
|
||||
|
||||
static INT32 core_idle(INT32 cycles)
|
||||
{
|
||||
Z180BurnCycles(cycles);
|
||||
|
||||
return cycles;
|
||||
}
|
||||
|
||||
static void core_set_irq(INT32 cpu, INT32 line, INT32 state)
|
||||
{
|
||||
INT32 active = Z180GetActive();
|
||||
@ -59,7 +52,7 @@ cpu_core_config Z180Config =
|
||||
Z180GetActive,
|
||||
Z180TotalCycles,
|
||||
Z180NewFrame,
|
||||
core_idle,
|
||||
Z180Idle,
|
||||
core_set_irq,
|
||||
Z180Run,
|
||||
Z180RunEnd,
|
||||
@ -238,6 +231,16 @@ void Z180BurnCycles(INT32 cycles)
|
||||
z180_burn(cycles);
|
||||
}
|
||||
|
||||
INT32 Z180Idle(INT32 cycles)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_Z180Initted) bprintf(PRINT_ERROR, _T("Z180Idle called without init\n"));
|
||||
if (nActiveCPU == -1) bprintf(PRINT_ERROR, _T("Z180Idle called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return z180_idle(cycles);
|
||||
}
|
||||
|
||||
void Z180SetIRQLine(INT32 irqline, INT32 state)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
|
@ -14,6 +14,7 @@ void Z180Init(UINT32 nCPU);
|
||||
void Z180Exit();
|
||||
void Z180Reset();
|
||||
INT32 Z180Run(INT32 cycles);
|
||||
INT32 Z180Idle(INT32 cycles);
|
||||
void Z180BurnCycles(INT32 cycles);
|
||||
void Z180SetIRQLine(INT32 irqline, INT32 state);
|
||||
void Z180Scan(INT32 nAction);
|
||||
|
Loading…
x
Reference in New Issue
Block a user