AppleWin/source/Disk2CardManager.cpp
TomCh 21d16d3a0c
Auto-switch DiskII firmware to 13 or 16 sector depending on disk in drive-1 (#734) (PR #761)
. The auto-switch is done on each reset, or on inserting a disk at the start-up screen (MODE_LOGO).
. The Window's title include '(S6-13)' if DiskII card has 13-sector f/w.
. The debugger's 'disk info' cmd will show FW13 or FW16 depending on f/w.
2020-02-22 11:38:25 +00:00

135 lines
3.3 KiB
C++

/*
AppleWin : An Apple //e emulator for Windows
Copyright (C) 1994-1996, Michael O'Brien
Copyright (C) 1999-2001, Oliver Schmidt
Copyright (C) 2002-2005, Tom Charlesworth
Copyright (C) 2006-2019, Tom Charlesworth, Michael Pohoreski, Nick Westgate
AppleWin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
AppleWin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Description: Disk2 Card Manager
*
* Author: Various
*
*/
#include "StdAfx.h"
#include "AppleWin.h"
#include "CardManager.h"
#include "Disk.h"
#include "Disk2CardManager.h"
bool Disk2CardManager::IsConditionForFullSpeed(void)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).IsConditionForFullSpeed())
return true; // if any card is true then the condition for full-speed is true
}
}
return false;
}
void Disk2CardManager::UpdateDriveState(UINT cycles)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).UpdateDriveState(cycles);
}
}
}
void Disk2CardManager::Reset(const bool powerCycle /*=false*/)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).Reset(powerCycle);
}
}
}
bool Disk2CardManager::GetEnhanceDisk(void)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
// All Disk2 cards should have the same setting, so just return the state of the first card
return dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetEnhanceDisk();
}
}
return false;
}
void Disk2CardManager::SetEnhanceDisk(bool enhanceDisk)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).SetEnhanceDisk(enhanceDisk);
}
}
}
void Disk2CardManager::LoadLastDiskImage(void)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (i != SLOT6) continue; // FIXME
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).LoadLastDiskImage(DRIVE_1);
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).LoadLastDiskImage(DRIVE_2);
}
}
}
void Disk2CardManager::Destroy(void)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).Destroy();
}
}
}
bool Disk2CardManager::IsAnyFirmware13Sector(void)
{
for (UINT i = 0; i < NUM_SLOTS; i++)
{
if (g_CardMgr.QuerySlot(i) == CT_Disk2)
{
// If any Disk2 card has 13-sector firmware then return true
if (dynamic_cast<Disk2InterfaceCard&>(g_CardMgr.GetRef(i)).GetCurrentFirmware() == 13)
return true;
}
}
return false;
}