1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-10 23:31:24 +00:00

Deviated from the data sheet, which seems likely to be correct. Hence removed a whole load of the temporary logging.

This commit is contained in:
Thomas Harte 2016-12-26 12:48:49 -05:00
parent 742c5df367
commit 83c433c142

View File

@ -563,7 +563,6 @@ void WD1770::posit_event(Event new_event_type)
}); });
distance_into_section_ = 0; distance_into_section_ = 0;
is_reading_data_ = true; is_reading_data_ = true;
printf("\n");
goto type2_read_byte; goto type2_read_byte;
} }
goto type2_read_data; goto type2_read_data;
@ -571,7 +570,7 @@ void WD1770::posit_event(Event new_event_type)
type2_read_byte: type2_read_byte:
WAIT_FOR_EVENT(Event::Token); WAIT_FOR_EVENT(Event::Token);
if(latest_token_.type != Token::Byte) goto type2_read_byte; if(latest_token_.type != Token::Byte) goto type2_read_byte;
data_ = latest_token_.byte_value; printf("%02x", data_); data_ = latest_token_.byte_value;
update_status([] (Status &status) { update_status([] (Status &status) {
status.lost_data |= status.data_request; status.lost_data |= status.data_request;
status.data_request = true; status.data_request = true;
@ -580,7 +579,6 @@ void WD1770::posit_event(Event new_event_type)
if(distance_into_section_ == 128 << header_[3]) if(distance_into_section_ == 128 << header_[3])
{ {
distance_into_section_ = 0; distance_into_section_ = 0;
printf("\n");
goto type2_check_crc; goto type2_check_crc;
} }
goto type2_read_byte; goto type2_read_byte;
@ -633,7 +631,7 @@ void WD1770::posit_event(Event new_event_type)
if(is_double_density_) if(is_double_density_)
{ {
write_raw_short(Storage::Encodings::MFM::MFMAddressMark); write_raw_short(Storage::Encodings::MFM::MFMAddressMark);
write_byte((command_&0x01) ? Storage::Encodings::MFM::MFMDataAddressByte : Storage::Encodings::MFM::MFMDeletedDataAddressByte); write_byte((command_&0x01) ? Storage::Encodings::MFM::MFMDeletedDataAddressByte : Storage::Encodings::MFM::MFMDataAddressByte);
} }
else else
{ {
@ -642,20 +640,25 @@ void WD1770::posit_event(Event new_event_type)
WAIT_FOR_EVENT(Event::DataWritten); WAIT_FOR_EVENT(Event::DataWritten);
distance_into_section_ = 0; distance_into_section_ = 0;
printf("\n");
type2_write_loop: type2_write_loop:
write_byte(data_); printf("%02x", data_); /*
update_status([] (Status &status) { This deviates from the data sheet slightly since that would prima facie request one more byte
status.data_request = true; of data than is actually written the last time around the loop it has transferred from the
}); data register to the data shift register, set data request, written the byte, checked that data
WAIT_FOR_EVENT(Event::DataWritten); request has been satified, then finally considers whether all bytes are done. Based on both
natural expectations and the way that emulated machines responded, I believe that to be a
documentation error.
*/
write_byte(data_);
distance_into_section_++; distance_into_section_++;
if(distance_into_section_ == 128 << header_[3]) if(distance_into_section_ < 128 << header_[3])
{ {
printf("\n"); update_status([] (Status &status) {
goto type2_write_crc; status.data_request = true;
});
} }
WAIT_FOR_EVENT(Event::DataWritten);
if(status_.data_request) if(status_.data_request)
{ {
@ -665,6 +668,10 @@ void WD1770::posit_event(Event new_event_type)
goto wait_for_command; goto wait_for_command;
} }
if(distance_into_section_ == 128 << header_[3])
{
goto type2_write_crc;
}
goto type2_write_loop; goto type2_write_loop;
type2_write_crc: type2_write_crc: