mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-30 19:30:17 +00:00
f668e4a54c
Not entirely successful. Also gets a bit smarter with `final` on ClockingHint::Sources.
35 lines
633 B
C++
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_;
|
|
}
|