From 0858cc3a23fc9dfd7c27997f62cfcef1ac2f8b66 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 7 Mar 2021 13:11:22 +0000 Subject: [PATCH] Debugger: improve mem views for 6522 & AY8913 chips --- source/Debugger/Debugger_Display.cpp | 8 ++++---- source/Mockingboard.cpp | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index a65b55c9..60571c12 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -2606,10 +2606,10 @@ void DrawMemory ( int line, int iMemDump ) nCols = MAX_MEM_VIEW_TXT; } - if( (eDevice == DEV_SY6522) || (eDevice == DEV_AY8910) ) + if (eDevice == DEV_SY6522 || eDevice == DEV_AY8910) { iAddress = 0; - nCols = 6; + nCols = 4; } rect.right = DISPLAY_WIDTH - 1; @@ -2643,7 +2643,7 @@ void DrawMemory ( int line, int iMemDump ) // else if (eDevice == DEV_SY6522) { - sprintf( sText, "%02X", (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] ); + sprintf( sText, "%02X ", (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] ); if (iCol & 1) DebuggerSetColorFG( DebuggerGetColor( iForeground )); else @@ -2652,7 +2652,7 @@ void DrawMemory ( int line, int iMemDump ) else if (eDevice == DEV_AY8910) { - sprintf( sText, "%02X", (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] ); + sprintf( sText, "%02X ", (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] ); if (iCol & 1) DebuggerSetColorFG( DebuggerGetColor( iForeground )); else diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 91d2cdb4..a8194deb 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -2351,10 +2351,25 @@ void MB_GetSnapshot_v1(SS_CARD_MOCKINGBOARD_v1* const pSS, const DWORD dwSlot) UINT nDeviceNum = nMbCardNum*2; SY6522_AY8910* pMB = &g_MB[nDeviceNum]; - for(UINT i=0; iUnit[i].RegsSY6522, &pMB->sy6522, sizeof(SY6522)); - memcpy(&pSS->Unit[i].RegsAY8910, AY8910_GetRegsPtr(nDeviceNum), 16); + // 6522 + { + BYTE* d = (BYTE*) &pSS->Unit[i].RegsSY6522; + BYTE* s = (BYTE*) &pMB->sy6522; + for (UINT j=0; j<=9; j++) // regs $00-$09 + *d++ = *s++; + s = &pMB->sy6522.SERIAL_SHIFT; + for (UINT j=0; j<=6; j++) // regs $0A-$0F + *d++ = *s++; + } + + // AY8913 + for (UINT j=0; j<16; j++) + { + pSS->Unit[i].RegsAY8910[j] = AYReadReg(nDeviceNum, j); + } + memcpy(&pSS->Unit[i].RegsSSI263, &pMB->SpeechChip, sizeof(SSI263A)); pSS->Unit[i].nAYCurrentRegister = pMB->nAYCurrentRegister; pSS->Unit[i].bTimer1IrqPending = false;