1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Fixed to ensure a known initial control register value, which has taken effect.

This commit is contained in:
Thomas Harte 2016-12-28 18:49:32 -05:00
parent 7a627b782d
commit 90151e2094
2 changed files with 10 additions and 11 deletions

View File

@ -23,8 +23,11 @@ Microdisc::Microdisc() :
delegate_(nullptr), delegate_(nullptr),
paging_flags_(BASICDisable), paging_flags_(BASICDisable),
head_load_request_counter_(-1), head_load_request_counter_(-1),
WD1770(P1793) WD1770(P1793),
{} last_control_(0)
{
set_control_register(last_control_, 0xff);
}
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)
{ {
@ -38,18 +41,13 @@ 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)
{ {
// printf("control: %d%d%d%d%d%d%d%d\n",
// (control >> 7)&1,
// (control >> 6)&1,
// (control >> 5)&1,
// (control >> 4)&1,
// (control >> 3)&1,
// (control >> 2)&1,
// (control >> 1)&1,
// (control >> 0)&1);
uint8_t changes = last_control_ ^ control; uint8_t changes = last_control_ ^ control;
last_control_ = control; last_control_ = control;
set_control_register(control, changes);
}
void Microdisc::set_control_register(uint8_t control, uint8_t changes)
{
// b2: data separator clock rate select (1 = double) [TODO] // b2: data separator clock rate select (1 = double) [TODO]
// b65: drive select // b65: drive select

View File

@ -39,6 +39,7 @@ class Microdisc: public WD::WD1770 {
inline int get_paging_flags() { return paging_flags_; } inline int get_paging_flags() { return paging_flags_; }
private: private:
void set_control_register(uint8_t control, uint8_t changes);
void set_head_load_request(bool head_load); void set_head_load_request(bool head_load);
bool get_drive_is_ready(); bool get_drive_is_ready();
std::shared_ptr<Storage::Disk::Drive> drives_[4]; std::shared_ptr<Storage::Disk::Drive> drives_[4];