1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Prevented the 8272 from overreading ID fields (and, by doing so, overrunning its internal buffer). Exposed the MFMController's CRC generator for inspection.

This commit is contained in:
Thomas Harte 2017-08-07 12:37:22 -04:00
parent d07f3216ab
commit 47732ffb98
3 changed files with 12 additions and 1 deletions

View File

@ -131,7 +131,7 @@ void i8272::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, int drive) {
CONCAT(read_header, __LINE__): WAIT_FOR_EVENT(Event::Token); \
header_[distance_into_section_] = get_latest_token().byte_value; \
distance_into_section_++; \
if(distance_into_section_ != 7) goto CONCAT(read_header, __LINE__); \
if(distance_into_section_ < 6) goto CONCAT(read_header, __LINE__); \
set_data_mode(Scanning);
#define SET_DRIVE_HEAD_MFM() \
@ -282,6 +282,10 @@ void i8272::posit_event(int event_type) {
main_status_ &= ~StatusRQM;
if(distance_into_section_ < (128 << size_)) goto get_byte;
// read CRC, without transferring it
WAIT_FOR_EVENT(Event::Token);
WAIT_FOR_EVENT(Event::Token);
// For a final result phase, post the standard ST0, ST1, ST2, C, H, R, N
goto post_st012chrn;

View File

@ -49,6 +49,10 @@ MFMController::Token MFMController::get_latest_token() {
return latest_token_;
}
NumberTheory::CRC16 &MFMController::get_crc_generator() {
return crc_generator_;
}
void MFMController::process_input_bit(int value, unsigned int cycles_since_index_hole) {
if(data_mode_ == DataMode::Writing) return;

View File

@ -70,6 +70,9 @@ class MFMController: public Controller {
/// @returns The most-recently read token from the surface of the disk.
Token get_latest_token();
/// @returns The controller's CRC generator. This is automatically fed during reading.
NumberTheory::CRC16 &get_crc_generator();
// Events
enum class Event: int {
Token = (1 << 0), // Indicates recognition of a new token in the flux stream. Use get_latest_token() for more details.