WOZ: Small refactor to call DataLatchReadWriteWOZ() for any WOZ data-latch access

This commit is contained in:
tomcw 2019-08-03 18:10:39 +01:00
parent d973fb6b97
commit 1af12fbbb1
2 changed files with 20 additions and 19 deletions

View File

@ -1098,12 +1098,8 @@ UINT Disk2InterfaceCard::DataLatchReadWriteCommonWOZ(ULONG uExecutedCycles)
return bitCellRemainder;
}
void __stdcall Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, BYTE d, ULONG uExecutedCycles)
void Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemainder)
{
const UINT bitCellRemainder = DataLatchReadWriteCommonWOZ(uExecutedCycles);
if (!bitCellRemainder)
return;
// m_diskLastReadLatchCycle = g_nCumulativeCycles; // Not used by WOZ (only by NIB)
#if LOG_DISK_NIBBLES_READ
@ -1216,20 +1212,12 @@ void __stdcall Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, BYTE d,
}
}
#endif
// Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!!
if ((floppy.m_byte & 0xFF) == 0)
FrameDrawDiskStatus((HDC)0);
}
void __stdcall Disk2InterfaceCard::DataLatchWriteWOZ(WORD pc, WORD addr, BYTE d, ULONG uExecutedCycles)
void Disk2InterfaceCard::DataLatchWriteWOZ(WORD pc, WORD addr, BYTE d, UINT bitCellRemainder)
{
_ASSERT(m_floppyWriteMode);
const UINT bitCellRemainder = DataLatchReadWriteCommonWOZ(uExecutedCycles);
if (!bitCellRemainder)
return;
FloppyDrive& drive = m_floppyDrive[m_currDrive];
FloppyDisk& floppy = drive.m_disk;
@ -1237,9 +1225,21 @@ void __stdcall Disk2InterfaceCard::DataLatchWriteWOZ(WORD pc, WORD addr, BYTE d,
{
//TODO
}
}
void __stdcall Disk2InterfaceCard::DataLatchReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles)
{
const UINT bitCellRemainder = DataLatchReadWriteCommonWOZ(uExecutedCycles);
if (!bitCellRemainder)
return;
if (!bWrite)
DataLatchReadWOZ(pc, addr, bitCellRemainder);
else
DataLatchWriteWOZ(pc, addr, d, bitCellRemainder);
// Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!!
if ((floppy.m_byte & 0xFF) == 0)
if ((m_floppyDrive[m_currDrive].m_disk.m_byte & 0xFF) == 0)
FrameDrawDiskStatus((HDC)0);
}
@ -1687,7 +1687,7 @@ BYTE __stdcall Disk2InterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BYTE
if (!(addr & 1))
{
if (isWOZ)
pCard->DataLatchReadWOZ(pc, addr, d, nExecutedCycles);
pCard->DataLatchReadWriteWOZ(pc, addr, bWrite, d, nExecutedCycles);
return pCard->m_floppyLatch;
}
@ -1729,7 +1729,7 @@ BYTE __stdcall Disk2InterfaceCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE
pCard->m_floppyLatch = d;
if (isWOZ)
pCard->DataLatchWriteWOZ(pc, addr, d, nExecutedCycles);
pCard->DataLatchReadWriteWOZ(pc, addr, bWrite, d, nExecutedCycles);
}
return 0;

View File

@ -189,6 +189,8 @@ private:
void UpdateBitStreamPosition(FloppyDisk& floppy, const ULONG bitCellDelta);
void UpdateBitStreamOffsets(FloppyDisk& floppy);
UINT DataLatchReadWriteCommonWOZ(ULONG uExecutedCycles);
void DataLatchReadWOZ(WORD pc, WORD addr, UINT bitCellRemainder);
void DataLatchWriteWOZ(WORD pc, WORD addr, BYTE d, UINT bitCellRemainder);
void DumpSectorWOZ(FloppyDisk floppy);
void DumpTrackWOZ(FloppyDisk floppy);
@ -203,8 +205,7 @@ private:
void __stdcall ControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
void __stdcall Enable(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
void __stdcall ReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
void __stdcall DataLatchReadWOZ(WORD pc, WORD addr, BYTE d, ULONG uExecutedCycles);
void __stdcall DataLatchWriteWOZ(WORD pc, WORD addr, BYTE d, ULONG uExecutedCycles);
void __stdcall DataLatchReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
void __stdcall LoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG);
void __stdcall SetReadMode(WORD, WORD, BYTE, BYTE, ULONG);
void __stdcall SetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles);