mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Merge branch 'master' into LockFreeQueue
This commit is contained in:
commit
9410594486
@ -18,6 +18,11 @@
|
||||
|
||||
namespace Oric {
|
||||
|
||||
/*!
|
||||
Emulates a Byte Drive 500, at least to some extent. Very little is known about this interface,
|
||||
and I'm in possession of only a single disk image. So much of the below is community guesswork;
|
||||
see the thread at https://forum.defence-force.org/viewtopic.php?f=25&t=2055
|
||||
*/
|
||||
class BD500: public DiskController {
|
||||
public:
|
||||
BD500();
|
||||
@ -36,6 +41,16 @@ class BD500: public DiskController {
|
||||
|
||||
void access(int address);
|
||||
void set_head_loaded(bool loaded);
|
||||
|
||||
bool enable_overlay_ram_ = false;
|
||||
bool disable_basic_rom_ = false;
|
||||
void select_paged_item() {
|
||||
PagedItem item = PagedItem::RAM;
|
||||
if(!enable_overlay_ram_) {
|
||||
item = disable_basic_rom_ ? PagedItem::DiskROM : PagedItem::BASIC;
|
||||
}
|
||||
set_paged_item(item);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -44,28 +44,18 @@ class DiskController: public WD::WD1770 {
|
||||
protected:
|
||||
Delegate *delegate_ = nullptr;
|
||||
|
||||
bool enable_overlay_ram_ = false;
|
||||
bool disable_basic_rom_ = false;
|
||||
void select_paged_item() {
|
||||
PagedItem item = PagedItem::RAM;
|
||||
if(!enable_overlay_ram_) {
|
||||
item = disable_basic_rom_ ? PagedItem::DiskROM : PagedItem::BASIC;
|
||||
}
|
||||
set_paged_item(item);
|
||||
}
|
||||
|
||||
private:
|
||||
PagedItem paged_item_ = PagedItem::DiskROM;
|
||||
int clock_rate_;
|
||||
Storage::Disk::Drive::ReadyType ready_type_;
|
||||
|
||||
inline void set_paged_item(PagedItem item) {
|
||||
void set_paged_item(PagedItem item) {
|
||||
if(paged_item_ == item) return;
|
||||
paged_item_ = item;
|
||||
if(delegate_) {
|
||||
delegate_->disk_controller_did_change_paged_item(this);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PagedItem paged_item_ = PagedItem::DiskROM;
|
||||
int clock_rate_;
|
||||
Storage::Disk::Drive::ReadyType ready_type_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,6 +29,16 @@ class Jasmin: public DiskController {
|
||||
uint8_t selected_drives_ = 0;
|
||||
|
||||
Activity::Observer *observer_ = nullptr;
|
||||
|
||||
bool enable_overlay_ram_ = false;
|
||||
bool disable_basic_rom_ = false;
|
||||
void select_paged_item() {
|
||||
PagedItem item = PagedItem::RAM;
|
||||
if(!enable_overlay_ram_) {
|
||||
item = disable_basic_rom_ ? PagedItem::DiskROM : PagedItem::BASIC;
|
||||
}
|
||||
set_paged_item(item);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ void Microdisc::set_control_register(uint8_t control, uint8_t changes) {
|
||||
|
||||
// b4: side select
|
||||
if(changes & 0x10) {
|
||||
const int head = (control & 0x10) ? 1 : 0;
|
||||
const int head = (control & 0x10) >> 4;
|
||||
for_all_drives([head] (Storage::Disk::Drive &drive, size_t) {
|
||||
drive.set_head(head);
|
||||
});
|
||||
@ -52,7 +52,7 @@ void Microdisc::set_control_register(uint8_t control, uint8_t changes) {
|
||||
// b0: IRQ enable
|
||||
if(changes & 0x01) {
|
||||
const bool had_irq = get_interrupt_request_line();
|
||||
irq_enable_ = !!(control & 0x01);
|
||||
irq_enable_ = bool(control & 0x01);
|
||||
const bool has_irq = get_interrupt_request_line();
|
||||
if(has_irq != had_irq && delegate_) {
|
||||
delegate_->wd1770_did_change_output(this);
|
||||
@ -62,9 +62,14 @@ void Microdisc::set_control_register(uint8_t control, uint8_t changes) {
|
||||
// b7: EPROM select (0 = select)
|
||||
// b1: ROM disable (0 = disable)
|
||||
if(changes & 0x82) {
|
||||
enable_overlay_ram_ = control & 0x80;
|
||||
disable_basic_rom_ = !(control & 0x02);
|
||||
select_paged_item();
|
||||
PagedItem item;
|
||||
if(control & 0x02) item = PagedItem::BASIC;
|
||||
else if(control & 0x80) {
|
||||
item = PagedItem::RAM;
|
||||
} else {
|
||||
item = PagedItem::DiskROM;
|
||||
}
|
||||
set_paged_item(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void Controller::set_drive(int index_mask) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClockingHint::Preference former_prefernece = preferred_clocking();
|
||||
const ClockingHint::Preference former_preference = preferred_clocking();
|
||||
|
||||
// Stop receiving events from the current drive.
|
||||
get_drive().set_event_delegate(nullptr);
|
||||
@ -114,7 +114,7 @@ void Controller::set_drive(int index_mask) {
|
||||
|
||||
get_drive().set_event_delegate(this);
|
||||
|
||||
if(preferred_clocking() != former_prefernece) {
|
||||
if(preferred_clocking() != former_preference) {
|
||||
update_clocking_observer();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user