From 95d3b6e79f76582ec6bd924b265c2eec189a5130 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 28 Oct 2019 21:13:21 -0400 Subject: [PATCH] Adds a through route for the FDC interrupt line. --- Machines/AtariST/AtariST.cpp | 13 +++++++++---- Machines/AtariST/DMAController.cpp | 16 ++++++++++++++++ Machines/AtariST/DMAController.hpp | 14 +++++++++++++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Machines/AtariST/AtariST.cpp b/Machines/AtariST/AtariST.cpp index 24d0e459d..2cd49baf2 100644 --- a/Machines/AtariST/AtariST.cpp +++ b/Machines/AtariST/AtariST.cpp @@ -225,7 +225,8 @@ class ConcreteMachine: public CRTMachine::Machine, public ClockingHint::Observer, public Motorola::ACIA::ACIA::InterruptDelegate, - public Motorola::MFP68901::MFP68901::InterruptDelegate { + public Motorola::MFP68901::MFP68901::InterruptDelegate, + public DMAController::InterruptDelegate { public: ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) : mc68000_(*this), @@ -274,6 +275,7 @@ class ConcreteMachine: ikbd_.set_clocking_hint_observer(this); mfp_->set_interrupt_delegate(this); + dma_->set_interrupt_delegate(this); set_gpip_input(); } @@ -637,7 +639,10 @@ class ConcreteMachine: } // MARK: - GPIP input. - void acia6850_did_change_interrupt_status(Motorola::ACIA::ACIA *acia) final { + void acia6850_did_change_interrupt_status(Motorola::ACIA::ACIA *) final { + set_gpip_input(); + } + void dma_controller_did_change_interrupt_status(DMAController *) final { set_gpip_input(); } void set_gpip_input() { @@ -656,8 +661,8 @@ class ConcreteMachine: mfp_->set_port_input( 0x00 | // b7: Monochrome monitor detect (1 = is monochrome). 0x40 | // b6: RS-232 ring indicator. - 0x20 | // b5: FD/HS interrupt (0 = interrupt requested). - ((keyboard_acia_->get_interrupt_line() || midi_acia_->get_interrupt_line()) ? 0x0 : 0x10) | // b4: Keyboard/MIDI interrupt (0 = interrupt requested). + (dma_->get_interrupt_line() ? 0x00 : 0x20) | // b5: FD/HS interrupt (0 = interrupt requested). + ((keyboard_acia_->get_interrupt_line() || midi_acia_->get_interrupt_line()) ? 0x00 : 0x10) | // b4: Keyboard/MIDI interrupt (0 = interrupt requested). 0x08 | // b3: Unused 0x04 | // b2: RS-232 clear to send. 0x02 | // b1 : RS-232 carrier detect. diff --git a/Machines/AtariST/DMAController.cpp b/Machines/AtariST/DMAController.cpp index 30326178f..c9d4796e9 100644 --- a/Machines/AtariST/DMAController.cpp +++ b/Machines/AtariST/DMAController.cpp @@ -83,3 +83,19 @@ void DMAController::run_for(HalfCycles duration) { running_time_ += duration; fdc_.run_for(duration.flush()); } + +void DMAController::wd1770_did_change_output(WD::WD1770 *) { + const bool old_interrupt_line = interrupt_line_; + interrupt_line_ = fdc_.get_interrupt_request_line(); + if(interrupt_delegate_ && interrupt_line_ != old_interrupt_line) { + interrupt_delegate_->dma_controller_did_change_interrupt_status(this); + } +} + +void DMAController::set_interrupt_delegate(InterruptDelegate *delegate) { + interrupt_delegate_ = delegate; +} + +bool DMAController::get_interrupt_line() { + return interrupt_line_; +} diff --git a/Machines/AtariST/DMAController.hpp b/Machines/AtariST/DMAController.hpp index f082fcbc4..59cacdd3b 100644 --- a/Machines/AtariST/DMAController.hpp +++ b/Machines/AtariST/DMAController.hpp @@ -18,7 +18,7 @@ namespace Atari { namespace ST { -class DMAController { +class DMAController: public WD::WD1770::Delegate { public: DMAController(); @@ -26,6 +26,13 @@ class DMAController { void write(int address, uint16_t value); void run_for(HalfCycles duration); + bool get_interrupt_line(); + + struct InterruptDelegate { + virtual void dma_controller_did_change_interrupt_status(DMAController *) = 0; + }; + void set_interrupt_delegate(InterruptDelegate *delegate); + private: HalfCycles running_time_; struct WD1772: public WD::WD1770 { @@ -43,10 +50,15 @@ class DMAController { std::vector> drives_; } fdc_; + void wd1770_did_change_output(WD::WD1770 *) final; + uint16_t control_ = 0; uint32_t address_ = 0; uint16_t status_ = 0; uint16_t sector_count_ = 0; + + InterruptDelegate *interrupt_delegate_ = nullptr; + bool interrupt_line_ = false; }; }