1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Make an attempt at providing varied sense interrupt statuses.

This commit is contained in:
Thomas Harte 2023-11-28 14:12:39 -05:00
parent c19c356c10
commit b860fba0a3
4 changed files with 19 additions and 6 deletions

View File

@ -114,8 +114,8 @@ class Status {
}
}
void end_sense_interrupt_status(int drive) {
status_[0] = uint8_t(drive);
void end_sense_interrupt_status(int drive, int head) {
status_[0] = uint8_t(drive | (head << 2));
main_status_ &= ~(1 << drive);
}

View File

@ -709,7 +709,7 @@ void i8272::posit_event(int event_type) {
// If a drive was found, return its results. Otherwise return a single 0x80.
if(found_drive != -1) {
drives_[found_drive].phase = Drive::NotSeeking;
status_.end_sense_interrupt_status(found_drive);
status_.end_sense_interrupt_status(found_drive, 0);
status_.set(Status0::SeekEnded);
result_stack_ = { drives_[found_drive].head_position, status_[0]};

View File

@ -83,8 +83,19 @@ class FloppyController {
case Command::SenseInterruptStatus:
pic_.apply_edge<6>(false);
// results_.serialise(status_, 0);
results_.serialise_none();
if(interrupting_drives_) {
int drive = 3;
while(!(interrupting_drives_ & (1 << drive))) {
--drive;
}
interrupting_drives_ &= ~(1 << drive);
status_.end_sense_interrupt_status(drive, 0);
results_.serialise(status_, 10);
} else {
results_.serialise_none();
}
break;
}
@ -121,6 +132,7 @@ class FloppyController {
decoder_.clear();
status_.reset();
pic_.apply_edge<6>(true);
interrupting_drives_ = 0xf;
using MainStatus = Intel::i8272::MainStatus;
status_.set(MainStatus::DataReady, true);
@ -136,6 +148,7 @@ class FloppyController {
Intel::i8272::CommandDecoder decoder_;
Intel::i8272::Status status_;
Intel::i8272::Results results_;
int interrupting_drives_ = 0;
};
class KeyboardController {

View File

@ -62,7 +62,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES"