From 13a608a8c2f063cf18bc9867e4ebff52b02833d8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 22 Nov 2016 22:09:52 +0800 Subject: [PATCH] Added what may be correct paging logic. --- Machines/Oric/Microdisc.cpp | 18 ++++++++++++++---- Machines/Oric/Microdisc.hpp | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Machines/Oric/Microdisc.cpp b/Machines/Oric/Microdisc.cpp index 00454cd19..0a9ccb5d9 100644 --- a/Machines/Oric/Microdisc.cpp +++ b/Machines/Oric/Microdisc.cpp @@ -10,7 +10,10 @@ using namespace Oric; -Microdisc::Microdisc() : irq_enable_(false) +Microdisc::Microdisc() : + irq_enable_(false), + delegate_(nullptr), + paging_flags_(BASICDisable) {} void Microdisc::set_disk(std::shared_ptr disk, int drive) @@ -25,9 +28,7 @@ void Microdisc::set_disk(std::shared_ptr disk, int drive) void Microdisc::set_control_register(uint8_t control) { - // b7: EPROM select (0 = select) - // b2: data separator clock rate select (1 = double) - // b1: ROM disable (0 = disable) + // b2: data separator clock rate select (1 = double) [TODO] // b65: drive select selected_drive_ = (control >> 5)&3; @@ -44,6 +45,15 @@ void Microdisc::set_control_register(uint8_t control) // b0: IRQ enable irq_enable_ = !(control & 0x01); + + // b7: EPROM select (0 = select) + // b1: ROM disable (0 = disable) + int new_paging_flags = ((control & 0x01) ? BASICDisable : 0) | ((control & 0x80) ? 0 : MicrodscDisable); + if(new_paging_flags != paging_flags_) + { + paging_flags_ = new_paging_flags; + if(delegate_) delegate_->microdisc_did_change_paging_flags(this); + } } bool Microdisc::get_interrupt_request_line() diff --git a/Machines/Oric/Microdisc.hpp b/Machines/Oric/Microdisc.hpp index ec728c48e..fcbe21b1a 100644 --- a/Machines/Oric/Microdisc.hpp +++ b/Machines/Oric/Microdisc.hpp @@ -24,10 +24,24 @@ class Microdisc: public WD::WD1770 { bool get_interrupt_request_line(); + enum PagingFlags { + BASICDisable = (1 << 0), + MicrodscDisable = (1 << 1) + }; + + class Delegate { + public: + virtual void microdisc_did_change_paging_flags(Microdisc *microdisc) = 0; + }; + inline void set_microdisc_delegate(Delegate *delegate) { delegate_ = delegate; } + inline int get_paging_flags() { return paging_flags_; } + private: std::shared_ptr drives_[4]; int selected_drive_; bool irq_enable_; + int paging_flags_; + Delegate *delegate_; }; }