Finishing the STA

This commit is contained in:
AnonymusRaccoon
2020-02-13 11:23:36 +01:00
parent a6c3e54f9f
commit 8aa138de85
2 changed files with 26 additions and 16 deletions
+20 -10
View File
@@ -8,13 +8,23 @@
#include "../tests.hpp"
#include "../../sources/SNES.hpp"
using namespace ComSquare;
//
//Test(STA, 8bits)
//{
// auto pair = Init();
// pair.second.cpu->_registers.p.m = false;
// pair.second.cpu->_registers.a = 0x11;
// pair.second.cpu->STA(0x0);
// auto data = pair.second.wram->_data[0];
// cr_assert_eq(data, 0x11, "The stored value should be 0x11 but it was 0x%x.", data);
//}
Test(STA, 8bits)
{
auto pair = Init();
pair.second.cpu->_registers.p.m = true;
pair.second.cpu->_registers.a = 0x11;
pair.second.cpu->STA(0x0);
auto data = pair.second.wram->_data[0];
cr_assert_eq(data, 0x11, "The stored value should be 0x11 but it was 0x%x.", data);
}
Test(STA, 16bits)
{
auto pair = Init();
pair.second.cpu->_registers.p.m = false;
pair.second.cpu->_registers.a = 0x11AB;
pair.second.cpu->STA(0x0);
auto data = pair.second.wram->_data[0] + (pair.second.wram->_data[1] << 8u);
cr_assert_eq(data, 0x11AB, "The stored value should be 0x11AB but it was 0x%x.", data);
}