1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-27 06:35:04 +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);
_speaker.set_input_rate(125000);
_tape.set_delegate(this);
}
Machine::~Machine()
@ -290,7 +291,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
break;
}
_tape.run_for_cycle();
_tape.run_for_cycles(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)
{
while(number_of_cycles--)
{
_time_into_pulse += (unsigned int)_pulse_stepper->step();
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 run_for_cycle();
inline void run_for_cycles(unsigned int number_of_cycles);
void set_is_running(bool is_running) { _is_running = is_running; }