diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 6c0c91ae2..49f9c7a28 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -15,7 +15,8 @@ using namespace Commodore::Vic20; Machine::Machine() : - _rom(nullptr) + _rom(nullptr), + _is_running_at_zero_cost(false) { // create 6522s, serial port and bus _userPortVIA.reset(new UserPortVIA); @@ -115,7 +116,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin // } // run the phase-1 part of this cycle, in which the VIC accesses memory - _mos6560->run_for_cycles(1); + if(!_is_running_at_zero_cost) _mos6560->run_for_cycles(1); // run the phase-2 part of the cycle, which is whatever the 6502 said it should be if(isReadOperation(operation)) @@ -165,7 +166,14 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin } _tape.run_for_cycles(1); if(_c1540) _c1540->run_for_cycles(1); - return 1; + + if(_use_fast_tape_hack && operation == CPU6502::BusOperation::ReadOpcode) + { + if(address == 0xF98E) _is_running_at_zero_cost = true; + if(address == 0xff56) _is_running_at_zero_cost = false; + } + + return _is_running_at_zero_cost ? 0 : 1; } #pragma mark - 6522 delegate diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp index 4a9a65865..7893dea7d 100644 --- a/Machines/Commodore/Vic-20/Vic20.hpp +++ b/Machines/Commodore/Vic-20/Vic20.hpp @@ -334,6 +334,7 @@ class Machine: // Tape Tape _tape; bool _use_fast_tape_hack, _should_automatically_load_media; + bool _is_running_at_zero_cost; // Disk std::shared_ptr<::Commodore::C1540::Machine> _c1540;