diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index f432e052e..6bf3f90df 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -319,7 +319,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation cycles_since_display_update_ += cycles; cycles_since_audio_update_ += cycles; if(cycles_since_audio_update_ > 16384) update_audio(); - tape_.run_for_cycles(cycles); + tape_.run_for(Cycles((int)cycles)); cycles_until_display_interrupt_ -= cycles; if(cycles_until_display_interrupt_ < 0) { diff --git a/Machines/Electron/Tape.cpp b/Machines/Electron/Tape.cpp index a328bc23d..2aac4b172 100644 --- a/Machines/Electron/Tape.cpp +++ b/Machines/Electron/Tape.cpp @@ -80,14 +80,14 @@ void Tape::acorn_shifter_output_bit(int value) { push_tape_bit((uint16_t)value); } -void Tape::run_for_cycles(unsigned int number_of_cycles) { +void Tape::run_for(const Cycles &cycles) { if(is_enabled_) { if(is_in_input_mode_) { if(is_running_) { - TapePlayer::run_for(Cycles((int)number_of_cycles)); + TapePlayer::run_for(cycles); } } else { - output_.cycles_into_pulse += number_of_cycles; + output_.cycles_into_pulse += (unsigned int)cycles.as_int(); while(output_.cycles_into_pulse > 1664) { // 1664 = the closest you can get to 1200 baud if you're looking for something output_.cycles_into_pulse -= 1664; // that divides the 125,000Hz clock that the sound divider runs off. push_tape_bit(1); diff --git a/Machines/Electron/Tape.hpp b/Machines/Electron/Tape.hpp index 2d499e5e7..22e5e5f88 100644 --- a/Machines/Electron/Tape.hpp +++ b/Machines/Electron/Tape.hpp @@ -12,18 +12,20 @@ #include "../../Storage/Tape/Tape.hpp" #include "../../Storage/Tape/Parsers/Acorn.hpp" #include "Interrupts.hpp" +#include "../../Components/ClockReceiver.hpp" #include namespace Electron { class Tape: + public ClockReceiver, public Storage::Tape::TapePlayer, public Storage::Tape::Acorn::Shifter::Delegate { public: Tape(); - void run_for_cycles(unsigned int number_of_cycles); + void run_for(const Cycles &cycles); uint8_t get_data_register(); void set_data_register(uint8_t value);