diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index 272d7b4d0..d8c21c4e3 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -23,10 +23,16 @@ void WD1770::set_register(int address, uint8_t value) { switch(address&3) { case 0: { if((value&0xf0) == 0xd0) { - printf("!!!TODO: force interrupt!!!\n"); - update_status([] (Status &status) { - status.type = Status::One; - }); + if(value == 0xd0) { + // Force interrupt **immediately**. + printf("Force interrupt immediately\n"); + posit_event(static_cast(Event1770::ForceInterrupt)); + } else { + printf("!!!TODO: force interrupt!!!\n"); + update_status([] (Status &status) { + status.type = Status::One; + }); + } } else { command_ = value; posit_event(static_cast(Event1770::Command)); @@ -169,13 +175,22 @@ void WD1770::posit_event(int new_event_type) { } } - if(!(interesting_event_mask_ & static_cast(new_event_type))) return; - interesting_event_mask_ &= ~new_event_type; + if(new_event_type == static_cast(Event1770::ForceInterrupt)) { + interesting_event_mask_ = 0; + resume_point_ = 0; + update_status([] (Status &status) { + status.type = Status::One; + }); + } else { + if(!(interesting_event_mask_ & static_cast(new_event_type))) return; + interesting_event_mask_ &= ~new_event_type; + } Status new_status; BEGIN_SECTION() // Wait for a new command, branch to the appropriate handler. + case 0: wait_for_command: printf("Idle...\n"); set_data_mode(DataMode::Scanning); diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index aa15a5259..52d544824 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -116,7 +116,8 @@ class WD1770: public Storage::Disk::MFMController { Command = (1 << 3), // Indicates receipt of a new command. HeadLoad = (1 << 4), // Indicates the head has been loaded (1973 only). Timer = (1 << 5), // Indicates that the delay_time_-powered timer has timed out. - IndexHoleTarget = (1 << 6) // Indicates that index_hole_count_ has reached index_hole_count_target_. + IndexHoleTarget = (1 << 6), // Indicates that index_hole_count_ has reached index_hole_count_target_. + ForceInterrupt = (1 << 7) // Indicates a forced interrupt. }; void posit_event(int type); int interesting_event_mask_;