1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-03 11:30:02 +00:00

The 6560 is now a ClockReceiver. This reduces to zero the number of remaining instances of the text run_for_cycles in this codebase.

This commit is contained in:
Thomas Harte 2017-07-24 22:38:35 -04:00
parent a6e377aa57
commit c77a83d86f
2 changed files with 6 additions and 3 deletions

View File

@ -11,6 +11,7 @@
#include "../../Outputs/CRT/CRT.hpp"
#include "../../Outputs/Speaker.hpp"
#include "../ClockReceiver.hpp"
namespace MOS {
@ -40,7 +41,7 @@ class Speaker: public ::Outputs::Filter<Speaker> {
@c set_register and @c get_register provide register access.
*/
template <class T> class MOS6560 {
template <class T> class MOS6560: public ClockReceiver<MOS6560<T>> {
public:
MOS6560() :
crt_(new Outputs::CRT::CRT(65*4, 4, Outputs::CRT::NTSC60, 2)),
@ -149,7 +150,9 @@ template <class T> class MOS6560 {
/*!
Runs for cycles. Derr.
*/
inline void run_for_cycles(unsigned int number_of_cycles) {
inline void run_for(const Cycles &cycles) {
int number_of_cycles = cycles.as_int();
// keep track of the amount of time since the speaker was updated; lazy updates are applied
cycles_since_speaker_update_ += number_of_cycles;

View File

@ -99,7 +99,7 @@ Machine::~Machine() {
unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
// run the phase-1 part of this cycle, in which the VIC accesses memory
if(!is_running_at_zero_cost_) 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)) {