1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Adds a through route for the FDC interrupt line.

This commit is contained in:
Thomas Harte 2019-10-28 21:13:21 -04:00
parent 5f6711b72c
commit 95d3b6e79f
3 changed files with 38 additions and 5 deletions

View File

@ -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.

View File

@ -83,3 +83,19 @@ void DMAController::run_for(HalfCycles duration) {
running_time_ += duration;
fdc_.run_for(duration.flush<Cycles>());
}
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_;
}

View File

@ -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<std::shared_ptr<Storage::Disk::Drive>> 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;
};
}