diff --git a/Machines/Commodore/1540/C1540.cpp b/Machines/Commodore/1540/C1540.cpp index 091dfa991..79adb774e 100644 --- a/Machines/Commodore/1540/C1540.cpp +++ b/Machines/Commodore/1540/C1540.cpp @@ -104,7 +104,8 @@ void Machine::set_rom(const uint8_t *rom) void Machine::run_for_cycles(int number_of_cycles) { CPU6502::Processor::run_for_cycles(number_of_cycles); - Storage::DiskDrive::run_for_cycles(number_of_cycles); + if(_driveVIA.get_motor_enabled()) // TODO: motor speed up/down + Storage::DiskDrive::run_for_cycles(number_of_cycles); } #pragma mark - 6522 delegate diff --git a/Machines/Commodore/1540/C1540.hpp b/Machines/Commodore/1540/C1540.hpp index 99c003abd..e377fd8ad 100644 --- a/Machines/Commodore/1540/C1540.hpp +++ b/Machines/Commodore/1540/C1540.hpp @@ -136,6 +136,10 @@ class DriveVIA: public MOS::MOS6522, public MOS::MOS6522IRQDelegate { return _should_set_overflow; } + bool get_motor_enabled() { + return _drive_motor; + } + void set_control_line_output(Port port, Line line, bool value) { if(port == Port::A && line == Line::Two) { _should_set_overflow = value; @@ -145,10 +149,10 @@ class DriveVIA: public MOS::MOS6522, public MOS::MOS6522IRQDelegate { void set_port_output(Port port, uint8_t value, uint8_t direction_mask) { if(port) { + _drive_motor = !!(value&4); // if(value&4) // { -// printf("Head step: %d\n", value&3); -// printf("Motor: %s\n", value&4 ? "On" : "Off"); + printf("Head step: %d\n", value&3); // printf("LED: %s\n", value&8 ? "On" : "Off"); // printf("Density: %d\n", (value >> 5)&3); // } @@ -158,6 +162,7 @@ class DriveVIA: public MOS::MOS6522, public MOS::MOS6522IRQDelegate { private: uint8_t _port_b, _port_a; bool _should_set_overflow; + bool _drive_motor; }; /*!