1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Fix meaning of flag, use correctly.

This commit is contained in:
Thomas Harte 2023-11-28 22:34:34 -05:00
parent dd4bcf68bf
commit 301442a0b1
3 changed files with 9 additions and 6 deletions

View File

@ -17,7 +17,7 @@ enum class MainStatus: uint8_t {
FDD2Seeking = 0x04,
FDD3Seeking = 0x08,
ReadOrWriteOngoing = 0x10,
CommandInProgress = 0x10,
InNonDMAExecution = 0x20,
DataIsToProcessor = 0x40,
DataReady = 0x80,
@ -107,9 +107,9 @@ class Status {
/// state appropriately.
void begin(const CommandDecoder &command) {
set(MainStatus::DataReady, false);
set(MainStatus::CommandInProgress, true);
if(command.is_access()) {
set(MainStatus::ReadOrWriteOngoing, true);
status_[0] = command.drive_head();
}
}

View File

@ -218,7 +218,7 @@ void i8272::posit_event(int event_type) {
wait_for_command:
expects_input_ = false;
set_data_mode(Storage::Disk::MFMController::DataMode::Scanning);
status_.set(MainStatus::ReadOrWriteOngoing, false);
status_.set(MainStatus::CommandInProgress, false);
status_.set(MainStatus::InNonDMAExecution, false);
command_.clear();
@ -246,7 +246,6 @@ void i8272::posit_event(int event_type) {
is_access_command_ = command_.is_access();
if(is_access_command_) {
status_.set(MainStatus::ReadOrWriteOngoing, true);
for(int c = 0; c < 4; c++) {
if(drives_[c].phase == Drive::Seeking) {
drives_[c].phase = Drive::NotSeeking;

View File

@ -40,6 +40,9 @@
namespace PCCompatible {
//bool log = false;
//std::string previous;
class FloppyController {
public:
FloppyController(PIC &pic, DMA &dma) : pic_(pic), dma_(dma) {}
@ -58,6 +61,7 @@ class FloppyController {
if(!hold_reset && hold_reset_) {
// TODO: add a delay mechanism.
reset();
// log = true;
}
hold_reset_ = hold_reset;
if(hold_reset_) {
@ -115,6 +119,7 @@ class FloppyController {
using MainStatus = Intel::i8272::MainStatus;
status_.set(MainStatus::DataIsToProcessor, true);
status_.set(MainStatus::DataReady, true);
status_.set(MainStatus::CommandInProgress, true);
}
}
}
@ -125,6 +130,7 @@ class FloppyController {
const uint8_t result = results_.next();
if(results_.empty()) {
status_.set(MainStatus::DataIsToProcessor, false);
status_.set(MainStatus::CommandInProgress, false);
}
printf("FDC read: %02x\n", result);
return result;
@ -1084,8 +1090,6 @@ class ConcreteMachine:
}
// MARK: - TimedMachine.
// bool log = false;
// std::string previous;
void run_for(const Cycles duration) override {
const auto pit_ticks = duration.as_integral();
cpu_divisor_ += pit_ticks;