From 81ee83453012d66fc67edca630d4516bab9a9c87 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 2 Dec 2016 18:36:47 -0500 Subject: [PATCH] As well as a bunch of logging, reinstated rotation position preservation across tracks. --- Components/1770/1770.cpp | 1 + Machines/Oric/Microdisc.cpp | 17 ++++++++++++++++- Storage/Disk/DiskController.cpp | 11 ++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index 609984826..024f3de7b 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -506,6 +506,7 @@ void WD1770::posit_event(Event new_event_type) if(index_hole_count_ == 5) { + printf("Failed to find sector %d\n", sector_); update_status([] (Status &status) { status.record_not_found = true; }); diff --git a/Machines/Oric/Microdisc.cpp b/Machines/Oric/Microdisc.cpp index 8b32f6cca..61d092662 100644 --- a/Machines/Oric/Microdisc.cpp +++ b/Machines/Oric/Microdisc.cpp @@ -11,6 +11,10 @@ using namespace Oric; namespace { + // The number below, in cycles against an 8Mhz clock, was arrived at fairly unscientifically, + // by comparing the amount of time this emulator took to show a directory versus a video of + // a real Oric. It therefore assumes all other timing measurements were correct on the day + // of the test. More work to do, I think. const int head_load_request_counter_target = 7653333; } @@ -34,6 +38,16 @@ void Microdisc::set_disk(std::shared_ptr disk, int drive) 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); + // b2: data separator clock rate select (1 = double) [TODO] // b65: drive select @@ -41,9 +55,10 @@ void Microdisc::set_control_register(uint8_t control) set_drive(drives_[selected_drive_]); // b4: side select + unsigned int head = (control & 0x10) ? 1 : 0; for(int c = 0; c < 4; c++) { - if(drives_[c]) drives_[c]->set_head((control & 0x10) ? 1 : 0); + if(drives_[c]) drives_[c]->set_head(head); } // b3: double density select (0 = double) diff --git a/Storage/Disk/DiskController.cpp b/Storage/Disk/DiskController.cpp index 896bd4579..48fea4305 100644 --- a/Storage/Disk/DiskController.cpp +++ b/Storage/Disk/DiskController.cpp @@ -25,13 +25,11 @@ Controller::Controller(unsigned int clock_rate, unsigned int clock_rate_multipli set_expected_bit_length(one); } -void Controller::setup_track() // Time initial_offset +void Controller::setup_track() { _track = _drive->get_track(); -// _track = _disk->get_track_at_position(0, (unsigned int)_head_position); - // TODO: probably a better implementation of the empty track? -/* Time offset; + Time offset; if(_track && _time_into_track.length > 0) { Time time_found = _track->seek_to(_time_into_track).simplify(); @@ -42,11 +40,10 @@ void Controller::setup_track() // Time initial_offset { offset = _time_into_track; _time_into_track.set_zero(); - }*/ + } - reset_timer(); + reset_timer_to_offset(offset * _rotational_multiplier); get_next_event(); -// reset_timer_to_offset(offset * _rotational_multiplier); } void Controller::run_for_cycles(int number_of_cycles)