mirror of
https://github.com/libretro/FBNeo.git
synced 2025-02-17 08:07:40 +00:00
(libretro) Update cyclone intf
This commit is contained in:
parent
c94a872e52
commit
88898ff56c
@ -23,7 +23,7 @@ struct SekExt *SekExt[SEK_MAX] = { NULL, }, *pSekExt = NULL;
|
||||
INT32 nSekActive = -1; // The cpu which is currently being emulated
|
||||
INT32 nSekCyclesTotal, nSekCyclesScanline, nSekCyclesSegment, nSekCyclesDone, nSekCyclesToDo;
|
||||
|
||||
INT32 nSekCPUType[SEK_MAX], nSekCycles[SEK_MAX], nSekIRQPending[SEK_MAX], nSekRESETLine[SEK_MAX];
|
||||
INT32 nSekCPUType[SEK_MAX], nSekCycles[SEK_MAX], nSekIRQPending[SEK_MAX], nSekRESETLine[SEK_MAX], nSekHALT[SEK_MAX];
|
||||
|
||||
static INT32 core_idle(INT32 cycles)
|
||||
{
|
||||
@ -538,25 +538,40 @@ extern "C" INT32 M68KTASCallback()
|
||||
#endif
|
||||
|
||||
// ## SekCPUPush() / SekCPUPop() ## internal helpers for sending signals to other 68k's
|
||||
static INT32 nHostCPU, nPushedCPU;
|
||||
struct m68kpstack {
|
||||
INT32 nHostCPU;
|
||||
INT32 nPushedCPU;
|
||||
};
|
||||
#define MAX_PSTACK 10
|
||||
|
||||
static m68kpstack pstack[MAX_PSTACK];
|
||||
static INT32 pstacknum = 0;
|
||||
|
||||
static void SekCPUPush(INT32 nCPU)
|
||||
{
|
||||
nPushedCPU = nCPU;
|
||||
m68kpstack *p = &pstack[pstacknum++];
|
||||
|
||||
nHostCPU = SekGetActive();
|
||||
if (pstacknum + 1 >= MAX_PSTACK) {
|
||||
bprintf(0, _T("SekCPUPush(): out of stack! Possible infinite recursion? Crash pending..\n"));
|
||||
}
|
||||
|
||||
if (nHostCPU != nPushedCPU) {
|
||||
if (nHostCPU != -1) SekClose();
|
||||
SekOpen(nPushedCPU);
|
||||
p->nPushedCPU = nCPU;
|
||||
|
||||
p->nHostCPU = SekGetActive();
|
||||
|
||||
if (p->nHostCPU != p->nPushedCPU) {
|
||||
if (p->nHostCPU != -1) SekClose();
|
||||
SekOpen(p->nPushedCPU);
|
||||
}
|
||||
}
|
||||
|
||||
static void SekCPUPop()
|
||||
{
|
||||
if (nHostCPU != nPushedCPU) {
|
||||
m68kpstack *p = &pstack[--pstacknum];
|
||||
|
||||
if (p->nHostCPU != p->nPushedCPU) {
|
||||
SekClose();
|
||||
if (nHostCPU != -1) SekOpen(nHostCPU);
|
||||
if (p->nHostCPU != -1) SekOpen(p->nHostCPU);
|
||||
}
|
||||
}
|
||||
|
||||
@ -805,6 +820,7 @@ INT32 SekInit(INT32 nCount, INT32 nCPUType)
|
||||
nSekCycles[nCount] = 0;
|
||||
nSekIRQPending[nCount] = 0;
|
||||
nSekRESETLine[nCount] = 0;
|
||||
nSekHALT[nCount] = 0;
|
||||
|
||||
nSekCyclesTotal = 0;
|
||||
nSekCyclesScanline = 0;
|
||||
@ -907,6 +923,12 @@ void SekReset(INT32 nCPU)
|
||||
// Open a CPU
|
||||
void SekOpen(const INT32 i)
|
||||
{
|
||||
#if defined FBNEO_DEBUG
|
||||
if (!DebugCPU_SekInitted) bprintf(PRINT_ERROR, _T("SekOpen called without init\n"));
|
||||
if (i > nSekCount) bprintf(PRINT_ERROR, _T("SekOpen called with invalid index %x\n"), i);
|
||||
if (nSekActive != -1) bprintf(PRINT_ERROR, _T("SekOpen called when CPU already open (%x) with index %x\n"), nSekActive, i);
|
||||
#endif
|
||||
|
||||
if (i != nSekActive) {
|
||||
nSekActive = i;
|
||||
|
||||
@ -1016,6 +1038,53 @@ void SekSetRESETLine(INT32 nCPU, INT32 nStatus)
|
||||
SekCPUPop();
|
||||
}
|
||||
|
||||
INT32 SekGetHALT()
|
||||
{
|
||||
#if defined FBNEO_DEBUG
|
||||
if (!DebugCPU_SekInitted) bprintf(PRINT_ERROR, _T("SekGetHALT called without init\n"));
|
||||
if (nSekActive == -1) bprintf(PRINT_ERROR, _T("SekGetHALT called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
|
||||
if (nSekActive != -1)
|
||||
{
|
||||
return nSekHALT[nSekActive];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SekSetHALT(INT32 nStatus)
|
||||
{
|
||||
#if defined FBNEO_DEBUG
|
||||
if (!DebugCPU_SekInitted) bprintf(PRINT_ERROR, _T("SekSetHALT called without init\n"));
|
||||
if (nSekActive == -1) bprintf(PRINT_ERROR, _T("SekSetHALT called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (nSekActive != -1)
|
||||
{
|
||||
if (nSekHALT[nSekActive] && nStatus == 0)
|
||||
{
|
||||
bprintf(0, _T("SEK: cleared HALT.\n"));
|
||||
}
|
||||
|
||||
nSekHALT[nSekActive] = nStatus;
|
||||
}
|
||||
}
|
||||
|
||||
void SekSetHALT(INT32 nCPU, INT32 nStatus)
|
||||
{
|
||||
#if defined FBNEO_DEBUG
|
||||
if (!DebugCPU_SekInitted) bprintf(PRINT_ERROR, _T("SekSetHALT called without init\n"));
|
||||
#endif
|
||||
|
||||
SekCPUPush(nCPU);
|
||||
|
||||
SekSetHALT(nStatus);
|
||||
|
||||
SekCPUPop();
|
||||
}
|
||||
|
||||
// Set the status of an IRQ line on the active CPU
|
||||
void SekSetIRQLine(const INT32 line, const INT32 nstatus)
|
||||
{
|
||||
@ -1145,9 +1214,9 @@ INT32 SekRun(const INT32 nCycles)
|
||||
nSekCyclesDone = 0;
|
||||
nSekCyclesSegment = nCycles;
|
||||
|
||||
if (nSekRESETLine[nSekActive])
|
||||
if (nSekRESETLine[nSekActive] || nSekHALT[nSekActive])
|
||||
{
|
||||
nSekCyclesSegment = nCycles; // idle when RESET high
|
||||
nSekCyclesSegment = nCycles; // idle when RESET high or halted
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1493,6 +1562,7 @@ INT32 SekScan(INT32 nAction)
|
||||
SCAN_VAR(nSekIRQPending[i]);
|
||||
SCAN_VAR(nSekCycles[i]);
|
||||
SCAN_VAR(nSekRESETLine[i]);
|
||||
SCAN_VAR(nSekHALT[i]);
|
||||
|
||||
#ifdef EMU_C68K
|
||||
if ((nSekCpuCore == SEK_CORE_C68K) && nSekCPUType[i] == 0x68000) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user