1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-07 23:25:00 +00:00

Fixed an initial setup error with seek.

This commit is contained in:
Thomas Harte
2016-09-24 22:43:12 -04:00
parent d50629e6aa
commit 9e1d4c8b01

View File

@@ -136,6 +136,9 @@ void WD1770::process_index_hole()
{ {
index_hole_count_++; index_hole_count_++;
posit_event(Event::IndexHole); posit_event(Event::IndexHole);
// motor power-down
if(index_hole_count_ == 9 && !(status_&Flag::Busy)) status_ &= ~Flag::MotorOn;
} }
// +------+----------+-------------------------+ // +------+----------+-------------------------+
@@ -172,6 +175,7 @@ void WD1770::posit_event(Event new_event_type)
wait_for_command: wait_for_command:
printf("Idle...\n"); printf("Idle...\n");
status_ &= ~Flag::Busy; status_ &= ~Flag::Busy;
index_hole_count_ = 0;
WAIT_FOR_EVENT(Event::Command); WAIT_FOR_EVENT(Event::Command);
printf("Starting %02x\n", command_); printf("Starting %02x\n", command_);
status_ |= Flag::Busy; status_ |= Flag::Busy;
@@ -205,9 +209,12 @@ void WD1770::posit_event(Event new_event_type)
if((command_ >> 5) == 3) step_direction_ = 0; if((command_ >> 5) == 3) step_direction_ = 0;
if((command_ >> 5) != 0) goto perform_step_command; if((command_ >> 5) != 0) goto perform_step_command;
// This is now definitely either a seek or a restore; if it's a restore then set track to 0xff. // This is now definitely either a seek or a restore; if it's a restore then set track to 0xff and data to 0x00.
if(!(command_ & 0x10)) track_ = 0xff; if(!(command_ & 0x10))
data_ = 0; {
track_ = 0xff;
data_ = 0;
}
perform_seek_or_restore_command: perform_seek_or_restore_command:
if(track_ == data_) goto verify; if(track_ == data_) goto verify;