mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
HDD error wasn't cleared on a reset or power-cycle - fixes #515
This commit is contained in:
parent
a551af020d
commit
5505ff696f
@ -1270,6 +1270,8 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call DiskReset():
|
||||
DiskReset(); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
||||
LogFileOutput("Main: DiskReset()\n");
|
||||
HD_Reset(); // GH#515
|
||||
LogFileOutput("Main: HDDReset()\n");
|
||||
|
||||
if (!bSysClkOK)
|
||||
{
|
||||
@ -1365,7 +1367,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
||||
LogFileOutput("Main: MB_Reset()\n");
|
||||
|
||||
sg_Mouse.Uninitialize(); // Maybe restarting due to switching slot-4 card from MouseCard to Mockingboard
|
||||
sg_Mouse.Reset();
|
||||
sg_Mouse.Reset(); // Deassert any pending IRQs - GH#514
|
||||
LogFileOutput("Main: sg_Mouse.Uninitialize()\n");
|
||||
|
||||
DSUninit();
|
||||
|
@ -558,9 +558,6 @@ void DiskInitialize(void)
|
||||
int loop = NUM_DRIVES;
|
||||
while (loop--)
|
||||
ZeroMemory(&g_aFloppyDisk[loop], sizeof(Disk_t));
|
||||
|
||||
TCHAR imagefilename[MAX_PATH];
|
||||
_tcscpy(imagefilename,g_sProgramDir);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -2139,8 +2139,8 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
|
||||
|
||||
// CtrlReset() vs ResetMachineState():
|
||||
// . CPU:
|
||||
// Ctrl+Reset : sp=-3 / CpuReset()
|
||||
// Power cycle: sp=0x1ff / CpuInitialize()
|
||||
// Ctrl+Reset : 6502.sp=-3 / CpuReset()
|
||||
// Power cycle: 6502.sp=0x1ff / CpuInitialize()
|
||||
// . Disk][:
|
||||
// Ctrl+Reset : if motor-on, then motor-off but continue to spin for 1s
|
||||
// Power cycle: motor-off & immediately stop spinning
|
||||
@ -2149,6 +2149,7 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
|
||||
void ResetMachineState ()
|
||||
{
|
||||
DiskReset(true);
|
||||
HD_Reset();
|
||||
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
|
||||
|
||||
MemReset(); // calls CpuInitialize()
|
||||
@ -2182,11 +2183,13 @@ void CtrlReset()
|
||||
|
||||
PravetsReset();
|
||||
DiskReset();
|
||||
HD_Reset();
|
||||
KeybReset();
|
||||
if (!IS_APPLE2) // TODO: Why not for A][ & A][+ too?
|
||||
VideoResetState(); // Switch Alternate char set off
|
||||
sg_SSC.CommReset();
|
||||
MB_Reset();
|
||||
sg_Mouse.Reset(); // Deassert any pending IRQs - GH#514
|
||||
#ifdef USE_SPEECH_API
|
||||
g_Speech.Reset();
|
||||
#endif
|
||||
|
@ -289,6 +289,15 @@ static LPCTSTR HD_DiskGetBaseName(const int iDrive) // Not used
|
||||
return g_HardDisk[iDrive].imagename;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
void HD_Reset(void)
|
||||
{
|
||||
g_HardDisk[HARDDISK_1].hd_error = 0;
|
||||
g_HardDisk[HARDDISK_2].hd_error = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
void HD_Load_Rom(const LPBYTE pCxRomPeripheral, const UINT uSlot)
|
||||
|
@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
void HD_SetEnabled(const bool bEnabled);
|
||||
LPCTSTR HD_GetFullName(const int iDrive);
|
||||
LPCTSTR HD_GetFullPathName(const int iDrive);
|
||||
void HD_Reset(void);
|
||||
void HD_Load_Rom(const LPBYTE pCxRomPeripheral, const UINT uSlot);
|
||||
bool HD_Select(const int iDrive);
|
||||
void HD_Unplug(const int iDrive);
|
||||
|
@ -171,6 +171,7 @@ static void Snapshot_LoadState_v1() // .aws v1.0.0.1, up to (and including) Appl
|
||||
// Reset all sub-systems
|
||||
MemReset();
|
||||
DiskReset();
|
||||
HD_Reset();
|
||||
KeybReset();
|
||||
VideoResetState();
|
||||
MB_Reset();
|
||||
@ -492,6 +493,7 @@ static void Snapshot_LoadState_v2(void)
|
||||
MemReset();
|
||||
PravetsReset();
|
||||
DiskReset();
|
||||
HD_Reset();
|
||||
KeybReset();
|
||||
VideoResetState();
|
||||
MB_Reset();
|
||||
|
Loading…
Reference in New Issue
Block a user