Added debug tracking support to vez.cpp and zet.cpp
This commit is contained in:
parent
f09e11801e
commit
33420a2354
109
src/cpu/vez.cpp
109
src/cpu/vez.cpp
|
@ -145,26 +145,51 @@ void cpu_writemem20(UINT32 a, UINT8 d)
|
|||
|
||||
void VezSetReadHandler(UINT8 (__fastcall *pHandler)(UINT32))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezSetReadHandler called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezSetReadHandler called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
VezCurrentCPU->ReadHandler = pHandler;
|
||||
}
|
||||
|
||||
void VezSetWriteHandler(void (__fastcall *pHandler)(UINT32, UINT8))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezSetWriteHandler called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezSetWriteHandler called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
VezCurrentCPU->WriteHandler = pHandler;
|
||||
}
|
||||
|
||||
void VezSetReadPort(UINT8 (__fastcall *pHandler)(UINT32))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezSetReadPort called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezSetReadPort called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
VezCurrentCPU->ReadPort = pHandler;
|
||||
}
|
||||
|
||||
void VezSetWritePort(void (__fastcall *pHandler)(UINT32, UINT8))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezSetWritePort called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezSetWritePort called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
VezCurrentCPU->WritePort = pHandler;
|
||||
}
|
||||
|
||||
void VezSetDecode(UINT8 *table)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezSetDecode called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezSetDcode called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (VezCurrentCPU->decode) {
|
||||
VezCurrentCPU->decode(table);
|
||||
}
|
||||
|
@ -172,12 +197,12 @@ void VezSetDecode(UINT8 *table)
|
|||
|
||||
INT32 VezInit(INT32 cpu, INT32 type, INT32 clock)
|
||||
{
|
||||
DebugCPU_VezInitted = 1;
|
||||
|
||||
if (cpu >= MAX_VEZ) {
|
||||
bprintf (0, _T("Only %d Vez available! Increase MAX_VEZ in vez.cpp.\n"), MAX_VEZ);
|
||||
}
|
||||
|
||||
nOpenedCPU = cpu;
|
||||
|
||||
VezCPUContext[cpu] = (VezContext*)BurnMalloc(sizeof(VezContext));
|
||||
|
||||
VezCurrentCPU = VezCPUContext[cpu];
|
||||
|
@ -248,6 +273,10 @@ INT32 VezInit(INT32 cpu, INT32 type)
|
|||
|
||||
void VezExit()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezExit called without init\n"));
|
||||
#endif
|
||||
|
||||
for (INT32 i = 0; i < MAX_VEZ; i++) {
|
||||
if (VezCPUContext[i]) {
|
||||
BurnFree(VezCPUContext[i]);
|
||||
|
@ -259,10 +288,18 @@ void VezExit()
|
|||
nVezCount = 0;
|
||||
|
||||
nOpenedCPU = -1;
|
||||
|
||||
DebugCPU_VezInitted = 0;
|
||||
}
|
||||
|
||||
void VezOpen(INT32 nCPU)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezOpen called without init\n"));
|
||||
if (nCPU > nCPUCount) bprintf(PRINT_ERROR, _T("VezOpen called with invalid index %x\n"), nCPU);
|
||||
if (nOpenedCPU != -1) bprintf(PRINT_ERROR, _T("VezOpen called when CPU already open with index %x\n"), nCPU);
|
||||
#endif
|
||||
|
||||
if (nCPU >= MAX_VEZ || nCPU < 0) nCPU = 0;
|
||||
|
||||
nOpenedCPU = nCPU;
|
||||
|
@ -272,6 +309,11 @@ void VezOpen(INT32 nCPU)
|
|||
|
||||
void VezClose()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezClose called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezClose called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
nOpenedCPU = -1;
|
||||
VezCurrentCPU->cpu_close();
|
||||
VezCurrentCPU = 0;
|
||||
|
@ -279,6 +321,10 @@ void VezClose()
|
|||
|
||||
void VezNewFrame()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezNewFrame called without init\n"));
|
||||
#endif
|
||||
|
||||
// should be separated?
|
||||
v25_new_frame();
|
||||
nec_new_frame();
|
||||
|
@ -286,26 +332,51 @@ void VezNewFrame()
|
|||
|
||||
void VezRunEnd()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezRunEnd called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezRunEnd called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
VezCurrentCPU->runend();
|
||||
}
|
||||
|
||||
void VezIdle(INT32 cycles)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezIdle called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezIdle called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
VezCurrentCPU->idle(cycles);
|
||||
}
|
||||
|
||||
UINT32 VezTotalCycles()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezTotalCycles called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezTotalCycles called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return VezCurrentCPU->total_cycles();
|
||||
}
|
||||
|
||||
INT32 VezGetActive()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezGetActive called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezGetActive called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return nOpenedCPU;
|
||||
}
|
||||
|
||||
INT32 VezMemCallback(INT32 nStart,INT32 nEnd,INT32 nMode)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezMemCallback called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezMemCallback called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
nStart >>= VEZ_MEM_SHIFT;
|
||||
nEnd += VEZ_MEM_MASK;
|
||||
nEnd >>= VEZ_MEM_SHIFT;
|
||||
|
@ -329,6 +400,11 @@ INT32 VezMemCallback(INT32 nStart,INT32 nEnd,INT32 nMode)
|
|||
|
||||
INT32 VezMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezMapArea called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezMapArea called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
INT32 s = nStart >> VEZ_MEM_SHIFT;
|
||||
INT32 e = (nEnd + VEZ_MEM_MASK) >> VEZ_MEM_SHIFT;
|
||||
|
||||
|
@ -352,6 +428,11 @@ INT32 VezMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem)
|
|||
|
||||
INT32 VezMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem1, UINT8 *Mem2)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezMapArea called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezMapArea called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
INT32 s = nStart >> VEZ_MEM_SHIFT;
|
||||
INT32 e = (nEnd + VEZ_MEM_MASK) >> VEZ_MEM_SHIFT;
|
||||
|
||||
|
@ -367,11 +448,21 @@ INT32 VezMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem1, UINT8 *Mem2
|
|||
|
||||
INT32 VezReset()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezReset called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezReset called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return VezCurrentCPU->cpu_reset();
|
||||
}
|
||||
|
||||
INT32 VezRun(INT32 nCycles)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezRun called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezRun called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (nCycles <= 0) return 0;
|
||||
|
||||
return VezCurrentCPU->cpu_execute(nCycles);
|
||||
|
@ -379,6 +470,11 @@ INT32 VezRun(INT32 nCycles)
|
|||
|
||||
INT32 VezPc(INT32 n)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezPc called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezPc called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (n == -1) {
|
||||
return VezCurrentCPU->get_pc(-1);
|
||||
} else {
|
||||
|
@ -392,6 +488,10 @@ INT32 VezPc(INT32 n)
|
|||
|
||||
INT32 VezScan(INT32 nAction)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezScan called without init\n"));
|
||||
#endif
|
||||
|
||||
if ((nAction & ACB_DRIVER_DATA) == 0)
|
||||
return 0;
|
||||
|
||||
|
@ -407,6 +507,11 @@ INT32 VezScan(INT32 nAction)
|
|||
|
||||
void VezSetIRQLineAndVector(const INT32 line, const INT32 vector, const INT32 status)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("VezSetIRQLineAndVector called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("VezSetIRQLineAndVector called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (status == VEZ_IRQSTATUS_AUTO)
|
||||
{
|
||||
VezCurrentCPU->cpu_set_irq_line(line, vector, VEZ_IRQSTATUS_ACK);
|
||||
|
|
152
src/cpu/zet.cpp
152
src/cpu/zet.cpp
|
@ -112,26 +112,50 @@ UINT8 __fastcall ZetReadOpArg(UINT32 a)
|
|||
|
||||
void ZetSetReadHandler(UINT8 (__fastcall *pHandler)(UINT16))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetReadHandler called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetReadHandler called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
ZetCPUContext[nOpenedCPU].ZetRead = pHandler;
|
||||
}
|
||||
|
||||
void ZetSetWriteHandler(void (__fastcall *pHandler)(UINT16, UINT8))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetWriteHandler called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetWriteHandler called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
ZetCPUContext[nOpenedCPU].ZetWrite = pHandler;
|
||||
}
|
||||
|
||||
void ZetSetInHandler(UINT8 (__fastcall *pHandler)(UINT16))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetInHandler called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetInHandler called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
ZetCPUContext[nOpenedCPU].ZetIn = pHandler;
|
||||
}
|
||||
|
||||
void ZetSetOutHandler(void (__fastcall *pHandler)(UINT16, UINT8))
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetOutHandler called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetOutHandler called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
ZetCPUContext[nOpenedCPU].ZetOut = pHandler;
|
||||
}
|
||||
|
||||
void ZetNewFrame()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetNewFrame called without init\n"));
|
||||
#endif
|
||||
|
||||
for (INT32 i = 0; i < nCPUCount; i++) {
|
||||
nZetCyclesDone[i] = 0;
|
||||
}
|
||||
|
@ -140,6 +164,8 @@ void ZetNewFrame()
|
|||
|
||||
INT32 ZetInit(INT32 nCount)
|
||||
{
|
||||
DebugCPU_ZetInitted = 1;
|
||||
|
||||
nOpenedCPU = -1;
|
||||
|
||||
ZetCPUContext = (struct ZetExt *) malloc(nCount * sizeof(ZetExt));
|
||||
|
@ -174,8 +200,6 @@ INT32 ZetInit(INT32 nCount)
|
|||
Z80SetCPUOpReadHandler(ZetReadOp);
|
||||
Z80SetCPUOpArgReadHandler(ZetReadOpArg);
|
||||
|
||||
ZetOpen(0);
|
||||
|
||||
nCPUCount = nCount % MAX_Z80;
|
||||
|
||||
nHasZet = nCount;
|
||||
|
@ -202,6 +226,11 @@ void ZetWriteByte(UINT16 address, UINT8 data)
|
|||
|
||||
void ZetWriteRom(UINT16 address, UINT8 data)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetWriteRom called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetWriteRom called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (nOpenedCPU < 0) return;
|
||||
|
||||
if (ZetCPUContext[nOpenedCPU].pZetMemMap[0x200 | (address >> 8)] != NULL) {
|
||||
|
@ -217,6 +246,11 @@ void ZetWriteRom(UINT16 address, UINT8 data)
|
|||
|
||||
void ZetClose()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetClose called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetClose called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
Z80GetContext(&ZetCPUContext[nOpenedCPU].reg);
|
||||
nZetCyclesDone[nOpenedCPU] = nZetCyclesTotal;
|
||||
nZ80ICount[nOpenedCPU] = z80_ICount;
|
||||
|
@ -227,6 +261,12 @@ void ZetClose()
|
|||
|
||||
void ZetOpen(INT32 nCPU)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetOpen called without init\n"));
|
||||
if (nCPU >= nCPUCount) bprintf(PRINT_ERROR, _T("ZetOpen called with invalid index %x\n"), nCPU);
|
||||
if (nOpenedCPU != -1) bprintf(PRINT_ERROR, _T("ZetOpen called when CPU already open with index %x\n"), nCPU);
|
||||
#endif
|
||||
|
||||
Z80SetContext(&ZetCPUContext[nCPU].reg);
|
||||
nZetCyclesTotal = nZetCyclesDone[nCPU];
|
||||
z80_ICount = nZ80ICount[nCPU];
|
||||
|
@ -237,11 +277,21 @@ void ZetOpen(INT32 nCPU)
|
|||
|
||||
INT32 ZetGetActive()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetGetActive called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetGetActive called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return nOpenedCPU;
|
||||
}
|
||||
|
||||
INT32 ZetRun(INT32 nCycles)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRun called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRun called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (nCycles <= 0) return 0;
|
||||
|
||||
if (ZetCPUContext[nOpenedCPU].BusReq) {
|
||||
|
@ -258,15 +308,28 @@ INT32 ZetRun(INT32 nCycles)
|
|||
|
||||
void ZetRunAdjust(INT32 /*nCycles*/)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRunAdjust called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRunAdjust called when no CPU open\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ZetRunEnd()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetRunEnd called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetRunEnd called when no CPU open\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
// This function will make an area callback ZetRead/ZetWrite
|
||||
INT32 ZetMemCallback(INT32 nStart, INT32 nEnd, INT32 nMode)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMemCallback called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMemCallback called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
UINT8 cStart = (nStart >> 8);
|
||||
UINT8 **pMemMap = ZetCPUContext[nOpenedCPU].pZetMemMap;
|
||||
|
||||
|
@ -290,11 +353,20 @@ INT32 ZetMemCallback(INT32 nStart, INT32 nEnd, INT32 nMode)
|
|||
|
||||
INT32 ZetMemEnd()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMemEnd called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMemEnd called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ZetExit()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetExit called without init\n"));
|
||||
#endif
|
||||
|
||||
Z80Exit();
|
||||
if (ZetCPUContext) {
|
||||
free(ZetCPUContext);
|
||||
|
@ -303,11 +375,18 @@ void ZetExit()
|
|||
|
||||
nCPUCount = 0;
|
||||
nHasZet = -1;
|
||||
|
||||
DebugCPU_ZetInitted = 0;
|
||||
}
|
||||
|
||||
|
||||
INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMapArea called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMapArea called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
UINT8 cStart = (nStart >> 8);
|
||||
UINT8 **pMemMap = ZetCPUContext[nOpenedCPU].pZetMemMap;
|
||||
|
||||
|
@ -336,6 +415,11 @@ INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem)
|
|||
|
||||
INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem02)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetMapArea called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetMapArea called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
UINT8 cStart = (nStart >> 8);
|
||||
UINT8 **pMemMap = ZetCPUContext[nOpenedCPU].pZetMemMap;
|
||||
|
||||
|
@ -353,6 +437,11 @@ INT32 ZetMapArea(INT32 nStart, INT32 nEnd, INT32 nMode, UINT8 *Mem01, UINT8 *Mem
|
|||
|
||||
INT32 ZetReset()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetReset called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetReset called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
Z80Reset();
|
||||
|
||||
return 0;
|
||||
|
@ -360,6 +449,11 @@ INT32 ZetReset()
|
|||
|
||||
INT32 ZetPc(INT32 n)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetPc called without init\n"));
|
||||
if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetPc called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (n < 0) {
|
||||
return ActiveZ80GetPC();
|
||||
} else {
|
||||
|
@ -369,6 +463,11 @@ INT32 ZetPc(INT32 n)
|
|||
|
||||
INT32 ZetBc(INT32 n)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetBc called without init\n"));
|
||||
if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetBc called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (n < 0) {
|
||||
return ActiveZ80GetBC();
|
||||
} else {
|
||||
|
@ -378,6 +477,11 @@ INT32 ZetBc(INT32 n)
|
|||
|
||||
INT32 ZetDe(INT32 n)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetDe called without init\n"));
|
||||
if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetDe called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (n < 0) {
|
||||
return ActiveZ80GetDE();
|
||||
} else {
|
||||
|
@ -387,6 +491,11 @@ INT32 ZetDe(INT32 n)
|
|||
|
||||
INT32 ZetHL(INT32 n)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetHL called without init\n"));
|
||||
if (nOpenedCPU == -1 && n < 0) bprintf(PRINT_ERROR, _T("ZetHL called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (n < 0) {
|
||||
return ActiveZ80GetHL();
|
||||
} else {
|
||||
|
@ -396,6 +505,10 @@ INT32 ZetHL(INT32 n)
|
|||
|
||||
INT32 ZetScan(INT32 nAction)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetScan called without init\n"));
|
||||
#endif
|
||||
|
||||
if ((nAction & ACB_DRIVER_DATA) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -418,6 +531,11 @@ INT32 ZetScan(INT32 nAction)
|
|||
|
||||
void ZetSetIRQLine(const INT32 line, const INT32 status)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetIRQLine called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetIRQLine called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
switch ( status ) {
|
||||
case ZET_IRQSTATUS_NONE:
|
||||
Z80SetIrqLine(0, 0);
|
||||
|
@ -436,11 +554,21 @@ void ZetSetIRQLine(const INT32 line, const INT32 status)
|
|||
|
||||
void ZetSetVector(INT32 vector)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetVector called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetVector called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
Z80Vector = vector;
|
||||
}
|
||||
|
||||
INT32 ZetNmi()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetNmi called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetNmi called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
Z80SetIrqLine(Z80_INPUT_LINE_NMI, 1);
|
||||
Z80Execute(0);
|
||||
Z80SetIrqLine(Z80_INPUT_LINE_NMI, 0);
|
||||
|
@ -453,6 +581,11 @@ INT32 ZetNmi()
|
|||
|
||||
INT32 ZetIdle(INT32 nCycles)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetIdle called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetIdle called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
nZetCyclesTotal += nCycles;
|
||||
|
||||
return nCycles;
|
||||
|
@ -460,16 +593,31 @@ INT32 ZetIdle(INT32 nCycles)
|
|||
|
||||
INT32 ZetSegmentCycles()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSegmentCycles called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSegmentCycles called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 ZetTotalCycles()
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetTotalCycles called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetTotalCycles called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
return nZetCyclesTotal;
|
||||
}
|
||||
|
||||
void ZetSetBUSREQLine(INT32 nStatus)
|
||||
{
|
||||
#if defined FBA_DEBUG
|
||||
if (!DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("ZetSetBUSREQLine called without init\n"));
|
||||
if (nOpenedCPU == -1) bprintf(PRINT_ERROR, _T("ZetSetBUSREQLine called when no CPU open\n"));
|
||||
#endif
|
||||
|
||||
if (nOpenedCPU < 0) return;
|
||||
|
||||
ZetCPUContext[nOpenedCPU].BusReq = nStatus;
|
||||
|
|
Loading…
Reference in New Issue