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

Improve interface.

This commit is contained in:
Thomas Harte
2024-12-03 22:54:29 -05:00
parent 6d4ff0b89a
commit b89ecadc3a
33 changed files with 168 additions and 165 deletions
+18 -18
View File
@@ -24,17 +24,17 @@ void Storage::Tape::Tape::seek(const Time seek_time) {
Time next_time(0);
reset();
while(next_time <= seek_time) {
get_next_pulse();
next_pulse();
next_time += pulse_.length;
}
}
Storage::Time Tape::get_current_time() {
Storage::Time Tape::current_time() {
Time time(0);
uint64_t steps = get_offset();
uint64_t steps = offset();
reset();
while(steps--) {
get_next_pulse();
next_pulse();
time += pulse_.length;
}
return time;
@@ -45,13 +45,13 @@ void Storage::Tape::Tape::reset() {
serialiser_.reset();
}
Pulse Tape::get_next_pulse() {
pulse_ = serialiser_.get_next_pulse();
Pulse Tape::next_pulse() {
pulse_ = serialiser_.next_pulse();
offset_++;
return pulse_;
}
uint64_t Tape::get_offset() const {
uint64_t Tape::offset() const {
return offset_;
}
@@ -61,7 +61,7 @@ void Tape::set_offset(uint64_t offset) {
reset();
}
offset -= offset_;
while(offset--) get_next_pulse();
while(offset--) next_pulse();
}
bool Tape::is_at_end() const {
@@ -78,11 +78,11 @@ ClockingHint::Preference TapePlayer::preferred_clocking() const {
void TapePlayer::set_tape(std::shared_ptr<Storage::Tape::Tape> tape) {
tape_ = tape;
reset_timer();
get_next_pulse();
next_pulse();
update_clocking_observer();
}
std::shared_ptr<Storage::Tape::Tape> TapePlayer::get_tape() {
std::shared_ptr<Storage::Tape::Tape> TapePlayer::tape() {
return tape_;
}
@@ -90,10 +90,10 @@ bool TapePlayer::has_tape() const {
return bool(tape_);
}
void TapePlayer::get_next_pulse() {
void TapePlayer::next_pulse() {
// get the new pulse
if(tape_) {
current_pulse_ = tape_->get_next_pulse();
current_pulse_ = tape_->next_pulse();
if(tape_->is_at_end()) update_clocking_observer();
} else {
current_pulse_.length.length = 1;
@@ -104,7 +104,7 @@ void TapePlayer::get_next_pulse() {
set_next_event_time_interval(current_pulse_.length);
}
Pulse TapePlayer::get_current_pulse() const {
Pulse TapePlayer::current_pulse() const {
return current_pulse_;
}
@@ -123,8 +123,8 @@ void TapePlayer::run_for_input_pulse() {
}
void TapePlayer::process_next_event() {
process_input_pulse(current_pulse_);
get_next_pulse();
process(current_pulse_);
next_pulse();
}
// MARK: - Binary Player
@@ -157,7 +157,7 @@ void BinaryTapePlayer::set_activity_observer(Activity::Observer *observer) {
}
}
bool BinaryTapePlayer::get_motor_control() const {
bool BinaryTapePlayer::motor_control() const {
return motor_is_running_;
}
@@ -165,7 +165,7 @@ void BinaryTapePlayer::set_tape_output(bool) {
// TODO
}
bool BinaryTapePlayer::get_input() const {
bool BinaryTapePlayer::input() const {
return motor_is_running_ && input_level_;
}
@@ -177,7 +177,7 @@ void BinaryTapePlayer::set_delegate(Delegate *delegate) {
delegate_ = delegate;
}
void BinaryTapePlayer::process_input_pulse(const Storage::Tape::Pulse &pulse) {
void BinaryTapePlayer::process(const Storage::Tape::Pulse &pulse) {
bool new_input_level = pulse.type == Pulse::High;
if(input_level_ != new_input_level) {
input_level_ = new_input_level;