DiskII: Prevent stepper motor changing phase when motor is off (fixes #525)

This commit is contained in:
tomcw 2018-01-27 17:02:33 +00:00
parent 597843bc3a
commit b50da5a95b

View File

@ -365,6 +365,7 @@ static void __stdcall DiskControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uEx
g_formatTrack.DriveNotWritingTrack(); g_formatTrack.DriveNotWritingTrack();
floppymotoron = newState; floppymotoron = newState;
// TODO: should turning the motor off reset the state: floppyloadmode, floppywritemode, phases? Like DiskReset()
#if LOG_DISK_MOTOR #if LOG_DISK_MOTOR
LOG_DISK("motor %s\r\n", (floppymotoron) ? "on" : "off"); LOG_DISK("motor %s\r\n", (floppymotoron) ? "on" : "off");
#endif #endif
@ -375,6 +376,14 @@ static void __stdcall DiskControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uEx
static void __stdcall DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles) static void __stdcall DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
{ {
if (!floppymotoron) // GH#525
{
#if LOG_DISK_PHASES
LOG_DISK("stepper accessed whilst motor is off\r\n");
#endif
return;
}
Disk_t * fptr = &g_aFloppyDisk[currdrive]; Disk_t * fptr = &g_aFloppyDisk[currdrive];
int phase = (address >> 1) & 3; int phase = (address >> 1) & 3;
int phase_bit = (1 << phase); int phase_bit = (1 << phase);