1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 19:17:52 +00:00

Adds SCSI bus clocking to the Macintosh, and fixes its internal counting.

This commit is contained in:
Thomas Harte
2019-09-02 16:03:33 -04:00
parent 2f8e31bc8b
commit 318cdb41ea
3 changed files with 10 additions and 6 deletions
+3 -3
View File
@@ -73,16 +73,16 @@ void Bus::add_observer(Observer *observer) {
}
ClockingHint::Preference Bus::preferred_clocking() {
return (dispatch_index_ < sizeof(dispatch_times_)) ? ClockingHint::Preference::RealTime : ClockingHint::Preference::None;
return (dispatch_index_ < dispatch_times_.size()) ? ClockingHint::Preference::RealTime : ClockingHint::Preference::None;
}
void Bus::run_for(HalfCycles time) {
if(dispatch_index_ < sizeof(dispatch_times_)) {
if(dispatch_index_ < dispatch_times_.size()) {
time_in_state_ += time;
const auto old_index = dispatch_index_;
const auto time_as_int = time_in_state_.as_int();
while(time_as_int >= dispatch_times_[dispatch_index_] && dispatch_index_ < sizeof(dispatch_times_)) {
while(time_as_int >= dispatch_times_[dispatch_index_] && dispatch_index_ < dispatch_times_.size()) {
++dispatch_index_;
}
+2 -1
View File
@@ -9,6 +9,7 @@
#ifndef SCSI_hpp
#define SCSI_hpp
#include <array>
#include <limits>
#include <vector>
@@ -138,7 +139,7 @@ class Bus: public ClockingHint::Source {
HalfCycles time_in_state_;
double cycles_to_time_ = 1.0;
size_t dispatch_index_ = 0;
int dispatch_times_[8];
std::array<int, 8> dispatch_times_;
std::vector<BusState> device_states_;
BusState state_ = DefaultBusState;