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:
scawful
2025-09-24 12:51:29 -04:00
parent f1b1c91986
commit 3734884ba3
7 changed files with 289 additions and 18 deletions

View File

@@ -13,7 +13,6 @@ namespace test {
using yaze::emu::AsmParser;
using yaze::emu::Cpu;
using yaze::emu::CpuCallbacks;
using yaze::emu::MockClock;
using yaze::emu::MockMemory;
/**
@@ -29,9 +28,8 @@ class CpuTest : public ::testing::Test {
AsmParser asm_parser;
MockMemory mock_memory;
MockClock mock_clock;
CpuCallbacks cpu_callbacks;
Cpu cpu{mock_memory, mock_clock, cpu_callbacks};
Cpu cpu{mock_memory};
};
using ::testing::_;
@@ -42,7 +40,6 @@ using ::testing::Return;
// ============================================================================
TEST_F(CpuTest, AsmParserTokenizerOk) {
AsmParser asm_parser;
std::string instruction = R"(
ADC.b #$01
LDA.b #$FF
@@ -58,7 +55,6 @@ TEST_F(CpuTest, AsmParserTokenizerOk) {
}
TEST_F(CpuTest, AsmParserSingleInstructionOk) {
AsmParser asm_parser;
std::string instruction = "ADC.b #$01";
std::vector<std::string> tokens = asm_parser.Tokenize(instruction);