1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-03 11:30:02 +00:00

Adds activity lights for Macintosh disk activity.

Prompting a quick fix to drives not spinning down.
This commit is contained in:
Thomas Harte 2019-08-02 16:26:23 -04:00
parent c8177af45a
commit 96005261c7
4 changed files with 23 additions and 2 deletions

View File

@ -399,3 +399,8 @@ void IWM::set_component_prefers_clocking(ClockingHint::Source *component, Clocki
drive_is_rotating_[1] = is_rotating;
}
}
void IWM::set_activity_observer(Activity::Observer *observer) {
if(drives_[0]) drives_[0]->set_activity_observer(observer, "Internal Drive", true);
if(drives_[1]) drives_[1]->set_activity_observer(observer, "External Drive", true);
}

View File

@ -9,8 +9,11 @@
#ifndef IWM_hpp
#define IWM_hpp
#include "../../Activity/Observer.hpp"
#include "../../ClockReceiver/ClockReceiver.hpp"
#include "../../ClockReceiver/ClockingHintSource.hpp"
#include "../../Storage/Disk/Drive.hpp"
#include <cstdint>
@ -67,6 +70,10 @@ class IWM:
/// Connects a drive to the IWM.
void set_drive(int slot, IWMDrive *drive);
/// Registers the currently-connected drives as @c Activity::Sources ;
/// the first will be declared 'Internal', the second 'External'.
void set_activity_observer(Activity::Observer *observer);
private:
// Storage::Disk::Drive::EventDelegate.
void process_event(const Storage::Disk::Drive::Event &event) override;

View File

@ -71,7 +71,9 @@ void DoubleDensityDrive::set_rotation_speed(float revolutions_per_minute) {
// MARK: - Control input/output.
void DoubleDensityDrive::set_enabled(bool) {
void DoubleDensityDrive::set_enabled(bool enabled) {
// Disabling a drive also stops its motor.
if(!enabled) set_motor_on(false);
}
void DoubleDensityDrive::set_control_lines(int lines) {

View File

@ -16,6 +16,7 @@
#include "RealTimeClock.hpp"
#include "Video.hpp"
#include "../../../Activity/Source.hpp"
#include "../../CRTMachine.hpp"
#include "../../KeyboardMachine.hpp"
#include "../../MediaTarget.hpp"
@ -55,7 +56,8 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
public MouseMachine::Machine,
public CPU::MC68000::BusHandler,
public KeyboardMachine::MappedMachine,
public Zilog::SCC::z8530::Delegate {
public Zilog::SCC::z8530::Delegate,
public Activity::Source {
public:
using Target = Analyser::Static::Macintosh::Target;
@ -460,6 +462,11 @@ template <Analyser::Static::Macintosh::Target::Model model> class ConcreteMachin
}
}
// MARK: - Activity Source
void set_activity_observer(Activity::Observer *observer) override {
iwm_.iwm.set_activity_observer(observer);
}
private:
void update_video() {
video_.run_for(time_since_video_update_.flush<HalfCycles>());