mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 18:30:21 +00:00
Added insurance against an infinite loop should the tape be exhausted.
This commit is contained in:
parent
c3a795328d
commit
e3571e8b9e
@ -136,7 +136,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
// CPU or 6560 costs.
|
||||
if(_use_fast_tape_hack && _tape.has_tape() && address == 0xf92f && operation == CPU6502::BusOperation::ReadOpcode)
|
||||
{
|
||||
while(!_userPortVIA->get_interrupt_line() && !_keyboardVIA->get_interrupt_line())
|
||||
while(!_userPortVIA->get_interrupt_line() && !_keyboardVIA->get_interrupt_line() && !_tape.get_tape()->is_at_end())
|
||||
{
|
||||
_userPortVIA->run_for_half_cycles(2);
|
||||
_keyboardVIA->run_for_half_cycles(2);
|
||||
@ -184,7 +184,10 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
_is_running_at_zero_cost = true;
|
||||
set_clock_is_unlimited(true);
|
||||
}
|
||||
if(address < 0xe000 && operation == CPU6502::BusOperation::ReadOpcode)
|
||||
if(
|
||||
(address < 0xe000 && operation == CPU6502::BusOperation::ReadOpcode) ||
|
||||
_tape.get_tape()->is_at_end()
|
||||
)
|
||||
{
|
||||
_is_running_at_zero_cost = false;
|
||||
set_clock_is_unlimited(false);
|
||||
|
@ -50,6 +50,11 @@ void TapePlayer::set_tape(std::shared_ptr<Storage::Tape::Tape> tape)
|
||||
get_next_pulse();
|
||||
}
|
||||
|
||||
std::shared_ptr<Storage::Tape::Tape> TapePlayer::get_tape()
|
||||
{
|
||||
return _tape;
|
||||
}
|
||||
|
||||
bool TapePlayer::has_tape()
|
||||
{
|
||||
return (bool)_tape;
|
||||
|
@ -78,6 +78,7 @@ class TapePlayer: public TimedEventLoop {
|
||||
|
||||
void set_tape(std::shared_ptr<Storage::Tape::Tape> tape);
|
||||
bool has_tape();
|
||||
std::shared_ptr<Storage::Tape::Tape> get_tape();
|
||||
|
||||
void run_for_cycles(int number_of_cycles);
|
||||
void run_for_input_pulse();
|
||||
|
Loading…
Reference in New Issue
Block a user