mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-21 07:17:41 +00:00
Support 2nd Disk][ in slot-5, via command line: - -s5 diskii - -s5d1 \<imagefile\> - -s5d2 \<imagefile\> NB. there's currently no Configuration UI support, except the Drive icons' tooltips show what's in slot-5 & slot-6 (for drive-n). So there's no way to eject the disks or insert new disks. The use-case I'm supporting it Wasteland which just has the 4 disks in the 4 drives. Improved card management: - Added `class Card` (in Card.h) which all other cards (that exist as classes) derive from (eg. LC,SSC,Mouse,Disk2). - Added `class CardManager` (in CardManager.cpp\h) which now manages the 8 slots (and aux slot). - Added `class Disk2CardManager` (in Disk2CardManager.cpp\h) which provides methods for operations that act on all Disk2 instances at the same time. - Currently limited to just 1x SSC and 1x Mouse card (why would you need more?). This simplifies things, meaning there's no need to have dedicated SSCManager / MouseCardManager objects. - Currently the 2nd Disk2 card can only be put into slot-5. This limitation is just due to the complexity of the Configuration UI. Having a more general drop-down per slot UI would remove this limitation.
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
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.GetObj(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.GetObj(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.GetObj(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.GetObj(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.GetObj(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.GetObj(i))->LoadLastDiskImage(DRIVE_1);
|
||||
dynamic_cast<Disk2InterfaceCard*>(g_CardMgr.GetObj(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.GetObj(i))->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user