Skip to content

Commit

Permalink
DiskII: allow reading of write-protect state when in write mode (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcw committed Feb 11, 2018
1 parent 2295964 commit 82fdf1a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions source/Disk.cpp
Expand Up @@ -996,20 +996,22 @@ bool DiskSelect(const int iDrive)

//===========================================================================

static void __stdcall DiskLoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG) {
static void __stdcall DiskLoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG)
{
/* floppyloadmode = 1; */
if (!write)
{
// Should really test for drive off - after 1 second drive off delay (UTAIIe page 9-13)
// but Gemstone Warrior sets load mode with the drive off, so don't check for now
if (!floppywritemode)
{
// Phase 1 on also forces write protect in the Disk II drive (UTAIIe page 9-7) but we don't implement that
if (g_aFloppyDisk[currdrive].bWriteProtected)
floppylatch |= 0x80;
else
floppylatch &= 0x7F;
}
// Notes:
// . Should really test for drive off - after 1 second drive off delay (UTAIIe page 9-13)
// but Gemstone Warrior sets load mode with the drive off, so don't check for now
// . Phase 1 on also forces write protect in the Disk II drive (UTAIIe page 9-7) but we don't implement that
// . write mode doesn't prevent reading write protect (GH#537):
// "If for some reason the above write protect check were entered with the READ/WRITE switch in WRITE,
// the write protect switch would still be read correctly" (UTAIIe page 9-21)
if (g_aFloppyDisk[currdrive].bWriteProtected)
floppylatch |= 0x80;
else
floppylatch &= 0x7F;
}
}

Expand Down

0 comments on commit 82fdf1a

Please sign in to comment.