From 3af3fc885c5f24e32b5abd688cc996b7a86681f3 Mon Sep 17 00:00:00 2001 From: Barry Harris <44396066+barry65536@users.noreply.github.com> Date: Wed, 10 Apr 2013 19:05:12 +0000 Subject: [PATCH] Add debug tracking support to pic16c5x_intf.cpp --- src/burn/burnint.h | 2 +- src/burn/debug_track.cpp | 4 ++-- src/cpu/pic16c5x_intf.cpp | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/burn/burnint.h b/src/burn/burnint.h index c37efadbf..f39564acb 100644 --- a/src/burn/burnint.h +++ b/src/burn/burnint.h @@ -214,7 +214,7 @@ extern UINT8 DebugCPU_S2650Initted; extern UINT8 DebugCPU_SekInitted; extern UINT8 DebugCPU_VezInitted; extern UINT8 DebugCPU_ZetInitted; - +extern UINT8 DebugCPU_PIC16C5XInitted; extern UINT8 DebugCPU_I8039Initted; extern UINT8 DebugCPU_SH2Initted; diff --git a/src/burn/debug_track.cpp b/src/burn/debug_track.cpp index c34eacb93..ba6143519 100644 --- a/src/burn/debug_track.cpp +++ b/src/burn/debug_track.cpp @@ -60,7 +60,7 @@ UINT8 DebugCPU_S2650Initted; UINT8 DebugCPU_SekInitted; UINT8 DebugCPU_VezInitted; UINT8 DebugCPU_ZetInitted; - +UINT8 DebugCPU_PIC16C5XInitted; UINT8 DebugCPU_I8039Initted; UINT8 DebugCPU_SH2Initted; @@ -123,7 +123,7 @@ void DebugTrackerExit() if (DebugCPU_SekInitted) bprintf(PRINT_ERROR, _T("CPU Sek Not Exited\n")); if (DebugCPU_VezInitted) bprintf(PRINT_ERROR, _T("CPU Vez Not Exited\n")); if (DebugCPU_ZetInitted) bprintf(PRINT_ERROR, _T("CPU Zet Not Exited\n")); - + if (DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("CPU PIC16C5X Not Exited\n")); if (DebugCPU_I8039Initted) bprintf(PRINT_ERROR, _T("CPU I8039 Not Exited\n")); if (DebugCPU_SH2Initted) bprintf(PRINT_ERROR, _T("CPU SH2 Not Exited\n")); } diff --git a/src/cpu/pic16c5x_intf.cpp b/src/cpu/pic16c5x_intf.cpp index 46c248804..aa9676222 100644 --- a/src/cpu/pic16c5x_intf.cpp +++ b/src/cpu/pic16c5x_intf.cpp @@ -16,6 +16,10 @@ void (*pPic16c5xWritePort)(UINT16 port, UINT8 data) = NULL; UINT16 pic16c5x_read_op(UINT16 address) { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5x_read_op called without init\n")); +#endif + UINT16 *ROM = (UINT16*)pic16c5x_rom; address &= rom_address_mask; @@ -25,6 +29,10 @@ UINT16 pic16c5x_read_op(UINT16 address) UINT8 pic16c5x_read_byte(UINT16 address) { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5x_read_byte called without init\n")); +#endif + address &= ram_address_mask; if (nPic16c5xCpuType == 0x16C57 || nPic16c5xCpuType == 0x16C58) { @@ -38,6 +46,10 @@ UINT8 pic16c5x_read_byte(UINT16 address) void pic16c5x_write_byte(UINT16 address, UINT8 data) { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5x_write_byte called without init\n")); +#endif + address &= ram_address_mask; if (nPic16c5xCpuType == 0x16C57 || nPic16c5xCpuType == 0x16C58) { @@ -53,6 +65,10 @@ void pic16c5x_write_byte(UINT16 address, UINT8 data) UINT8 pic16c5x_read_port(UINT16 port) { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5x_read_port called without init\n")); +#endif + if (pPic16c5xReadPort) { return pPic16c5xReadPort(port); } @@ -62,6 +78,10 @@ UINT8 pic16c5x_read_port(UINT16 port) void pic16c5x_write_port(UINT16 port, UINT8 data) { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5x_write_port called without init\n")); +#endif + if (pPic16c5xWritePort) { pPic16c5xWritePort(port, data); return; @@ -70,11 +90,17 @@ void pic16c5x_write_port(UINT16 port, UINT8 data) void pic16c5xReset() { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5xReset called without init\n")); +#endif + pic16c5xDoReset(nPic16c5xCpuType, &rom_address_mask, &ram_address_mask); } void pic16c5xInit(INT32 type, UINT8 *mem) { + DebugCPU_PIC16C5XInitted = 1; + nPic16c5xCpuType = type; pic16c5xDoReset(type, &rom_address_mask, &ram_address_mask); @@ -86,14 +112,24 @@ void pic16c5xInit(INT32 type, UINT8 *mem) void pic16c5xExit() { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5xExit called without init\n")); +#endif + pic16c5x_rom = NULL; nPic16c5xCpuType = -1; BurnFree(pic16c5x_ram); + + DebugCPU_PIC16C5XInitted = 0; } INT32 pic16c5xScan(INT32 nAction,INT32 */*pnMin*/) { +#if defined FBA_DEBUG + if (!DebugCPU_PIC16C5XInitted) bprintf(PRINT_ERROR, _T("pic16c5xScan called without init\n")); +#endif + struct BurnArea ba; pic16c5xScanCpu(nAction, 0);