Apu callback, CPU instruction lengths

This commit is contained in:
scawful
2023-12-03 05:37:42 -05:00
parent a0019ab7fb
commit ca9cc42d6b
3 changed files with 37 additions and 4 deletions

View File

@@ -43,11 +43,14 @@ void APU::Update() {
for (auto i = 0; i < cycles_to_run; ++i) {
// Update the APU
// ...
UpdateChannelSettings();
// Update the SPC700
// ...
uint8_t opcode = spc700_.read(spc700_.PC);
spc700_.ExecuteInstructions(opcode);
}
ProcessSamples();
}
void APU::ProcessSamples() {

View File

@@ -157,6 +157,10 @@ class APU : public Observer {
}
}
void SetReadyCallback(std::function<void()> callback) {
ready_callback_ = callback;
}
private:
// Constants for communication
static const uint8_t READY_SIGNAL_0 = 0xAA;
@@ -187,6 +191,8 @@ class APU : public Observer {
DigitalSignalProcessor dsp_;
SPC700 spc700_{aram_};
std::vector<int16_t> audioSamples_;
std::function<void()> ready_callback_;
};
} // namespace emu