Refactor Snes class and enhance Apu functionality
- Updated Snes constructor to initialize CPU callbacks directly, improving readability and maintainability. - Removed unnecessary CpuCallbacks parameter from Cpu constructor, streamlining the class design. - Added new methods in Apu for retrieving cycles, status, control, and handling DMA transfers, enhancing audio processing capabilities. - Introduced unit tests for Apu to validate initialization, sample generation, and handshake timing, ensuring robust audio functionality.
This commit is contained in:
@@ -31,10 +31,12 @@ class InstructionEntry {
|
||||
|
||||
class Cpu {
|
||||
public:
|
||||
explicit Cpu(Memory& mem, CpuCallbacks& callbacks)
|
||||
: memory(mem), callbacks_(callbacks) {}
|
||||
explicit Cpu(Memory& mem) : memory(mem) {}
|
||||
void Reset(bool hard = false);
|
||||
|
||||
auto& callbacks() { return callbacks_; }
|
||||
const auto& callbacks() const { return callbacks_; }
|
||||
|
||||
void RunOpcode();
|
||||
|
||||
void ExecuteInstruction(uint8_t opcode);
|
||||
@@ -781,8 +783,8 @@ class Cpu {
|
||||
bool int_wanted_ = false;
|
||||
bool int_delay_ = false;
|
||||
|
||||
CpuCallbacks callbacks_;
|
||||
Memory& memory;
|
||||
CpuCallbacks callbacks_;
|
||||
};
|
||||
|
||||
} // namespace emu
|
||||
|
||||
Reference in New Issue
Block a user