mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-11-15 21:10:07 +00:00
2c23289caa
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
25 lines
494 B
C++
25 lines
494 B
C++
#pragma once
|
|
|
|
#include "Chip.h"
|
|
#include "EventArgs.h"
|
|
#include "Signal.h"
|
|
|
|
namespace EightBit {
|
|
class ClockedChip : public Chip {
|
|
public:
|
|
~ClockedChip() {};
|
|
|
|
Signal<EventArgs> Ticked;
|
|
|
|
void tick(const int extra) { for (int i = 0; i < extra; ++i) tick(); }
|
|
void tick() { ++m_cycles; Ticked.fire(EventArgs::empty()); }
|
|
[[nodiscard]] auto cycles() const noexcept { return m_cycles; }
|
|
|
|
protected:
|
|
void resetCycles() noexcept { m_cycles = 0; }
|
|
|
|
private:
|
|
int m_cycles = 0;
|
|
};
|
|
}
|