WOZ: Alternate fix for Wasteland (#733)

. apply extraLatchDelay on the last bitCell (if there's a latchDelay)
Debugger: Extended 'videoinfo' command to show cycles as absolute or relative.
This commit is contained in:
tomcw 2019-12-30 19:52:49 +00:00
parent 960af9bda0
commit 183ec2bc8c
5 changed files with 20 additions and 9 deletions

View File

@ -6873,6 +6873,10 @@ Update_t CmdVideoScannerInfo(int nArgs)
g_videoScannerDisplayInfo.isHorzReal = true;
else if (strcmp(g_aArgs[1].sArg, "apple") == 0)
g_videoScannerDisplayInfo.isHorzReal = false;
else if (strcmp(g_aArgs[1].sArg, "abs") == 0)
g_videoScannerDisplayInfo.isAbsCycle = true;
else if (strcmp(g_aArgs[1].sArg, "rel") == 0)
g_videoScannerDisplayInfo.isAbsCycle = false;
else
return Help_Arg_1(CMD_VIDEO_SCANNER_INFO);
}

View File

@ -3785,7 +3785,8 @@ void DrawVideoScannerInfo (int line)
rect.left += nameWidth * nFontWidth;
char sValue[10];
sprintf_s(sValue, sizeof(sValue), "%08X", g_videoScannerDisplayInfo.cycleDelta);
const UINT cycles = g_videoScannerDisplayInfo.isAbsCycle ? (UINT)g_nCumulativeCycles : g_videoScannerDisplayInfo.cycleDelta;
sprintf_s(sValue, sizeof(sValue), "%08X", cycles);
PrintText(sValue, rect);
}

View File

@ -102,12 +102,13 @@
class VideoScannerDisplayInfo
{
public:
VideoScannerDisplayInfo(void) : isDecimal(false), isHorzReal(false),
VideoScannerDisplayInfo(void) : isDecimal(false), isHorzReal(false), isAbsCycle(false),
lastCumulativeCycles(0), cycleDelta(0) {}
void Reset(void) { lastCumulativeCycles = g_nCumulativeCycles; cycleDelta = 0; }
bool isDecimal;
bool isHorzReal;
bool isAbsCycle;
unsigned __int64 lastCumulativeCycles;
UINT cycleDelta;

View File

@ -1408,10 +1408,11 @@ Update_t CmdHelpSpecific (int nArgs)
break;
// Video-Scanner
case CMD_VIDEO_SCANNER_INFO:
ConsoleColorizePrint(sText, " Usage: <dec|hex|real|apple>");
ConsoleColorizePrint(sText, " Usage: <dec|hex|real|apple|abs|rel>");
ConsoleBufferPush(" Where:");
ConsoleBufferPush(" <dec|hex> changes output to dec/hex");
ConsoleBufferPush(" <real|apple> alters horz value to hbl-l,visible,hbl-r or hbl-r+l,visible");
ConsoleBufferPush(" <abs|rel> changes cycle output to absolute/relative");
{
char sText2[CONSOLE_WIDTH];
ConsolePrintFormat(sText2, " %sYellow%s=invisible (hbl or vbl active) / %sGreen%s=visible"

View File

@ -1091,6 +1091,8 @@ void __stdcall Disk2InterfaceCard::DataLatchReadWriteWOZ(WORD pc, WORD addr, BYT
drive.m_headWindow = 0;
}
// NB. actual m_diskLastCycle for the last bitCell is minus floppy.m_extraCycles
// - but don't need this value; and it's correctly accounted for in GetBitCellDelta()
m_diskLastCycle = g_nCumulativeCycles;
if (!bWrite)
@ -1127,12 +1129,13 @@ void Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemain
if (dbgWOZ)
{
dbgWOZ = 0;
DumpSectorWOZ(floppy);
// DumpTrackWOZ(floppy); // Enable as necessary
// DumpSectorWOZ(floppy);
DumpTrackWOZ(floppy); // Enable as necessary
}
#endif
UINT extraLatchDelay = (UINT)floppy.m_extraCycles ? 1 : 0; // GH#733
// Only extraCycles of 2 & 3 can hold the latch for another bitCell period, eg. m_latchDelay: 3->5 or 7->9
UINT extraLatchDelay = ((UINT)floppy.m_extraCycles >= 2) ? 2 : 0; // GH#733 (0,1->0; 2,3->2)
for (UINT i = 0; i < bitCellRemainder; i++)
{
@ -1171,8 +1174,9 @@ void Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemain
if (m_latchDelay)
{
m_latchDelay += extraLatchDelay;
extraLatchDelay = 0;
if (i == bitCellRemainder-1) // On last bitCell
m_latchDelay += extraLatchDelay; // +0 or +2
extraLatchDelay = 0; // and always clear (even when not last bitCell)
m_latchDelay -= 4;
if (m_latchDelay < 0)
@ -1218,7 +1222,7 @@ void Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemain
#endif
}
}
}
} // for
#if LOG_DISK_NIBBLES_READ
if (m_floppyLatch & 0x80)