mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-06 10:38:16 +00:00
Adds activity indicators for the BD-500 and Jasmin.
Also slightly cleans up DiskController a little further.
This commit is contained in:
parent
99122efbbc
commit
aac3d27c10
@ -824,6 +824,10 @@ void WD1770::set_head_loaded(bool head_loaded) {
|
||||
if(head_loaded) posit_event(int(Event1770::HeadLoad));
|
||||
}
|
||||
|
||||
bool WD1770::get_head_loaded() {
|
||||
return head_is_loaded_;
|
||||
}
|
||||
|
||||
ClockingHint::Preference WD1770::preferred_clocking() {
|
||||
if(status_.busy) return ClockingHint::Preference::RealTime;
|
||||
return Storage::Disk::MFMController::preferred_clocking();
|
||||
|
@ -80,6 +80,9 @@ class WD1770: public Storage::Disk::MFMController {
|
||||
virtual void set_motor_on(bool motor_on);
|
||||
void set_head_loaded(bool head_loaded);
|
||||
|
||||
/// @returns The last value posted to @c set_head_loaded.
|
||||
bool get_head_loaded();
|
||||
|
||||
private:
|
||||
Personality personality_;
|
||||
inline bool has_motor_on_line() { return (personality_ != P1793 ) && (personality_ != P1773); }
|
||||
|
@ -129,3 +129,18 @@ void BD500::run_for(const Cycles cycles) {
|
||||
|
||||
WD::WD1770::run_for(cycles);
|
||||
}
|
||||
|
||||
void BD500::set_activity_observer(Activity::Observer *observer) {
|
||||
observer_ = observer;
|
||||
if(observer) {
|
||||
observer->register_led("BD-500");
|
||||
observer_->set_led_status("BD-500", get_head_loaded());
|
||||
}
|
||||
}
|
||||
|
||||
void BD500::set_head_loaded(bool loaded) {
|
||||
WD::WD1770::set_head_loaded(loaded);
|
||||
if(observer_) {
|
||||
observer_->set_led_status("BD-500", loaded);
|
||||
}
|
||||
}
|
||||
|
@ -27,11 +27,15 @@ class BD500: public DiskController {
|
||||
|
||||
void run_for(const Cycles cycles);
|
||||
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
|
||||
private:
|
||||
void set_head_load_request(bool head_load) final;
|
||||
bool is_loading_head_ = false;
|
||||
Activity::Observer *observer_ = nullptr;
|
||||
|
||||
void access(int address);
|
||||
void set_head_loaded(bool loaded);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -44,14 +44,6 @@ class DiskController: public WD::WD1770 {
|
||||
}
|
||||
|
||||
protected:
|
||||
inline void set_paged_item(PagedItem item) {
|
||||
if(paged_item_ == item) return;
|
||||
paged_item_ = item;
|
||||
if(delegate_) {
|
||||
delegate_->disk_controller_did_change_paged_item(this);
|
||||
}
|
||||
}
|
||||
|
||||
std::array<std::shared_ptr<Storage::Disk::Drive>, 4> drives_;
|
||||
size_t selected_drive_;
|
||||
void select_drive(size_t drive) {
|
||||
@ -76,6 +68,13 @@ class DiskController: public WD::WD1770 {
|
||||
PagedItem paged_item_ = PagedItem::DiskROM;
|
||||
int clock_rate_;
|
||||
|
||||
inline void set_paged_item(PagedItem item) {
|
||||
if(paged_item_ == item) return;
|
||||
paged_item_ = item;
|
||||
if(delegate_) {
|
||||
delegate_->disk_controller_did_change_paged_item(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -56,4 +56,15 @@ void Jasmin::write(int address, uint8_t value) {
|
||||
void Jasmin::set_motor_on(bool on) {
|
||||
motor_on_ = on;
|
||||
if(drives_[selected_drive_]) drives_[selected_drive_]->set_motor_on(motor_on_);
|
||||
if(observer_) {
|
||||
observer_->set_led_status("Microdisc", on);
|
||||
}
|
||||
}
|
||||
|
||||
void Jasmin::set_activity_observer(Activity::Observer *observer) {
|
||||
observer_ = observer;
|
||||
if(observer) {
|
||||
observer->register_led("Jasmin");
|
||||
observer_->set_led_status("Jasmin", motor_on_);
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,6 @@
|
||||
#include "../../Activity/Observer.hpp"
|
||||
#include "DiskController.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
namespace Oric {
|
||||
|
||||
class Jasmin: public DiskController {
|
||||
@ -24,9 +21,13 @@ class Jasmin: public DiskController {
|
||||
|
||||
void write(int address, uint8_t value);
|
||||
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
|
||||
private:
|
||||
void set_motor_on(bool on) final;
|
||||
bool motor_on_ = false;
|
||||
|
||||
Activity::Observer *observer_ = nullptr;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -118,13 +118,4 @@ void Microdisc::set_activity_observer(Activity::Observer *observer) {
|
||||
observer->register_led("Microdisc");
|
||||
observer_->set_led_status("Microdisc", head_load_request_);
|
||||
}
|
||||
size_t c = 0;
|
||||
for(auto &drive : drives_) {
|
||||
if(drive) drive->set_activity_observer(observer, drive_name(c), false);
|
||||
++c;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Microdisc::drive_name(size_t index) {
|
||||
return "Drive " + std::to_string(index);
|
||||
}
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
#include "../../Components/1770/1770.hpp"
|
||||
#include "../../Activity/Observer.hpp"
|
||||
|
||||
#include <array>
|
||||
#include "DiskController.hpp"
|
||||
|
||||
namespace Oric {
|
||||
@ -42,8 +40,6 @@ class Microdisc: public DiskController {
|
||||
bool head_load_request_ = false;
|
||||
|
||||
Activity::Observer *observer_ = nullptr;
|
||||
|
||||
std::string drive_name(size_t index);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -637,6 +637,12 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface> class Co
|
||||
void set_activity_observer(Activity::Observer *observer) override {
|
||||
switch(disk_interface) {
|
||||
default: break;
|
||||
case DiskInterface::BD500:
|
||||
bd500_.set_activity_observer(observer);
|
||||
break;
|
||||
case DiskInterface::Jasmin:
|
||||
jasmin_.set_activity_observer(observer);
|
||||
break;
|
||||
case DiskInterface::Microdisc:
|
||||
microdisc_.set_activity_observer(observer);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user