From ba2e5a97a9271def7fac1f51e5d062a8b6bd809d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Jul 2021 22:30:34 -0400 Subject: [PATCH] Provisionally adds a status LED. --- Machines/Amiga/Amiga.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Machines/Amiga/Amiga.cpp b/Machines/Amiga/Amiga.cpp index 98c1558f7..316dd26a0 100644 --- a/Machines/Amiga/Amiga.cpp +++ b/Machines/Amiga/Amiga.cpp @@ -8,6 +8,7 @@ #include "Amiga.hpp" +#include "../../Activity/Source.hpp" #include "../MachineTypes.hpp" #include "../../Processors/68000/68000.hpp" @@ -25,6 +26,7 @@ namespace Amiga { class ConcreteMachine: + public Activity::Source, public CPU::MC68000::BusHandler, public MachineTypes::ScanProducer, public MachineTypes::TimedMachine, @@ -324,7 +326,9 @@ class ConcreteMachine: // b1: /LED [output] // b0: OVL [output] - LOG("TODO: LED -> " << (value & 2)); + if(observer_) { + observer_->set_led_status(led_name, !(value & 2)); + } map_.set_overlay(value & 1); } } @@ -338,8 +342,17 @@ class ConcreteMachine: return 0xff; } + void set_activity_observer(Activity::Observer *observer) { + observer_ = observer; + if(observer) { + observer->register_led(led_name, Activity::Observer::LEDPresentation::Persistent); + } + } + private: MemoryMap &map_; + Activity::Observer *observer_ = nullptr; + inline static const std::string led_name = "Power"; } cia_a_handler_; struct CIABHandler: public MOS::MOS6526::PortHandler { @@ -376,6 +389,11 @@ class ConcreteMachine: MOS::MOS6526::MOS6526 cia_a_; MOS::MOS6526::MOS6526 cia_b_; + // MARK: - Activity Source + void set_activity_observer(Activity::Observer *observer) final { + cia_a_handler_.set_activity_observer(observer); + } + // MARK: - MachineTypes::ScanProducer. void set_scan_target(Outputs::Display::ScanTarget *scan_target) final {