mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-01 14:41:33 +00:00
Add command line support for hard disk controller (hdc) in slot-5 (#1033)
. -s5 hdc . -s5h1 <pathname> NB. No GUI config support, so no way to plug/unplug HDDs.
This commit is contained in:
parent
0d0adc1f22
commit
d612972e6c
|
@ -148,13 +148,13 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
{
|
{
|
||||||
lpCmdLine = GetCurrArg(lpNextArg);
|
lpCmdLine = GetCurrArg(lpNextArg);
|
||||||
lpNextArg = GetNextArg(lpNextArg);
|
lpNextArg = GetNextArg(lpNextArg);
|
||||||
g_cmdLine.szImageName_harddisk[HARDDISK_1] = lpCmdLine;
|
g_cmdLine.szImageName_harddisk[SLOT7][HARDDISK_1] = lpCmdLine;
|
||||||
}
|
}
|
||||||
else if (strcmp(lpCmdLine, "-h2") == 0)
|
else if (strcmp(lpCmdLine, "-h2") == 0)
|
||||||
{
|
{
|
||||||
lpCmdLine = GetCurrArg(lpNextArg);
|
lpCmdLine = GetCurrArg(lpNextArg);
|
||||||
lpNextArg = GetNextArg(lpNextArg);
|
lpNextArg = GetNextArg(lpNextArg);
|
||||||
g_cmdLine.szImageName_harddisk[HARDDISK_2] = lpCmdLine;
|
g_cmdLine.szImageName_harddisk[SLOT7][HARDDISK_2] = lpCmdLine;
|
||||||
}
|
}
|
||||||
else if (lpCmdLine[0] == '-' && lpCmdLine[1] == 's' && lpCmdLine[2] >= '1' && lpCmdLine[2] <= '7')
|
else if (lpCmdLine[0] == '-' && lpCmdLine[1] == 's' && lpCmdLine[2] >= '1' && lpCmdLine[2] <= '7')
|
||||||
{
|
{
|
||||||
|
@ -173,6 +173,8 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
g_cmdLine.slotInsert[slot] = CT_Disk2;
|
g_cmdLine.slotInsert[slot] = CT_Disk2;
|
||||||
g_cmdLine.slotInfo[slot].isDiskII13 = true;
|
g_cmdLine.slotInfo[slot].isDiskII13 = true;
|
||||||
}
|
}
|
||||||
|
if (strcmp(lpCmdLine, "hdc") == 0)
|
||||||
|
g_cmdLine.slotInsert[slot] = CT_GenericHDD;
|
||||||
if (strcmp(lpCmdLine, "parallel") == 0)
|
if (strcmp(lpCmdLine, "parallel") == 0)
|
||||||
{
|
{
|
||||||
if (slot == SLOT1)
|
if (slot == SLOT1)
|
||||||
|
@ -199,7 +201,7 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
{
|
{
|
||||||
const UINT drive = lpCmdLine[4] == '1' ? DRIVE_1 : DRIVE_2;
|
const UINT drive = lpCmdLine[4] == '1' ? DRIVE_1 : DRIVE_2;
|
||||||
|
|
||||||
if (slot != 5 && slot != 6)
|
if (slot != SLOT5 && slot != SLOT6)
|
||||||
{
|
{
|
||||||
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
|
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
|
||||||
}
|
}
|
||||||
|
@ -210,6 +212,21 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
||||||
g_cmdLine.szImageName_drive[slot][drive] = lpCmdLine;
|
g_cmdLine.szImageName_drive[slot][drive] = lpCmdLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (lpCmdLine[3] == 'h' && (lpCmdLine[4] == '1' || lpCmdLine[4] == '2')) // -s[1..7]h[1|2] <dsk-image>
|
||||||
|
{
|
||||||
|
const UINT drive = lpCmdLine[4] == '1' ? HARDDISK_1 : HARDDISK_2;
|
||||||
|
|
||||||
|
if (slot != SLOT5 && slot != SLOT7)
|
||||||
|
{
|
||||||
|
LogFileOutput("Unsupported arg: %s\n", lpCmdLine);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lpCmdLine = GetCurrArg(lpNextArg);
|
||||||
|
lpNextArg = GetNextArg(lpNextArg);
|
||||||
|
g_cmdLine.szImageName_harddisk[slot][drive] = lpCmdLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (strcmp(lpCmdLine, "-s7-empty-on-exit") == 0)
|
else if (strcmp(lpCmdLine, "-s7-empty-on-exit") == 0)
|
||||||
{
|
{
|
||||||
g_cmdLine.bSlot7EmptyOnExit = true;
|
g_cmdLine.bSlot7EmptyOnExit = true;
|
||||||
|
|
|
@ -33,8 +33,6 @@ struct CmdLine
|
||||||
supportDCD = false;
|
supportDCD = false;
|
||||||
enableDumpToRealPrinter = false;
|
enableDumpToRealPrinter = false;
|
||||||
noDisk2StepperDefer = false;
|
noDisk2StepperDefer = false;
|
||||||
szImageName_harddisk[HARDDISK_1] = NULL;
|
|
||||||
szImageName_harddisk[HARDDISK_2] = NULL;
|
|
||||||
szSnapshotName = NULL;
|
szSnapshotName = NULL;
|
||||||
szScreenshotFilename = NULL;
|
szScreenshotFilename = NULL;
|
||||||
uRamWorksExPages = 0;
|
uRamWorksExPages = 0;
|
||||||
|
@ -60,6 +58,8 @@ struct CmdLine
|
||||||
szImageName_drive[i][DRIVE_2] = NULL;
|
szImageName_drive[i][DRIVE_2] = NULL;
|
||||||
driveConnected[i][DRIVE_1] = true;
|
driveConnected[i][DRIVE_1] = true;
|
||||||
driveConnected[i][DRIVE_2] = true;
|
driveConnected[i][DRIVE_2] = true;
|
||||||
|
szImageName_harddisk[i][HARDDISK_1] = NULL;
|
||||||
|
szImageName_harddisk[i][HARDDISK_2] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ struct CmdLine
|
||||||
SlotInfo slotInfo[NUM_SLOTS];
|
SlotInfo slotInfo[NUM_SLOTS];
|
||||||
LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES];
|
LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES];
|
||||||
bool driveConnected[NUM_SLOTS][NUM_DRIVES];
|
bool driveConnected[NUM_SLOTS][NUM_DRIVES];
|
||||||
LPCSTR szImageName_harddisk[NUM_HARDDISKS];
|
LPCSTR szImageName_harddisk[NUM_SLOTS][NUM_HARDDISKS];
|
||||||
LPSTR szSnapshotName;
|
LPSTR szSnapshotName;
|
||||||
LPSTR szScreenshotFilename;
|
LPSTR szScreenshotFilename;
|
||||||
UINT uRamWorksExPages;
|
UINT uRamWorksExPages;
|
||||||
|
|
|
@ -129,7 +129,7 @@ Overview
|
||||||
HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) :
|
HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) :
|
||||||
Card(CT_GenericHDD, slot)
|
Card(CT_GenericHDD, slot)
|
||||||
{
|
{
|
||||||
if (m_slot != SLOT7) // fixme
|
if (m_slot != SLOT5 && m_slot != SLOT7) // fixme
|
||||||
ThrowErrorInvalidSlot();
|
ThrowErrorInvalidSlot();
|
||||||
|
|
||||||
m_unitNum = HARDDISK_1 << 7; // b7=unit
|
m_unitNum = HARDDISK_1 << 7; // b7=unit
|
||||||
|
|
|
@ -371,22 +371,22 @@ static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool DoHardDiskInsert(const int nDrive, LPCSTR szFileName)
|
static bool DoHardDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
|
||||||
{
|
{
|
||||||
_ASSERT(GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD);
|
_ASSERT(GetCardMgr().QuerySlot(slot) == CT_GenericHDD);
|
||||||
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
|
if (GetCardMgr().QuerySlot(slot) != CT_GenericHDD)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (szFileName[0] == '\0')
|
if (szFileName[0] == '\0')
|
||||||
{
|
{
|
||||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Unplug(nDrive);
|
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).Unplug(nDrive);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string strPathName = GetFullPath(szFileName);
|
std::string strPathName = GetFullPath(szFileName);
|
||||||
if (strPathName.empty()) return false;
|
if (strPathName.empty()) return false;
|
||||||
|
|
||||||
BOOL bRes = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Insert(nDrive, strPathName);
|
BOOL bRes = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).Insert(nDrive, strPathName);
|
||||||
bool res = (bRes == TRUE);
|
bool res = (bRes == TRUE);
|
||||||
if (res)
|
if (res)
|
||||||
SetCurrentDir(strPathName);
|
SetCurrentDir(strPathName);
|
||||||
|
@ -425,19 +425,21 @@ void InsertFloppyDisks(const UINT slot, LPCSTR szImageName_drive[NUM_DRIVES], bo
|
||||||
GetFrame().FrameMessageBox("Failed to insert floppy disk(s) - see log file", "Warning", MB_ICONASTERISK | MB_OK);
|
GetFrame().FrameMessageBox("Failed to insert floppy disk(s) - see log file", "Warning", MB_ICONASTERISK | MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertHardDisks(LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
|
void InsertHardDisks(const UINT slot, LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
|
||||||
{
|
{
|
||||||
|
_ASSERT(slot == 5 || slot == 7);
|
||||||
|
|
||||||
if (!szImageName_harddisk[HARDDISK_1] && !szImageName_harddisk[HARDDISK_2])
|
if (!szImageName_harddisk[HARDDISK_1] && !szImageName_harddisk[HARDDISK_2])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
|
if (GetCardMgr().QuerySlot(slot) != CT_GenericHDD)
|
||||||
GetCardMgr().Insert(SLOT7, CT_GenericHDD); // Enable the Harddisk controller card
|
GetCardMgr().Insert(slot, CT_GenericHDD); // Enable the Harddisk controller card
|
||||||
|
|
||||||
bool bRes = true;
|
bool bRes = true;
|
||||||
|
|
||||||
if (szImageName_harddisk[HARDDISK_1])
|
if (szImageName_harddisk[HARDDISK_1])
|
||||||
{
|
{
|
||||||
bRes = DoHardDiskInsert(HARDDISK_1, szImageName_harddisk[HARDDISK_1]);
|
bRes = DoHardDiskInsert(slot, HARDDISK_1, szImageName_harddisk[HARDDISK_1]);
|
||||||
LogFileOutput("Init: DoHardDiskInsert(HDD1), res=%d\n", bRes);
|
LogFileOutput("Init: DoHardDiskInsert(HDD1), res=%d\n", bRes);
|
||||||
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS); // harddisk activity LED
|
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_DISK_STATUS); // harddisk activity LED
|
||||||
bBoot = true;
|
bBoot = true;
|
||||||
|
@ -445,7 +447,7 @@ void InsertHardDisks(LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
|
||||||
|
|
||||||
if (szImageName_harddisk[HARDDISK_2])
|
if (szImageName_harddisk[HARDDISK_2])
|
||||||
{
|
{
|
||||||
bRes &= DoHardDiskInsert(HARDDISK_2, szImageName_harddisk[HARDDISK_2]);
|
bRes &= DoHardDiskInsert(slot, HARDDISK_2, szImageName_harddisk[HARDDISK_2]);
|
||||||
LogFileOutput("Init: DoHardDiskInsert(HDD2), res=%d\n", bRes);
|
LogFileOutput("Init: DoHardDiskInsert(HDD2), res=%d\n", bRes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
void LoadConfiguration(bool loadImages);
|
void LoadConfiguration(bool loadImages);
|
||||||
void InsertFloppyDisks(const UINT slot, LPCSTR szImageName_drive[NUM_DRIVES], bool driveConnected[NUM_DRIVES], bool& bBoot);
|
void InsertFloppyDisks(const UINT slot, LPCSTR szImageName_drive[NUM_DRIVES], bool driveConnected[NUM_DRIVES], bool& bBoot);
|
||||||
void InsertHardDisks(LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot);
|
void InsertHardDisks(const UINT slot, LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot);
|
||||||
void GetAppleWindowTitle();
|
void GetAppleWindowTitle();
|
||||||
|
|
||||||
void CtrlReset();
|
void CtrlReset();
|
||||||
|
|
|
@ -787,6 +787,12 @@ static void RepeatInitialization(void)
|
||||||
GetCardMgr().Insert(SLOT6, g_cmdLine.slotInsert[SLOT6]);
|
GetCardMgr().Insert(SLOT6, g_cmdLine.slotInsert[SLOT6]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_cmdLine.slotInsert[SLOT7] != CT_Empty)
|
||||||
|
{
|
||||||
|
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD) // Ignore if already got HDC in slot 7
|
||||||
|
GetCardMgr().Insert(SLOT7, g_cmdLine.slotInsert[SLOT7]);
|
||||||
|
}
|
||||||
|
|
||||||
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
|
for (UINT i = SLOT0; i < NUM_SLOTS; i++)
|
||||||
{
|
{
|
||||||
if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13)
|
if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13)
|
||||||
|
@ -835,8 +841,11 @@ static void RepeatInitialization(void)
|
||||||
InsertFloppyDisks(SLOT6, g_cmdLine.szImageName_drive[SLOT6], g_cmdLine.driveConnected[SLOT6], g_cmdLine.bBoot);
|
InsertFloppyDisks(SLOT6, g_cmdLine.szImageName_drive[SLOT6], g_cmdLine.driveConnected[SLOT6], g_cmdLine.bBoot);
|
||||||
g_cmdLine.szImageName_drive[SLOT6][DRIVE_1] = g_cmdLine.szImageName_drive[SLOT6][DRIVE_2] = NULL; // Don't insert on a restart
|
g_cmdLine.szImageName_drive[SLOT6][DRIVE_1] = g_cmdLine.szImageName_drive[SLOT6][DRIVE_2] = NULL; // Don't insert on a restart
|
||||||
|
|
||||||
InsertHardDisks(g_cmdLine.szImageName_harddisk, g_cmdLine.bBoot);
|
InsertHardDisks(SLOT5, g_cmdLine.szImageName_harddisk[SLOT5], temp);
|
||||||
g_cmdLine.szImageName_harddisk[HARDDISK_1] = g_cmdLine.szImageName_harddisk[HARDDISK_2] = NULL; // Don't insert on a restart
|
g_cmdLine.szImageName_harddisk[SLOT5][HARDDISK_1] = g_cmdLine.szImageName_harddisk[SLOT5][HARDDISK_2] = NULL; // Don't insert on a restart
|
||||||
|
|
||||||
|
InsertHardDisks(SLOT7, g_cmdLine.szImageName_harddisk[SLOT7], g_cmdLine.bBoot);
|
||||||
|
g_cmdLine.szImageName_harddisk[SLOT7][HARDDISK_1] = g_cmdLine.szImageName_harddisk[SLOT7][HARDDISK_2] = NULL; // Don't insert on a restart
|
||||||
|
|
||||||
if (g_cmdLine.bSlotEmpty[SLOT7])
|
if (g_cmdLine.bSlotEmpty[SLOT7])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user