1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-10 12:29:01 +00:00
CLK/Components/5380/SCSI.cpp
Thomas Harte f668e4a54c Makes an attempt at getting the 5380 past arbitration.
Not entirely successful. Also gets a bit smarter with `final` on ClockingHint::Sources.
2019-08-15 23:14:40 -04:00

35 lines
633 B
C++

//
// SCSI.cpp
// Clock Signal
//
// Created by Thomas Harte on 12/08/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#include "SCSI.hpp"
using namespace SCSI;
size_t Bus::add_device() {
const auto slot = device_states_.size();
device_states_.push_back(DefaultBusState);
return slot;
}
void Bus::set_device_output(size_t device, BusState output) {
device_states_[device] = output;
state_is_valid_ = false;
}
BusState Bus::get_state() {
if(!state_is_valid_) return state_;
state_is_valid_ = true;
state_ = DefaultBusState;
for(auto state: device_states_) {
state_ |= state;
}
return state_;
}