MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / ControlMotor

Method ControlMotor

source/Disk.cpp:502–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500//===========================================================================
501
502void __stdcall Disk2InterfaceCard::ControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
503{
504 BOOL newState = address & 1;
505 bool stateChanged = (newState != m_floppyMotorOn);
506
507 // "2. [...] (DRIVES OFF forces the control flip-flops to clear.)" (UTAIIe page 9-12)
508 // - so m_magnetStates = 0.
509 // "5. Causes the ENABLE1' or the ENABLE2' signal to go low depending on which drive is selected by the drive1/drive2 switch."
510 // - so m_currDrive not affected.
511 // TODO: what about m_seqFunc.function?
512 if (newState == FALSE)
513 {
514 m_magnetStates = 0; // GH#926, GH#1315
515 ControlStepperLogging(address, g_nCumulativeCycles);
516 }
517
518 if (stateChanged)
519 {
520 m_floppyMotorOn = newState;
521 m_formatTrack.DriveNotWritingTrack();
522 }
523
524 // NB. Motor off doesn't reset the Command Decoder like reset. (UTAIIe figures 9.7 & 9.8 chip C2)
525 // - so it doesn't reset this state: m_seqFunc, m_magnetStates
526#if LOG_DISK_MOTOR
527 LOG_DISK("%08X: motor %s\r\n", (UINT32)g_nCumulativeCycles, (m_floppyMotorOn) ? "on" : "off");
528#endif
529 CheckSpinning(stateChanged, uExecutedCycles);
530}
531
532//===========================================================================
533

Callers 2

IOReadMethod · 0.80
IOWriteMethod · 0.80

Calls 1

DriveNotWritingTrackMethod · 0.80

Tested by

no test coverage detected