From 5a7076135ec6c00744ff127b507bf9d95427f98c Mon Sep 17 00:00:00 2001 From: tomcw Date: Sat, 11 Mar 2023 13:56:44 +0000 Subject: [PATCH] Debugger: mini-view for AYs: show AY PSG function: RD, WR, LA (or '--' if INACTIVE) --- source/Debugger/Debugger_Color.cpp | 1 + source/Debugger/Debugger_Color.h | 1 + source/Debugger/Debugger_Display.cpp | 12 ++++++++++++ source/Mockingboard.cpp | 12 ++++++++++++ source/Mockingboard.h | 1 + 5 files changed, 27 insertions(+) diff --git a/source/Debugger/Debugger_Color.cpp b/source/Debugger/Debugger_Color.cpp index f731421e..152c8ecd 100644 --- a/source/Debugger/Debugger_Color.cpp +++ b/source/Debugger/Debugger_Color.cpp @@ -143,6 +143,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Y8, // FG_SY6522_ODD COLOR_CUSTOM_01, // FG_AY8913_EVEN Y8, // FG_AY8913_ODD + R8, // FG_AY8913_FUNCTION }; diff --git a/source/Debugger/Debugger_Color.h b/source/Debugger/Debugger_Color.h index 81902b78..6a431a98 100644 --- a/source/Debugger/Debugger_Color.h +++ b/source/Debugger/Debugger_Color.h @@ -137,6 +137,7 @@ , FG_SY6522_ODD , FG_AY8913_EVEN , FG_AY8913_ODD + , FG_AY8913_FUNCTION , NUM_DEBUG_COLORS }; diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index 73ed7b26..08eefc44 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -1998,6 +1998,12 @@ void DrawLine_MB_SUBUNIT(RECT& rect, WORD& iAddress, const int nCols, int iForeg else { sText = "--"; // No MB card in this slot; or AY regs 14 & 15 which aren't supported by AY-3-8913 + if (isMockingboardInSlot && !is6522 && iAddress == 15) // for AY reg-15, output the AY's state + { + sText = (char*)&MB.subUnit[subUnit].szState[0]; + if (sText.compare("--") != 0) + DebuggerSetColorFG(DebuggerGetColor(FG_AY8913_FUNCTION)); // Show any active function in red + } } PrintTextCursorX(sText.c_str(), rect2); @@ -2030,6 +2036,12 @@ void DrawLine_AY8913_PAIR(RECT& rect, WORD& iAddress, const int nCols, int iFore else { sText = "--"; // No MB card in this slot; or AY regs 14 & 15 which aren't supported by AY-3-8913 + if (isMockingboardInSlot && iAddress == 15) // for AY reg-15, output the AY's state + { + sText = (char*)&MB.subUnit[subUnit].szState[ay]; + if (sText.compare("--") != 0) + DebuggerSetColorFG(DebuggerGetColor(FG_AY8913_FUNCTION)); // Show any active function in red + } } PrintTextCursorX(sText.c_str(), rect2); diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index ec4e5d24..b94a865e 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -992,6 +992,18 @@ void MockingboardCard::GetSnapshotForDebugger(DEBUGGER_MB_CARD* const pMBForDebu pMBForDebugger->subUnit[i].nAYCurrentRegister[j] = pMB->nAYCurrentRegister[j]; pMBForDebugger->subUnit[i].isAYLatchedAddressValid[j] = pMB->isAYLatchedAddressValid[j]; + + switch (pMB->state[j]) + { + case AY_READ: + strcpy((char*)&pMBForDebugger->subUnit[i].szState[j], "RD"); break; + case AY_WRITE: + strcpy((char*)&pMBForDebugger->subUnit[i].szState[j], "WR"); break; + case AY_LATCH: + strcpy((char*)&pMBForDebugger->subUnit[i].szState[j], "LA"); break; + default: //AY_INACTIVE + strcpy((char*)&pMBForDebugger->subUnit[i].szState[j], "--"); break; + } } } } diff --git a/source/Mockingboard.h b/source/Mockingboard.h index 35263814..36cb8815 100644 --- a/source/Mockingboard.h +++ b/source/Mockingboard.h @@ -56,6 +56,7 @@ public: bool timer2Active; BYTE regsAY8913[NUM_AY8913_PER_SUBUNIT][16]; BYTE nAYCurrentRegister[NUM_AY8913_PER_SUBUNIT]; + char szState[NUM_AY8913_PER_SUBUNIT][3]; // "--"(INACTIVE), "RD", "WR", "LA" bool isAYLatchedAddressValid[NUM_AY8913_PER_SUBUNIT]; }; struct DEBUGGER_MB_CARD