From 69fa53ab7d641194b96c90d190685fbc13d75f4c Mon Sep 17 00:00:00 2001 From: tomcw Date: Wed, 5 Oct 2022 21:29:57 +0100 Subject: [PATCH] Add command line: '-sN diskii13' to force the diskii card (in slot-N) to use the 13-sector firmware (#1133) --- source/CmdLine.cpp | 5 +++++ source/CmdLine.h | 11 +++++++++++ source/Disk.cpp | 6 +++++- source/Disk.h | 2 ++ source/Windows/AppleWin.cpp | 6 ++++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/source/CmdLine.cpp b/source/CmdLine.cpp index 8ac04d56..bcac6e85 100644 --- a/source/CmdLine.cpp +++ b/source/CmdLine.cpp @@ -167,6 +167,11 @@ bool ProcessCmdLine(LPSTR lpCmdLine) g_cmdLine.bSlotEmpty[slot] = true; if (strcmp(lpCmdLine, "diskii") == 0) g_cmdLine.slotInsert[slot] = CT_Disk2; + if (strcmp(lpCmdLine, "diskii13") == 0) + { + g_cmdLine.slotInsert[slot] = CT_Disk2; + g_cmdLine.slotInfo[slot].isDiskII13 = true; + } if (strcmp(lpCmdLine, "parallel") == 0) { if (slot == SLOT1) diff --git a/source/CmdLine.h b/source/CmdLine.h index 0532cb42..87b2b7de 100644 --- a/source/CmdLine.h +++ b/source/CmdLine.h @@ -9,6 +9,16 @@ struct CmdLine { + struct SlotInfo + { + SlotInfo() + { + isDiskII13 = false; + } + + bool isDiskII13; + }; + CmdLine() { bShutdown = false; @@ -66,6 +76,7 @@ struct CmdLine bool enableDumpToRealPrinter; bool noDisk2StepperDefer; // debug SS_CARDTYPE slotInsert[NUM_SLOTS]; + SlotInfo slotInfo[NUM_SLOTS]; LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES]; bool driveConnected[NUM_SLOTS][NUM_DRIVES]; LPCSTR szImageName_harddisk[NUM_HARDDISKS]; diff --git a/source/Disk.cpp b/source/Disk.cpp index d8260065..7ffa4b72 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -73,6 +73,7 @@ Disk2InterfaceCard::Disk2InterfaceCard(UINT slot) : m_diskLastReadLatchCycle = 0; m_enhanceDisk = true; m_is13SectorFirmware = false; + m_force13SectorFirmware = false; m_deferredStepperEvent = false; m_deferredStepperAddress = 0; m_deferredStepperCumulativeCycles = 0; @@ -2004,7 +2005,10 @@ void Disk2InterfaceCard::InitFirmware(LPBYTE pCxRomPeripheral) ImageInfo* pImage = m_floppyDrive[DRIVE_1].m_disk.m_imagehandle; - m_is13SectorFirmware = ImageIsBootSectorFormatSector13(pImage); + if (m_force13SectorFirmware) + m_is13SectorFirmware = true; + else + m_is13SectorFirmware = ImageIsBootSectorFormatSector13(pImage); if (m_is13SectorFirmware) memcpy(pCxRomPeripheral + m_slot*APPLE_SLOT_SIZE, m_13SectorFirmware, DISK2_FW_SIZE); diff --git a/source/Disk.h b/source/Disk.h index 3c4a3839..5f192f23 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -173,6 +173,7 @@ public: bool UserSelectNewDiskImage(const int drive, LPCSTR pszFilename=""); bool DriveSwap(void); bool IsDriveConnected(int drive) { return m_floppyDrive[drive].m_isConnected; } + void SetFirmware13Sector(void) { m_force13SectorFirmware = true; } static const std::string& GetSnapshotCardName(void); virtual void SaveSnapshot(YamlSaveHelper& yamlSaveHelper); @@ -250,6 +251,7 @@ private: BYTE m_13SectorFirmware[DISK2_FW_SIZE]; BYTE m_16SectorFirmware[DISK2_FW_SIZE]; bool m_is13SectorFirmware; + bool m_force13SectorFirmware; WORD m_currDrive; FloppyDrive m_floppyDrive[NUM_DRIVES]; diff --git a/source/Windows/AppleWin.cpp b/source/Windows/AppleWin.cpp index 7d96722c..e00a360a 100644 --- a/source/Windows/AppleWin.cpp +++ b/source/Windows/AppleWin.cpp @@ -789,6 +789,12 @@ static void RepeatInitialization(void) GetCardMgr().Insert(SLOT5, g_cmdLine.slotInsert[SLOT5]); } + for (UINT i = 0; i < NUM_SLOTS; i++) + { + if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13) + dynamic_cast(GetCardMgr().GetRef(i)).SetFirmware13Sector(); + } + // Create window after inserting/removing VidHD card (as it affects width & height) { Win32Frame::GetWin32Frame().SetViewportScale(Win32Frame::GetWin32Frame().GetViewportScale(), true);