mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Collapsed implementations of recalibrate and seek, and decided to intend to go for an upward count on steps taken rather than a downward one. But seek continues presently to fail.
This commit is contained in:
parent
90c74043f5
commit
d63893a437
@ -58,7 +58,6 @@ void i8272::run_for(Cycles cycles) {
|
||||
(drives_[c].drive->get_is_track_zero() && drives_[c].target_head_position == -1)) {
|
||||
drives_[c].phase = Drive::CompletedSeeking;
|
||||
if(drives_[c].target_head_position == -1) drives_[c].head_position = 0;
|
||||
main_status_ &= ~(1 << c);
|
||||
} else {
|
||||
int direction = (drives_[c].target_head_position < drives_[c].head_position) ? -1 : 1;
|
||||
drives_[c].drive->step(direction);
|
||||
@ -83,7 +82,7 @@ void i8272::set_register(int address, uint8_t value) {
|
||||
|
||||
uint8_t i8272::get_register(int address) {
|
||||
if(address) {
|
||||
printf("8272 get data\n");
|
||||
// printf("8272 get data\n");
|
||||
|
||||
if(result_stack_.empty()) return 0xff;
|
||||
uint8_t result = result_stack_.back();
|
||||
@ -231,8 +230,9 @@ void i8272::posit_event(int event_type) {
|
||||
FIND_HEADER();
|
||||
if(!index_hole_limit_) goto read_data_not_found;
|
||||
READ_HEADER();
|
||||
printf("Comparing with %02x\n", header_[2]);
|
||||
if(header_[2] != sector_) goto find_next_sector;
|
||||
// printf("Comparing with %02x\n", header_[2]);
|
||||
if(header_[0] != cylinder_ || header_[1] != head_ || header_[2] != sector_ || header_[3] != size_) goto find_next_sector;
|
||||
|
||||
|
||||
FIND_DATA();
|
||||
distance_into_section_ = 0;
|
||||
@ -323,12 +323,14 @@ void i8272::posit_event(int event_type) {
|
||||
goto wait_for_command;
|
||||
|
||||
recalibrate:
|
||||
printf("Recalibrate\n");
|
||||
seek:
|
||||
printf((command_.size() > 2) ? "Seek\n" : "Recalibrate\n");
|
||||
status_[0] = status_[1] = status_[2] = 0;
|
||||
drives_[command_[1]&3].phase = Drive::Seeking;
|
||||
drives_[command_[1]&3].permitted_steps = 77;
|
||||
drives_[command_[1]&3].target_head_position = -1;
|
||||
drives_[command_[1]&3].steps_taken = 0;
|
||||
drives_[command_[1]&3].target_head_position = (command_.size() > 2) ? command_[2] : -1;
|
||||
drives_[command_[1]&3].step_rate_counter = 0;
|
||||
main_status_ |= (1 << command_[1]&3);
|
||||
main_status_ |= 1 << (command_[1]&3);
|
||||
goto wait_for_command;
|
||||
|
||||
sense_interrupt_status:
|
||||
@ -346,6 +348,7 @@ void i8272::posit_event(int event_type) {
|
||||
if(found_drive != -1) {
|
||||
drives_[found_drive].phase = Drive::NotSeeking;
|
||||
status_[0] = (uint8_t)found_drive | 0x20;
|
||||
main_status_ &= ~(1 << found_drive);
|
||||
|
||||
result_stack_.push_back(drives_[found_drive].head_position);
|
||||
result_stack_.push_back(status_[0]);
|
||||
@ -368,15 +371,6 @@ void i8272::posit_event(int event_type) {
|
||||
result_stack_.push_back(status_[3]);
|
||||
goto post_result;
|
||||
|
||||
seek:
|
||||
printf("Seek\n");
|
||||
drives_[command_[1]&3].phase = Drive::Seeking;
|
||||
drives_[command_[1]&3].permitted_steps = -1;
|
||||
drives_[command_[1]&3].target_head_position = command_[2];
|
||||
drives_[command_[1]&3].step_rate_counter = 0;
|
||||
main_status_ |= (1 << command_[1]&3);
|
||||
goto wait_for_command;
|
||||
|
||||
invalid:
|
||||
// A no-op, causing the FDC to go back into standby mode.
|
||||
goto wait_for_command;
|
||||
|
@ -60,7 +60,7 @@ class i8272: public Storage::Disk::MFMController {
|
||||
CompletedSeeking
|
||||
} phase;
|
||||
int step_rate_counter;
|
||||
int permitted_steps;
|
||||
int steps_taken;
|
||||
int target_head_position; // either an actual number, or -1 to indicate to step until track zero
|
||||
|
||||
std::shared_ptr<Storage::Disk::Drive> drive;
|
||||
|
Loading…
Reference in New Issue
Block a user