1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Adds a one second delay between controller and drive motor off.

This commit is contained in:
Thomas Harte 2018-08-03 21:13:18 -04:00
parent 78c7137427
commit 70c4d6b9b3
2 changed files with 15 additions and 2 deletions

View File

@ -120,6 +120,15 @@ void DiskII::run_for(const Cycles cycles) {
if(!drive_is_sleeping_[1]) drives_[1].run_for(Cycles(1));
}
// Per comp.sys.apple2.programmer there is a delay between the controller
// motor switch being flipped and the drive motor actually switching off.
// This models that, accepting overrun as a risk.
if(motor_off_time_ >= 0) {
motor_off_time_ -= cycles.as_int();
if(motor_off_time_ < 0) {
set_control(Control::Motor, false);
}
}
decide_clocking_preference();
}
@ -238,9 +247,12 @@ int DiskII::read_address(int address) {
case 0x8:
shift_register_ = 0;
set_control(Control::Motor, false);
motor_off_time_ = clock_rate_;
break;
case 0x9:
set_control(Control::Motor, true);
motor_off_time_ = -1;
break;
case 0x9: set_control(Control::Motor, true); break;
case 0xa: select_drive(0); break;
case 0xb: select_drive(1); break;

View File

@ -109,6 +109,7 @@ class DiskII:
int stepper_mask_ = 0;
int stepper_position_ = 0;
int motor_off_time_ = -1;
bool is_write_protected();
std::array<uint8_t, 256> state_machine_;