From c304db0f5ac5dd719e3f0b03a43c36335da47f87 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Dec 2016 21:16:29 -0500 Subject: [PATCH] Deintegrated the busy flag and the interrupt request line, as the latter is reset by status reads. Which also means I can start reporting the WD INTRQ line status directly from the Microdisc. That appears to be correct, rather than honouring the Microdisc IRQ select there. --- Components/1770/1770.cpp | 6 ++++++ Components/1770/1770.hpp | 5 +++-- Machines/Oric/Microdisc.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index 024f3de7b..26434abb6 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -21,6 +21,7 @@ WD1770::Status::Status() : seek_error(false), lost_data(false), data_request(false), + interrupt_request(false), busy(false) {} @@ -83,6 +84,9 @@ uint8_t WD1770::get_register(int address) { default: { + update_status([] (Status &status) { + status.interrupt_request = false; + }); uint8_t status = (status_.write_protect ? Flag::WriteProtect : 0) | (status_.crc_error ? Flag::CRCError : 0) | @@ -326,12 +330,14 @@ void WD1770::posit_event(Event new_event_type) update_status([] (Status &status) { status.busy = false; + status.interrupt_request = true; }); WAIT_FOR_EVENT(Event::Command); update_status([] (Status &status) { status.busy = true; + status.interrupt_request = false; }); printf("Starting %02x\n", command_); diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index 86bf87f7c..edfe809e3 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -46,8 +46,8 @@ class WD1770: public Storage::Disk::Controller { Busy = 0x01 }; - inline bool get_interrupt_request_line() { return !status_.busy; } - inline bool get_data_request_line() { return status_.data_request; } + inline bool get_interrupt_request_line() { return status_.interrupt_request; } + inline bool get_data_request_line() { return status_.data_request; } class Delegate { public: virtual void wd1770_did_change_output(WD1770 *wd1770) = 0; @@ -73,6 +73,7 @@ class WD1770: public Storage::Disk::Controller { bool seek_error; bool lost_data; bool data_request; + bool interrupt_request; bool busy; enum { One, Two, Three diff --git a/Machines/Oric/Microdisc.cpp b/Machines/Oric/Microdisc.cpp index 61d092662..25844d6cd 100644 --- a/Machines/Oric/Microdisc.cpp +++ b/Machines/Oric/Microdisc.cpp @@ -90,7 +90,7 @@ bool Microdisc::get_interrupt_request_line() uint8_t Microdisc::get_interrupt_request_register() { - return 0x7f | (get_interrupt_request_line() ? 0x00 : 0x80); + return 0x7f | (WD1770::get_interrupt_request_line() ? 0x00 : 0x80); } uint8_t Microdisc::get_data_request_register()