diskSize[0] = diskSize[1] = 0;
diskType[0] = diskType[1] = DT_UNKNOWN;
imageDirty[0] = imageDirty[1] = false;
+ writeProtected[0] = writeProtected[1] = false;
imageName[0][0] = imageName[1][0] = 0; // Zero out filenames
}
memset(nybblizedImage[driveNum], 0x00, 232960); // Set it to 0 instead of $FF for proper formatting...
diskType[driveNum] = DT_DOS33;
strcpy(imageName[driveNum], "newblank.dsk");
+ writeProtected[driveNum] = false;
SpawnMessage("New blank image inserted in drive %u...", driveNum);
}
uint8 imageDirtyTmp = imageDirty[0];
imageDirty[0] = imageDirty[1];
imageDirty[1] = imageDirtyTmp;
+
+ uint8 writeProtectedTmp = writeProtected[0];
+ writeProtected[0] = writeProtected[1];
+ writeProtected[1] = writeProtectedTmp;
SpawnMessage("Drive 0: %s...", imageName[0]);
}
diskSize[driveNum] = 0;
diskType[driveNum] = DT_UNKNOWN;
imageDirty[driveNum] = false;
+ writeProtected[driveNum] = false;
imageName[driveNum][0] = 0; // Zero out filenames
memset(nybblizedImage[driveNum], 0xFF, 232960); // Doesn't matter if 00s or FFs...
-
}
bool FloppyDrive::DriveIsEmpty(uint8 driveNum/*= 0*/)
{
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted DriveIsEmtpy() for drive #%u!\n", driveNum);
+ return true;
+ }
+
// This is kinda gay, but it works
return (imageName[driveNum][0] == 0 ? true : false);
}
+bool FloppyDrive::DiskIsWriteProtected(uint8 driveNum/*= 0*/)
+{
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted DiskIsWriteProtected() for drive #%u!\n", driveNum);
+ return true;
+ }
+
+ return writeProtected[driveNum];
+}
+
+void FloppyDrive::SetWriteProtect(bool state, uint8 driveNum/*= 0*/)
+{
+ if (driveNum > 1)
+ {
+ WriteLog("FLOPPY: Attempted set write protect for drive #%u!\n", driveNum);
+ return;
+ }
+
+ writeProtected[driveNum] = state;
+}
+
// Memory mapped I/O functions
*/
if (ioMode == IO_MODE_WRITE && (latchValue & 0x80))
{
- nybblizedImage[activeDrive][(track * 6656) + currentPos] = latchValue;
- imageDirty[activeDrive] = true;
+ // Does it behave like this?
+#warning "Write protection kludged in--investigate real behavior!"
+ if (!writeProtected[activeDrive])
+ {
+ nybblizedImage[activeDrive][(track * 6656) + currentPos] = latchValue;
+ imageDirty[activeDrive] = true;
+ }
}
uint8 diskByte = nybblizedImage[activeDrive][(track * 6656) + currentPos];