Debugger: mini-mem views: support Phasor's AY1&AY2 pair in a single view.

. use: AYsn, where s=0-7 (slot), n=A|B (6522)
This commit is contained in:
tomcw 2023-03-09 22:53:09 +00:00
parent 055c299bb4
commit 1416cc1676
5 changed files with 148 additions and 50 deletions

View File

@ -3615,15 +3615,35 @@ bool MemoryDumpCheck (int nArgs, WORD * pAddress_ )
if (strncmp(g_aArgs[1].sArg, "SY", 2) == 0) // SY6522
{
nAddress = (g_aArgs[1].sArg[2] - '0') & 3;
pArg->eDevice = DEV_SY6522;
bUpdate = true;
if (strlen(g_aArgs[1].sArg) == 3) // "SY0" or "SY1"
{
nAddress = (g_aArgs[1].sArg[2] - '0') & 3;
pArg->eDevice = DEV_SY6522;
bUpdate = true;
}
}
else if (strncmp(g_aArgs[1].sArg, "AY", 2) == 0) // AY8910
else if (strncmp(g_aArgs[1].sArg, "AY", 2) == 0) // AY8913
{
nAddress = (g_aArgs[1].sArg[2] - '0') & 3;
pArg->eDevice = DEV_AY8913;
bUpdate = true;
if (strlen(g_aArgs[1].sArg) == 3) // "AY0" or "AY1"
{
UINT bits = (g_aArgs[1].sArg[2] - '0') & 3;
UINT slot = 4 + (bits >> 1);
UINT subUnit = bits & 1;
nAddress = (slot << 4) | subUnit; // slot=[4..5] | subUnit=[0..1]
pArg->eDevice = DEV_AY8913;
bUpdate = true;
}
else if (strlen(g_aArgs[1].sArg) == 4) // "AYsn" where s = slot#, n = SY6522 A or B eg. AY4A
{
UINT slot = g_aArgs[1].sArg[2] - '0';
UINT subUnit = g_aArgs[1].sArg[3] - 'A';
if (slot <= 7 && subUnit <= 1)
{
nAddress = (slot << 4) | subUnit; // slot=[0..7] | subUnit=[0..1]
pArg->eDevice = DEV_AY8913_PAIR; // for Phasor
bUpdate = true;
}
}
}
#ifdef SUPPORT_Z80_EMU
else if (strcmp(g_aArgs[1].sArg, "*AF") == 0)

View File

@ -1953,10 +1953,10 @@ void DrawMemory ( int line, int iMemDump )
MockingboardCard::DEBUGGER_MB_CARD MB;
bool isMockingboardInSlot = false;
UINT slot = nAddr >> 4, subUnit = nAddr & 1;
if ((eDevice == DEV_SY6522) || (eDevice == DEV_AY8913))
if (eDevice == DEV_SY6522 || eDevice == DEV_AY8913 || eDevice == DEV_AY8913_PAIR)
{
UINT slot = 4 + (nAddr >> 1); // Slot4 or Slot5
if (GetCardMgr().GetMockingboardCardMgr().IsMockingboard(slot))
{
dynamic_cast<MockingboardCard&>(GetCardMgr().GetRef(slot)).GetSnapshotForDebugger(&MB);
@ -1982,7 +1982,10 @@ void DrawMemory ( int line, int iMemDump )
const int MAX_MEM_VIEW_TXT = 16;
const char* pType = "Mem";
std::string sType = "Mem";
if (eDevice == DEV_SY6522 || eDevice == DEV_AY8913 || eDevice == DEV_AY8913_PAIR)
sType = StrFormat("Slot%d", slot);
std::string sAddress;
int iForeground = FG_INFO_OPCODE;
@ -1991,37 +1994,41 @@ void DrawMemory ( int line, int iMemDump )
#if DISPLAY_MEMORY_TITLE
if (eDevice == DEV_SY6522)
{
// sData = StrFormat("Mem at SY#%d", nAddr);
sAddress = StrFormat( "SY#%d", nAddr );
sAddress = StrFormat("%c: SY", 'A' + subUnit);
}
else if (eDevice == DEV_AY8913)
{
// sData = StrFormat("Mem at AY#%d", nAddr);
sAddress = StrFormat( "AY#%d", nAddr );
sAddress = StrFormat("%c: AY", 'A' + subUnit);
}
else if (eDevice == DEV_AY8913_PAIR)
{
sAddress = StrFormat("%c: AY1&AY2", 'A' + subUnit);
}
else
{
sAddress = WordToHexStr( nAddr );
if (iView == MEM_VIEW_HEX)
pType = "HEX";
sType = "HEX";
else if (iView == MEM_VIEW_ASCII)
sType = "ASCII";
else
if (iView == MEM_VIEW_ASCII)
pType = "ASCII";
else
pType = "TEXT";
sType = "TEXT";
}
rect2 = rect;
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ));
DebuggerSetColorBG( DebuggerGetColor( BG_INFO ));
PrintTextCursorX( pType, rect2 );
PrintTextCursorX(sType.c_str(), rect2);
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
PrintTextCursorX( " at ", rect2 );
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_OPERATOR));
if (eDevice == DEV_SY6522 || eDevice == DEV_AY8913 || eDevice == DEV_AY8913_PAIR)
PrintTextCursorX(": ", rect2);
else
PrintTextCursorX(" at ", rect2);
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
PrintTextCursorY( sAddress.c_str(), rect2);
PrintTextCursorY(sAddress.c_str(), rect2);
#endif
rect.top = rect2.top;
@ -2039,31 +2046,102 @@ void DrawMemory ( int line, int iMemDump )
if (eDevice == DEV_SY6522 || eDevice == DEV_AY8913)
{
iAddress = 0;
iAddress = 0; // reg #0
nCols = 4;
}
if (eDevice == DEV_AY8913_PAIR)
{
iAddress = 0; // reg #0
nCols = 8;
}
rect.right = DISPLAY_WIDTH - 1;
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
for (int iLine = 0; iLine < nLines; iLine++ )
if (eDevice == DEV_AY8913_PAIR)
{
// SlotX: A: AY1&AY2
// 00010203:04050607 ; AY1
// 08090A0B:0C0D----
// 00010203:04050607 ; AY2
// 08090A0B:0C0D----
UINT ay = 0; // 1st AY
for (int iLine = 0; iLine < nLines; iLine++)
{
rect2 = rect;
for (int iCol = 0; iCol < nCols; iCol++)
{
DebuggerSetColorBG(DebuggerGetColor(iBackground));
DebuggerSetColorFG(DebuggerGetColor(iForeground));
std::string sText;
if (isMockingboardInSlot && iAddress <= 13)
{
sText = StrFormat("%02X", MB.subUnit[subUnit].regsAY8913[ay][iAddress]);
if (MB.subUnit[subUnit].nAYCurrentRegister[ay] == iAddress)
{
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_TITLE)); // if latched address then draw in white
}
else
{
if (iCol & 1)
DebuggerSetColorFG(DebuggerGetColor(iForeground));
else
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_ADDRESS));
}
}
else
{
sText = "--"; // No MB card in this slot; or regs 14 & 15 which aren't supported by AY-3-8913
}
PrintTextCursorX(sText.c_str(), rect2);
if (iCol == 3)
PrintTextCursorX(":", rect2);
iAddress++;
}
if (iLine == 1) // done lines 0 & 1, so advance to next subUnit
{
ay = 1; // 2nd AY
iAddress = 0; // reg #0
if (MB.type != CT_Phasor)
isMockingboardInSlot = false;
}
rect.top += g_nFontHeight;
rect.bottom += g_nFontHeight;
}
return;
}
//
for (int iLine = 0; iLine < nLines; iLine++)
{
rect2 = rect;
if (iView == MEM_VIEW_HEX)
{
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
PrintTextCursorX( WordToHexStr( iAddress ).c_str(), rect2);
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_ADDRESS));
PrintTextCursorX(WordToHexStr(iAddress).c_str(), rect2);
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
PrintTextCursorX( ":", rect2 );
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_OPERATOR));
PrintTextCursorX(":", rect2);
}
for (int iCol = 0; iCol < nCols; iCol++)
{
DebuggerSetColorBG( DebuggerGetColor( iBackground ));
DebuggerSetColorFG( DebuggerGetColor( iForeground ));
DebuggerSetColorBG(DebuggerGetColor(iBackground));
DebuggerSetColorFG(DebuggerGetColor(iForeground));
std::string sText;
@ -2077,12 +2155,12 @@ void DrawMemory ( int line, int iMemDump )
{
if (isMockingboardInSlot)
{
sText = StrFormat("%02X ", MB.subUnit[nAddr & 1].regsSY6522[iAddress]);
if (MB.subUnit[nAddr & 1].timer1Active && (iAddress == 4 || iAddress == 5)) // T1C
sText = StrFormat("%02X ", MB.subUnit[subUnit].regsSY6522[iAddress]);
if (MB.subUnit[subUnit].timer1Active && (iAddress == 4 || iAddress == 5)) // T1C
{
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_TITLE)); // if timer1 active then draw in white
}
else if (MB.subUnit[nAddr & 1].timer2Active && (iAddress == 8 || iAddress == 9)) // T2C
else if (MB.subUnit[subUnit].timer2Active && (iAddress == 8 || iAddress == 9)) // T2C
{
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_TITLE)); // if timer2 active then draw in white
}
@ -2096,21 +2174,17 @@ void DrawMemory ( int line, int iMemDump )
}
else
{
sText = "-- "; // No MB card in this slot
sText = "-- "; // No MB card in this slot; or regs 14 & 15 which aren't supported by AY-3-8913
}
}
else
if (eDevice == DEV_AY8913)
else if (eDevice == DEV_AY8913)
{
if (isMockingboardInSlot)
if (isMockingboardInSlot && iAddress <= 13)
{
if (iAddress <= 13)
sText = StrFormat("%02X ", MB.subUnit[nAddr & 1].regsAY8913[0][iAddress]); // TODO: Support AY2
else
sText = "-- "; // regs 14 & 15 aren't supported by AY-3-8913
if (MB.subUnit[nAddr & 1].nAYCurrentRegister[0] == iAddress)
sText = StrFormat("%02X ", MB.subUnit[subUnit].regsAY8913[0][iAddress]);
if (MB.subUnit[subUnit].nAYCurrentRegister[0] == iAddress)
{
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_TITLE)); // if latched address then draw in white
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_TITLE)); // if latched address then draw in white
}
else
{
@ -2127,16 +2201,16 @@ void DrawMemory ( int line, int iMemDump )
}
else
{
BYTE nData = (unsigned)*(LPBYTE)(mem+iAddress);
BYTE nData = (unsigned)*(LPBYTE)(mem + iAddress);
if (iView == MEM_VIEW_HEX)
{
if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END))
{
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE ));
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_IO_BYTE));
}
sText = StrFormat( "%02X ", nData );
sText = StrFormat("%02X ", nData);
}
else
{
@ -2144,10 +2218,10 @@ void DrawMemory ( int line, int iMemDump )
if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END))
iBackground = BG_INFO_IO_BYTE;
sText = ColorizeSpecialChar( nData, iView, iBackground );
sText = ColorizeSpecialChar(nData, iView, iBackground);
}
}
PrintTextCursorX( sText.c_str(), rect2); // PrintTextCursorX()
PrintTextCursorX(sText.c_str(), rect2);
iAddress++;
}
// Windows HACK: Bugfix: Rest of line is still background color
@ -2155,7 +2229,7 @@ void DrawMemory ( int line, int iMemDump )
// DebuggerSetColorFG(hDC, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC
// PrintTextCursorX( " ", rect2 );
rect.top += g_nFontHeight;
rect.top += g_nFontHeight;
rect.bottom += g_nFontHeight;
}
}

View File

@ -1176,6 +1176,7 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data
DEV_DISK2 ,
DEV_SY6522,
DEV_AY8913,
DEV_AY8913_PAIR, // Phasor's pair of AYs (connected to one of the 6522s)
NUM_DEVICES
};

View File

@ -975,6 +975,8 @@ void MockingboardCard::SetVolume(DWORD volume, DWORD volumeMax)
void MockingboardCard::GetSnapshotForDebugger(DEBUGGER_MB_CARD* const pMBForDebugger)
{
pMBForDebugger->type = QueryType();
for (UINT i = 0; i < NUM_SUBUNITS_PER_MB; i++)
{
MB_SUBUNIT* pMB = &m_MBSubUnit[i];

View File

@ -60,6 +60,7 @@ public:
};
struct DEBUGGER_MB_CARD
{
SS_CARDTYPE type;
DEBUGGER_MB_SUBUNIT subUnit[NUM_SUBUNITS_PER_MB];
};
void GetSnapshotForDebugger(DEBUGGER_MB_CARD* const pMBForDebugger);