Add multi-CPU support to debug tracking in h6280 interface and core

This commit is contained in:
Barry Harris 2012-01-26 11:21:08 +00:00
parent 64fd6f3ef7
commit 507175c654
2 changed files with 28 additions and 1 deletions

View File

@ -123,6 +123,8 @@
#define H6280_INLINE static
extern INT32 nh6280CpuActive;
static int h6280_ICount = 0;
//static unsigned int h6280_totalcycles = 0;
@ -176,6 +178,7 @@ void h6280Reset(void)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280Reset called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280Reset called with no CPU open\n"));
#endif
int (*save_irqcallback)(int);
@ -225,6 +228,7 @@ int h6280Run(int cycles)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280Run called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280Run called with no CPU open\n"));
#endif
int in;
@ -298,6 +302,7 @@ int h6280TotalCycles()
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280TotalCycles called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280TotalCycles called with no CPU open\n"));
#endif
return h6280.h6280_totalcycles;
@ -307,6 +312,7 @@ void h6280RunEnd()
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280RunEnd called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280RunEnd called with no CPU open\n"));
#endif
h6280_ICount = 0;
@ -318,6 +324,7 @@ void h6280_set_irq_line(int irqline, int state)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_set_irq_line called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_set_irq_line called with no CPU open\n"));
#endif
if (irqline == INPUT_LINE_NMI)
@ -346,6 +353,7 @@ unsigned char h6280_irq_status_r(unsigned int offset)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_irq_status_r called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_irq_status_r called with no CPU open\n"));
#endif
int status;
@ -369,6 +377,7 @@ void h6280_irq_status_w(unsigned int offset, unsigned char data)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_irq_status_w called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_irq_status_w called with no CPU open\n"));
#endif
h6280.io_buffer=data;
@ -390,6 +399,7 @@ unsigned char h6280_timer_r(unsigned int)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_timer_r called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_timer_r called with no CPU open\n"));
#endif
/* only returns countdown */
@ -400,6 +410,7 @@ void h6280_timer_w(unsigned int offset, unsigned char data)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_timer_w called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_timer_w called with no CPU open\n"));
#endif
h6280.io_buffer=data;

View File

@ -29,12 +29,13 @@ static struct h6280_handler sHandler[MAX_H6280];
static struct h6280_handler *sPointer;
INT32 nh6280CpuCount = 0;
static INT32 nh6280CpuActive = -1;
INT32 nh6280CpuActive = -1;
void h6280MapMemory(UINT8 *src, UINT32 start, UINT32 finish, INT32 type)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280MapMemory called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280MapMemory called with no CPU open\n"));
#endif
UINT32 len = (finish-start) >> PAGE_SHIFT;
@ -57,6 +58,7 @@ void h6280SetIrqCallbackHandler(INT32 (*callback)(INT32))
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280SetIrqCallbackHandler called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280SetIrqCallbackHandler called with no CPU open\n"));
#endif
sPointer->irqcallback = callback;
@ -66,6 +68,7 @@ void h6280SetWriteHandler(void (*write)(UINT32, UINT8))
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280SetWriteHandler called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280SetWriteHandler called with no CPU open\n"));
#endif
sPointer->h6280Write = write;
@ -75,6 +78,7 @@ void h6280SetWritePortHandler(void (*write)(UINT8, UINT8))
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280SetWritePortHandler called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280SetWritePortHandler called with no CPU open\n"));
#endif
sPointer->h6280WriteIO = write;
@ -84,6 +88,7 @@ void h6280SetReadHandler(UINT8 (*read)(UINT32))
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280SetReadHandler called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280SetReadPortHandler called with no CPU open\n"));
#endif
sPointer->h6280Read = read;
@ -93,6 +98,7 @@ void h6280_write_rom(UINT32 address, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_write_rom called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_write_rom called with no CPU open\n"));
#endif
address &= 0x1fffff;
@ -118,6 +124,7 @@ void h6280_write_port(UINT8 port, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_write_port called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_write_port called with no CPU open\n"));
#endif
// bprintf (0, _T("%5.5x write port\n"), port);
@ -134,6 +141,7 @@ void h6280_write(UINT32 address, UINT8 data)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_write called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_write called with no CPU open\n"));
#endif
address &= 0x1fffff;
@ -157,6 +165,7 @@ UINT8 h6280_read(UINT32 address)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_read called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_read called with no CPU open\n"));
#endif
address &= 0x1fffff;
@ -178,6 +187,7 @@ UINT8 h6280_fetch1(UINT32 address)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_fetch1 called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_fetch1 called with no CPU open\n"));
#endif
address &= 0x1fffff;
@ -197,6 +207,7 @@ UINT8 h6280_fetch(UINT32 address)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280_fetch called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280_fetch called with no CPU open\n"));
#endif
address &= 0x1fffff;
@ -209,6 +220,7 @@ void h6280SetIRQLine(INT32 line, INT32 state)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280SetIRQLine called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280SetIRQLine called with no CPU open\n"));
#endif
if (state == H6280_IRQSTATUS_AUTO) {
@ -269,6 +281,8 @@ void h6280Open(INT32 num)
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280Open called without init\n"));
if (num >= nh6280CpuCount) bprintf(PRINT_ERROR, _T("h6280Open called with invalid index %x\n"), num);
if (nh6280CpuActive != -1) bprintf(PRINT_ERROR, _T("h6280Open called with CPU already open with index %x\n"), num);
#endif
sPointer = &sHandler[num % MAX_H6280];
@ -282,6 +296,7 @@ void h6280Close()
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280Close called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280Close called with no CPU open\n"));
#endif
h6280_get_context(sPointer->h6280);
@ -295,6 +310,7 @@ INT32 h6280GetActive()
{
#if defined FBA_DEBUG
if (!DebugCPU_H6280Initted) bprintf(PRINT_ERROR, _T("h6280GetActive called without init\n"));
if (nh6280CpuActive == -1) bprintf(PRINT_ERROR, _T("h6280GetActive called with no CPU open\n"));
#endif
return nh6280CpuActive;