mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Added what may be correct paging logic.
This commit is contained in:
parent
363db695e8
commit
13a608a8c2
@ -10,7 +10,10 @@
|
|||||||
|
|
||||||
using namespace Oric;
|
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<Storage::Disk::Disk> disk, int drive)
|
void Microdisc::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, int drive)
|
||||||
@ -25,9 +28,7 @@ void Microdisc::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, int drive)
|
|||||||
|
|
||||||
void Microdisc::set_control_register(uint8_t control)
|
void Microdisc::set_control_register(uint8_t control)
|
||||||
{
|
{
|
||||||
// b7: EPROM select (0 = select)
|
// b2: data separator clock rate select (1 = double) [TODO]
|
||||||
// b2: data separator clock rate select (1 = double)
|
|
||||||
// b1: ROM disable (0 = disable)
|
|
||||||
|
|
||||||
// b65: drive select
|
// b65: drive select
|
||||||
selected_drive_ = (control >> 5)&3;
|
selected_drive_ = (control >> 5)&3;
|
||||||
@ -44,6 +45,15 @@ void Microdisc::set_control_register(uint8_t control)
|
|||||||
|
|
||||||
// b0: IRQ enable
|
// b0: IRQ enable
|
||||||
irq_enable_ = !(control & 0x01);
|
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()
|
bool Microdisc::get_interrupt_request_line()
|
||||||
|
@ -24,10 +24,24 @@ class Microdisc: public WD::WD1770 {
|
|||||||
|
|
||||||
bool get_interrupt_request_line();
|
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:
|
private:
|
||||||
std::shared_ptr<Storage::Disk::Drive> drives_[4];
|
std::shared_ptr<Storage::Disk::Drive> drives_[4];
|
||||||
int selected_drive_;
|
int selected_drive_;
|
||||||
bool irq_enable_;
|
bool irq_enable_;
|
||||||
|
int paging_flags_;
|
||||||
|
Delegate *delegate_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user