feat: Refactor Emulator to Accept ROM Parameter and Enhance Logging
- Updated Emulator::Run method to accept a Rom* parameter, improving flexibility in ROM handling. - Refactored texture creation and ROM data initialization to utilize the new parameter. - Enhanced logging in Snes class to provide detailed information during initialization, reset, and frame processing, aiding in debugging and performance monitoring. - Introduced cycle tracking in Apu and Spc700 classes for accurate synchronization and debugging. - Added unit tests for APU DSP functionality and IPL ROM handshake to ensure reliability and correctness of audio processing.
This commit is contained in:
30
test/unit/emu/spc700_reset_test.cc
Normal file
30
test/unit/emu/spc700_reset_test.cc
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "app/emu/audio/apu.h"
|
||||
#include "app/emu/memory/memory.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace emu {
|
||||
|
||||
TEST(Spc700ResetTest, ResetVectorExecutesIplSequence) {
|
||||
MemoryImpl mem;
|
||||
std::vector<uint8_t> dummy_rom(0x200000, 0);
|
||||
mem.Initialize(dummy_rom);
|
||||
|
||||
Apu apu(mem);
|
||||
apu.Init();
|
||||
apu.Reset();
|
||||
|
||||
// After reset, running some cycles should advance SPC PC from IPL entry
|
||||
uint16_t pc_before = apu.spc700().PC;
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
apu.spc700().RunOpcode();
|
||||
apu.Cycle();
|
||||
}
|
||||
uint16_t pc_after = apu.spc700().PC;
|
||||
EXPECT_NE(pc_after, pc_before);
|
||||
}
|
||||
|
||||
} // namespace emu
|
||||
} // namespace yaze
|
||||
|
||||
Reference in New Issue
Block a user