From 98751e6ac88498c888d6d72114926eb7a5a1798c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 15 Sep 2017 22:59:26 -0400 Subject: [PATCH] Ensures that all result phases are exactly the intended length by replacing accumulation with assignment. Also attempts a different version of control mark behaviour. Experiments. --- Components/8272/i8272.cpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Components/8272/i8272.cpp b/Components/8272/i8272.cpp index 3f02acf15..af26b4812 100644 --- a/Components/8272/i8272.cpp +++ b/Components/8272/i8272.cpp @@ -44,6 +44,7 @@ using namespace Intel::i8272; #define SetMissingAddressMark() (status_[1] |= 0x01) #define SetControlMark() (status_[2] |= 0x40) +#define ClearControlMark() (status_[2] &= ~0x40) #define ControlMark() (status_[2] & 0x40) #define SetDataFieldDataError() (status_[2] |= 0x20) @@ -437,6 +438,7 @@ void i8272::posit_event(int event_type) { // flag doesn't match the sort the command was looking for. read_data_found_header: FIND_DATA(); + ClearControlMark(); if(event_type == (int)Event::Token) { if(get_latest_token().type != Token::Data && get_latest_token().type != Token::DeletedData) { // Something other than a data mark came next — impliedly an ID or index mark. @@ -779,10 +781,9 @@ void i8272::posit_event(int event_type) { main_status_ &= ~(1 << found_drive); SetSeekEnd(); - result_stack_.push_back(drives_[found_drive].head_position); - result_stack_.push_back(status_[0]); + result_stack_ = { drives_[found_drive].head_position, status_[0]}; } else { - result_stack_.push_back(0x80); + result_stack_ = { 0x80 }; } } goto post_result; @@ -805,20 +806,22 @@ void i8272::posit_event(int event_type) { { int drive = command_[1] & 3; select_drive(drive); - result_stack_.push_back( - (command_[1] & 7) | // drive and head number - 0x08 | // single sided - (get_drive().get_is_track_zero() ? 0x10 : 0x00) | - (get_drive().get_is_ready() ? 0x20 : 0x00) | - (get_drive().get_is_read_only() ? 0x40 : 0x00) - ); + result_stack_= { + static_cast( + (command_[1] & 7) | // drive and head number + 0x08 | // single sided + (get_drive().get_is_track_zero() ? 0x10 : 0x00) | + (get_drive().get_is_ready() ? 0x20 : 0x00) | + (get_drive().get_is_read_only() ? 0x40 : 0x00) + ) + }; } goto post_result; // Performs any invalid command. invalid: // A no-op, but posts ST0 (but which ST0?) - result_stack_.push_back(0x80); + result_stack_ = {0x80}; goto post_result; // Sets abnormal termination of the current command and proceeds to an ST0, ST1, ST2, C, H, R, N result phase. @@ -831,14 +834,7 @@ void i8272::posit_event(int event_type) { post_st012chrn: SCHEDULE_HEAD_UNLOAD(); - result_stack_.push_back(size_); - result_stack_.push_back(sector_); - result_stack_.push_back(head_); - result_stack_.push_back(cylinder_); - - result_stack_.push_back(status_[2]); - result_stack_.push_back(status_[1]); - result_stack_.push_back(status_[0]); + result_stack_ = {size_, sector_, head_, cylinder_, status_[2], status_[1], status_[0]}; goto post_result;