1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-11 03:25:06 +00:00

Fixed failure to set a delegate, slowed tape speed if operating in RAM.

This commit is contained in:
Thomas Harte
2016-01-23 11:42:14 -05:00
parent 43a7d1b7ae
commit 949c33774a
2 changed files with 31 additions and 27 deletions

View File

@@ -35,6 +35,7 @@ Machine::Machine() :
memset(_roms[c], 0xff, 16384); memset(_roms[c], 0xff, 16384);
_speaker.set_input_rate(125000); _speaker.set_input_rate(125000);
_tape.set_delegate(this);
} }
Machine::~Machine() Machine::~Machine()
@@ -290,7 +291,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
break; break;
} }
_tape.run_for_cycle(); _tape.run_for_cycles(cycles);
return cycles; return cycles;
} }
@@ -657,9 +658,11 @@ inline void Tape::clear_interrupts(uint8_t interrupts)
} }
} }
inline void Tape::run_for_cycle() inline void Tape::run_for_cycles(unsigned int number_of_cycles)
{ {
if(_is_running && _tape != nullptr) if(_is_running && _tape != nullptr)
{
while(number_of_cycles--)
{ {
_time_into_pulse += (unsigned int)_pulse_stepper->step(); _time_into_pulse += (unsigned int)_pulse_stepper->step();
if(_time_into_pulse == _current_pulse.length.length) if(_time_into_pulse == _current_pulse.length.length)
@@ -693,4 +696,5 @@ inline void Tape::run_for_cycle()
} }
} }
} }
}
} }

View File

@@ -74,7 +74,7 @@ class Tape {
}; };
inline void set_delegate(Delegate *delegate) { _delegate = delegate; } inline void set_delegate(Delegate *delegate) { _delegate = delegate; }
inline void run_for_cycle(); inline void run_for_cycles(unsigned int number_of_cycles);
void set_is_running(bool is_running) { _is_running = is_running; } void set_is_running(bool is_running) { _is_running = is_running; }