Debugger: F2 or Ctrl+F2 whilst debugger will immediately stop the drive spinning (allowing disk swap) (fixed #460)

This commit is contained in:
tomcw 2017-08-11 21:45:07 +01:00
parent dd510801fc
commit 8fce7a8753
3 changed files with 15 additions and 5 deletions

View File

@ -811,12 +811,12 @@ static void __stdcall DiskReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULO
// https://github.com/AppleWin/AppleWin/issues/201
// NB. Prevent flooding of forcing UI to redraw!!!
if( ((fptr->byte) & 0xFF) == 0 )
FrameDrawDiskStatus( (HDC)0 );
FrameDrawDiskStatus( (HDC)0 );
}
//===========================================================================
void DiskReset(void)
void DiskReset(const bool bIsPowerCycle/*=false*/)
{
// RESET forces all switches off (UTAIIe Table 9.1)
currdrive = 0;
@ -824,6 +824,16 @@ void DiskReset(void)
floppyloadmode = 0;
floppywritemode = 0;
phases = 0;
if (bIsPowerCycle) // GH#460 - Ctrl+Reset whilst debugging acts like a power-cycle
{
g_aFloppyDisk[DRIVE_1].spinning = 0;
g_aFloppyDisk[DRIVE_1].writelight = 0;
g_aFloppyDisk[DRIVE_2].spinning = 0;
g_aFloppyDisk[DRIVE_2].writelight = 0;
FrameRefreshStatus(DRAW_LEDS,false);
}
}
//===========================================================================

View File

@ -57,7 +57,7 @@ void DiskGetLightStatus (Disk_Status_e *pDisk1Status_, Disk_Status_e *pDisk2S
ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
BOOL DiskIsSpinning(void);
void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error);
void DiskReset(void);
void DiskReset(const bool bIsPowerCycle=false);
bool DiskGetProtect(const int iDrive);
void DiskSetProtect(const int iDrive, const bool bWriteProtect);
int DiskGetCurrentDrive();

View File

@ -2036,7 +2036,7 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
// todo: consolidate CtrlReset() and ResetMachineState()
void ResetMachineState ()
{
DiskReset(); // Set floppymotoron=0
DiskReset(true); // Set floppymotoron=0
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
MemReset();
@ -2069,7 +2069,7 @@ void CtrlReset()
MemResetPaging();
PravetsReset();
DiskReset();
DiskReset(g_nAppMode == MODE_DEBUG); // For MODE_DEBUG act like a power-cycle (GH#460)
KeybReset();
if (!IS_APPLE2) // TODO: Why not for A][ & A][+ too?
VideoResetState(); // Switch Alternate char set off