Update Clock class for cycle accurate components

This commit is contained in:
scawful
2023-08-20 22:30:06 -04:00
parent 2f6c6d414c
commit 2ec43cfb3f
11 changed files with 146 additions and 133 deletions

View File

@@ -3,6 +3,7 @@
#include <cstdint>
#include "app/emu/clock.h"
#include "app/emu/mem.h"
#include "app/emu/spc700.h"
@@ -10,7 +11,11 @@ namespace yaze {
namespace app {
namespace emu {
class APU : public SPC700 {
const int kApuClockSpeed = 1024000; // 1.024 MHz
const int apuSampleRate = 32000; // 32 KHz
const int apuClocksPerSample = 64; // 64 clocks per sample
class APU : public SPC700, public Clock {
public:
// Initializes the APU with the necessary resources and dependencies
APU(Memory &memory);
@@ -20,8 +25,8 @@ class APU : public SPC700 {
// Resets the APU to its initial state
void Reset();
// Runs the APU for a specified number of clock cycles
void Run(int cycles);
// Runs the APU for one frame
void Update();
// Reads a byte from the specified APU register
uint8_t ReadRegister(uint16_t address);