From 89ace671a401c3c1036951cff4ffc25c3ddc623d Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 12 Aug 2017 09:44:01 -0400 Subject: [PATCH] Corrected unload time. Was 8000 times too short. --- Components/8272/i8272.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Components/8272/i8272.cpp b/Components/8272/i8272.cpp index d6462693f..ce6395aba 100644 --- a/Components/8272/i8272.cpp +++ b/Components/8272/i8272.cpp @@ -79,6 +79,7 @@ void i8272::run_for(Cycles cycles) { drives_[c].head_unload_delay[c] = 0; drives_[c].head_is_loaded[c] = false; head_timers_running_--; + if(!head_timers_running_) return; } else { drives_[c].head_unload_delay[c] -= cycles.as_int(); } @@ -125,8 +126,9 @@ void i8272::set_disk(std::shared_ptr disk, int drive) { #define BEGIN_SECTION() switch(resume_point_) { default: #define END_SECTION() } +#define MS_TO_CYCLES(x) x * 8000 #define WAIT_FOR_EVENT(mask) resume_point_ = __LINE__; interesting_event_mask_ = (int)mask; return; case __LINE__: -#define WAIT_FOR_TIME(ms) resume_point_ = __LINE__; interesting_event_mask_ = (int)Event8272::Timer; delay_time_ = ms * 8000; case __LINE__: if(delay_time_) return; +#define WAIT_FOR_TIME(ms) resume_point_ = __LINE__; interesting_event_mask_ = (int)Event8272::Timer; delay_time_ = MS_TO_CYCLES(ms); case __LINE__: if(delay_time_) return; #define PASTE(x, y) x##y #define CONCAT(x, y) PASTE(x, y) @@ -177,7 +179,7 @@ void i8272::set_disk(std::shared_ptr disk, int drive) { if(drives_[active_drive_].head_unload_delay[active_head_] == 0) { \ head_timers_running_++; \ } \ - drives_[active_drive_].head_unload_delay[active_head_] = head_unload_time_; + drives_[active_drive_].head_unload_delay[active_head_] = MS_TO_CYCLES(head_unload_time_); void i8272::posit_event(int event_type) { if(!(interesting_event_mask_ & event_type)) return; @@ -287,14 +289,12 @@ void i8272::posit_event(int event_type) { // Establishes the drive and head being addressed, and whether in double density mode; populates the internal // cylinder, head, sector and size registers from the command stream. SET_DRIVE_HEAD_MFM(); + LOAD_HEAD(); cylinder_ = command_[2]; head_ = command_[3]; sector_ = command_[4]; size_ = command_[5]; - // TODO: is the head loaded? - LOAD_HEAD(); - read_next_data: // Sets a maximum index hole limit of 2 then performs a find header/read header loop, continuing either until