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:
parent
d07f3216ab
commit
47732ffb98
@ -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); \
|
CONCAT(read_header, __LINE__): WAIT_FOR_EVENT(Event::Token); \
|
||||||
header_[distance_into_section_] = get_latest_token().byte_value; \
|
header_[distance_into_section_] = get_latest_token().byte_value; \
|
||||||
distance_into_section_++; \
|
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);
|
set_data_mode(Scanning);
|
||||||
|
|
||||||
#define SET_DRIVE_HEAD_MFM() \
|
#define SET_DRIVE_HEAD_MFM() \
|
||||||
@ -282,6 +282,10 @@ void i8272::posit_event(int event_type) {
|
|||||||
main_status_ &= ~StatusRQM;
|
main_status_ &= ~StatusRQM;
|
||||||
if(distance_into_section_ < (128 << size_)) goto get_byte;
|
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
|
// For a final result phase, post the standard ST0, ST1, ST2, C, H, R, N
|
||||||
goto post_st012chrn;
|
goto post_st012chrn;
|
||||||
|
|
||||||
|
@ -49,6 +49,10 @@ MFMController::Token MFMController::get_latest_token() {
|
|||||||
return 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) {
|
void MFMController::process_input_bit(int value, unsigned int cycles_since_index_hole) {
|
||||||
if(data_mode_ == DataMode::Writing) return;
|
if(data_mode_ == DataMode::Writing) return;
|
||||||
|
|
||||||
|
@ -70,6 +70,9 @@ class MFMController: public Controller {
|
|||||||
/// @returns The most-recently read token from the surface of the disk.
|
/// @returns The most-recently read token from the surface of the disk.
|
||||||
Token get_latest_token();
|
Token get_latest_token();
|
||||||
|
|
||||||
|
/// @returns The controller's CRC generator. This is automatically fed during reading.
|
||||||
|
NumberTheory::CRC16 &get_crc_generator();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
enum class Event: int {
|
enum class Event: int {
|
||||||
Token = (1 << 0), // Indicates recognition of a new token in the flux stream. Use get_latest_token() for more details.
|
Token = (1 << 0), // Indicates recognition of a new token in the flux stream. Use get_latest_token() for more details.
|
||||||
|
Loading…
Reference in New Issue
Block a user