WOZ: #672
. Even disk i/o read accesses will update the data latch . All disk i/o write accesses will update the data latch
This commit is contained in:
parent
7987883847
commit
b770306496
2 changed files with 130 additions and 96 deletions
|
@ -1046,7 +1046,7 @@ void Disk2InterfaceCard::UpdateBitStreamOffsets(FloppyDisk& floppy)
|
||||||
floppy.m_bitMask = 1 << remainder;
|
floppy.m_bitMask = 1 << remainder;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall Disk2InterfaceCard::ReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles)
|
UINT Disk2InterfaceCard::DataLatchReadWriteCommonWOZ(ULONG uExecutedCycles)
|
||||||
{
|
{
|
||||||
/* m_floppyLoadMode = 0; */
|
/* m_floppyLoadMode = 0; */
|
||||||
FloppyDrive& drive = m_floppyDrive[m_currDrive];
|
FloppyDrive& drive = m_floppyDrive[m_currDrive];
|
||||||
|
@ -1059,7 +1059,7 @@ void __stdcall Disk2InterfaceCard::ReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite,
|
||||||
{
|
{
|
||||||
_ASSERT(0); // Can't happen for WOZ - ReadTrack() should return an empty track
|
_ASSERT(0); // Can't happen for WOZ - ReadTrack() should return an empty track
|
||||||
m_floppyLatch = 0xFF;
|
m_floppyLatch = 0xFF;
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't change latch if drive off after 1 second drive-off delay (UTAIIe page 9-13)
|
// Don't change latch if drive off after 1 second drive-off delay (UTAIIe page 9-13)
|
||||||
|
@ -1067,7 +1067,7 @@ void __stdcall Disk2InterfaceCard::ReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite,
|
||||||
// Note: Sherwood Forest sets shift mode and reads with the drive off.
|
// Note: Sherwood Forest sets shift mode and reads with the drive off.
|
||||||
// TODO: And same for a write?
|
// TODO: And same for a write?
|
||||||
if (!drive.m_spinning) // GH#599
|
if (!drive.m_spinning) // GH#599
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
CpuCalcCycles(uExecutedCycles);
|
CpuCalcCycles(uExecutedCycles);
|
||||||
|
|
||||||
|
@ -1095,15 +1095,26 @@ void __stdcall Disk2InterfaceCard::ReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite,
|
||||||
|
|
||||||
m_diskLastCycle = g_nCumulativeCycles;
|
m_diskLastCycle = g_nCumulativeCycles;
|
||||||
|
|
||||||
//
|
return bitCellRemainder;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_floppyWriteMode)
|
void __stdcall Disk2InterfaceCard::DataLatchReadWOZ(WORD pc, WORD addr, BYTE d, ULONG uExecutedCycles)
|
||||||
{
|
{
|
||||||
|
_ASSERT(!m_floppyWriteMode);
|
||||||
|
|
||||||
|
const UINT bitCellRemainder = DataLatchReadWriteCommonWOZ(uExecutedCycles);
|
||||||
|
if (!bitCellRemainder)
|
||||||
|
return;
|
||||||
|
|
||||||
// m_diskLastReadLatchCycle = g_nCumulativeCycles; // Not used by WOZ (only by NIB)
|
// m_diskLastReadLatchCycle = g_nCumulativeCycles; // Not used by WOZ (only by NIB)
|
||||||
|
|
||||||
#if LOG_DISK_NIBBLES_READ
|
#if LOG_DISK_NIBBLES_READ
|
||||||
bool newLatchData = false;
|
bool newLatchData = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FloppyDrive& drive = m_floppyDrive[m_currDrive];
|
||||||
|
FloppyDisk& floppy = drive.m_disk;
|
||||||
|
|
||||||
for (UINT i = 0; i < bitCellRemainder; i++)
|
for (UINT i = 0; i < bitCellRemainder; i++)
|
||||||
{
|
{
|
||||||
BYTE n = floppy.m_trackimage[floppy.m_byte];
|
BYTE n = floppy.m_trackimage[floppy.m_byte];
|
||||||
|
@ -1198,8 +1209,24 @@ void __stdcall Disk2InterfaceCard::ReadWriteWOZ(WORD pc, WORD addr, BYTE bWrite,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Show track status (GH#201) - NB. Prevent flooding of forcing UI to redraw!!!
|
||||||
|
if ((floppy.m_byte & 0xFF) == 0)
|
||||||
|
FrameDrawDiskStatus((HDC)0);
|
||||||
}
|
}
|
||||||
else if (!floppy.m_bWriteProtected) // && m_floppyWriteMode
|
|
||||||
|
void __stdcall Disk2InterfaceCard::DataLatchWriteWOZ(WORD pc, WORD addr, BYTE d, ULONG uExecutedCycles)
|
||||||
|
{
|
||||||
|
_ASSERT(m_floppyWriteMode);
|
||||||
|
|
||||||
|
const UINT bitCellRemainder = DataLatchReadWriteCommonWOZ(uExecutedCycles);
|
||||||
|
if (!bitCellRemainder)
|
||||||
|
return;
|
||||||
|
|
||||||
|
FloppyDrive& drive = m_floppyDrive[m_currDrive];
|
||||||
|
FloppyDisk& floppy = drive.m_disk;
|
||||||
|
|
||||||
|
if (!floppy.m_bWriteProtected)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
@ -1516,9 +1543,7 @@ BYTE __stdcall Disk2InterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BYTE
|
||||||
case 0x9: pCard->ControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x9: pCard->ControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xA: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xA: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xB: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xB: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xC: if (!isWOZ) pCard->ReadWrite(pc, addr, bWrite, d, nExecutedCycles);
|
case 0xC: if (!isWOZ) pCard->ReadWrite(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
else pCard->ReadWriteWOZ(pc, addr, bWrite, d, nExecutedCycles);
|
|
||||||
break;
|
|
||||||
case 0xD: pCard->LoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xD: pCard->LoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xE: pCard->SetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xE: pCard->SetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xF: pCard->SetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xF: pCard->SetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
|
@ -1526,8 +1551,13 @@ BYTE __stdcall Disk2InterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BYTE
|
||||||
|
|
||||||
// only even addresses return the latch (UTAIIe Table 9.1)
|
// only even addresses return the latch (UTAIIe Table 9.1)
|
||||||
if (!(addr & 1))
|
if (!(addr & 1))
|
||||||
|
{
|
||||||
|
if (isWOZ)
|
||||||
|
pCard->DataLatchReadWOZ(pc, addr, d, nExecutedCycles);
|
||||||
|
|
||||||
return pCard->m_floppyLatch;
|
return pCard->m_floppyLatch;
|
||||||
else
|
}
|
||||||
|
|
||||||
return MemReadFloatingBus(nExecutedCycles);
|
return MemReadFloatingBus(nExecutedCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1553,9 +1583,7 @@ BYTE __stdcall Disk2InterfaceCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE
|
||||||
case 0x9: pCard->ControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x9: pCard->ControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xA: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xA: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xB: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xB: pCard->Enable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xC: if (!isWOZ) pCard->ReadWrite(pc, addr, bWrite, d, nExecutedCycles);
|
case 0xC: if (!isWOZ) pCard->ReadWrite(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
else pCard->ReadWriteWOZ(pc, addr, bWrite, d, nExecutedCycles);
|
|
||||||
break;
|
|
||||||
case 0xD: pCard->LoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xD: pCard->LoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xE: pCard->SetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xE: pCard->SetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xF: pCard->SetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xF: pCard->SetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
|
@ -1565,7 +1593,11 @@ BYTE __stdcall Disk2InterfaceCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE
|
||||||
if (pCard->m_floppyWriteMode /* && m_floppyLoadMode */)
|
if (pCard->m_floppyWriteMode /* && m_floppyLoadMode */)
|
||||||
{
|
{
|
||||||
pCard->m_floppyLatch = d;
|
pCard->m_floppyLatch = d;
|
||||||
|
|
||||||
|
if (isWOZ)
|
||||||
|
pCard->DataLatchWriteWOZ(pc, addr, d, nExecutedCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ private:
|
||||||
UINT GetBitCellDelta(const BYTE optimalBitTiming);
|
UINT GetBitCellDelta(const BYTE optimalBitTiming);
|
||||||
void UpdateBitStreamPosition(FloppyDisk& floppy, const ULONG bitCellDelta);
|
void UpdateBitStreamPosition(FloppyDisk& floppy, const ULONG bitCellDelta);
|
||||||
void UpdateBitStreamOffsets(FloppyDisk& floppy);
|
void UpdateBitStreamOffsets(FloppyDisk& floppy);
|
||||||
|
UINT DataLatchReadWriteCommonWOZ(ULONG uExecutedCycles);
|
||||||
void SaveSnapshotFloppy(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
void SaveSnapshotFloppy(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
||||||
void SaveSnapshotDriveUnit(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
void SaveSnapshotDriveUnit(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
||||||
bool LoadSnapshotFloppy(YamlLoadHelper& yamlLoadHelper, UINT unit, UINT version, std::vector<BYTE>& track);
|
bool LoadSnapshotFloppy(YamlLoadHelper& yamlLoadHelper, UINT unit, UINT version, std::vector<BYTE>& track);
|
||||||
|
@ -199,7 +200,8 @@ private:
|
||||||
void __stdcall ControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
|
void __stdcall ControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
|
||||||
void __stdcall Enable(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 ReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
|
||||||
void __stdcall ReadWriteWOZ(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 LoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG);
|
void __stdcall LoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG);
|
||||||
void __stdcall SetReadMode(WORD, WORD, BYTE, BYTE, ULONG);
|
void __stdcall SetReadMode(WORD, WORD, BYTE, BYTE, ULONG);
|
||||||
void __stdcall SetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles);
|
void __stdcall SetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles);
|
||||||
|
|
Loading…
Add table
Reference in a new issue