mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-25 07:33:32 +00:00
Implementing the LDX
This commit is contained in:
+25
-25
@@ -90,78 +90,78 @@ Test(STZ, 16bits)
|
||||
cr_assert_eq(data, 0x00, "The stored value should be 0x00 but it was 0x%x.", data);
|
||||
}
|
||||
|
||||
Test(LDA, 8bits)
|
||||
Test(LDX, 8bits)
|
||||
{
|
||||
auto pair = Init();
|
||||
pair.second.cpu->_registers.p.m = true;
|
||||
pair.second.cpu->_registers.p.x_b = true;
|
||||
pair.second.wram->_data[0] = 0x01;
|
||||
pair.second.cpu->LDA(0x0);
|
||||
auto data = pair.second.cpu->_registers.a;
|
||||
pair.second.cpu->LDX(0x0);
|
||||
auto data = pair.second.cpu->_registers.x;
|
||||
cr_assert_eq(data, 0x01, "The stored value should be 0x01 but it was 0x%x.", data);
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.z, false, "The zero flag register should not be set.");
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.n, false, "The negative flag register should not be set.");
|
||||
}
|
||||
|
||||
Test(LDA, 8bitsNegative)
|
||||
Test(LDX, 8bitsNegative)
|
||||
{
|
||||
auto pair = Init();
|
||||
pair.second.cpu->_registers.p.m = true;
|
||||
pair.second.cpu->_registers.p.x_b = true;
|
||||
pair.second.wram->_data[0] = 0x11;
|
||||
pair.second.cpu->LDA(0x0);
|
||||
auto data = pair.second.cpu->_registers.a;
|
||||
pair.second.cpu->LDX(0x0);
|
||||
auto data = pair.second.cpu->_registers.x;
|
||||
cr_assert_eq(data, 0x11, "The stored value should be 0x11 but it was 0x%x.", data);
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.z, false, "The zero flag register should not be set.");
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.n, true, "The negative flag register should be set.");
|
||||
}
|
||||
|
||||
Test(LDA, 8bitsZero)
|
||||
Test(LDX, 8bitsZero)
|
||||
{
|
||||
auto pair = Init();
|
||||
pair.second.cpu->_registers.p.m = true;
|
||||
pair.second.cpu->_registers.p.x_b = true;
|
||||
pair.second.wram->_data[0] = 0x00;
|
||||
pair.second.wram->_data[1] = 0x11;
|
||||
pair.second.cpu->LDA(0x0);
|
||||
auto data = pair.second.cpu->_registers.a;
|
||||
pair.second.cpu->LDX(0x0);
|
||||
auto data = pair.second.cpu->_registers.x;
|
||||
cr_assert_eq(data, 0x00, "The stored value should be 0x00 but it was 0x%x.", data);
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.z, true, "The zero flag register should be set.");
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.n, false, "The negative flag register should not be set.");
|
||||
}
|
||||
|
||||
Test(LDA, 16bits)
|
||||
Test(LDX, 16bits)
|
||||
{
|
||||
auto pair = Init();
|
||||
pair.second.cpu->_registers.p.m = false;
|
||||
pair.second.cpu->_registers.p.x_b = false;
|
||||
pair.second.wram->_data[0] = 0xAB;
|
||||
pair.second.wram->_data[1] = 001;
|
||||
pair.second.cpu->LDA(0x0);
|
||||
auto data = pair.second.cpu->_registers.a;
|
||||
pair.second.cpu->LDX(0x0);
|
||||
auto data = pair.second.cpu->_registers.x;
|
||||
cr_assert_eq(data, 0x01AB, "The stored value should be 0x01AB but it was 0x%x.", data);
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.z, false, "The zero flag register should not be set.");
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.n, false, "The negative flag register should not be set.");
|
||||
}
|
||||
|
||||
Test(LDA, 16bitsNegative)
|
||||
Test(LDX, 16bitsNegative)
|
||||
{
|
||||
auto pair = Init();
|
||||
pair.second.cpu->_registers.p.m = false;
|
||||
pair.second.cpu->_registers.p.x_b = false;
|
||||
pair.second.wram->_data[0] = 0xAB;
|
||||
pair.second.wram->_data[1] = 0x11;
|
||||
pair.second.cpu->LDA(0x0);
|
||||
auto data = pair.second.cpu->_registers.a;
|
||||
pair.second.cpu->LDX(0x0);
|
||||
auto data = pair.second.cpu->_registers.x;
|
||||
cr_assert_eq(data, 0x11AB, "The stored value should be 0x11AB but it was 0x%x.", data);
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.z, false, "The zero flag register should not be set.");
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.n, true, "The negative flag register should be set.");
|
||||
}
|
||||
|
||||
Test(LDA, 16bitsZero)
|
||||
Test(LDX, 16bitsZero)
|
||||
{
|
||||
auto pair = Init();
|
||||
pair.second.cpu->_registers.p.m = false;
|
||||
pair.second.cpu->_registers.p.x_b = false;
|
||||
pair.second.wram->_data[0] = 0x00;
|
||||
pair.second.wram->_data[1] = 0x00;
|
||||
pair.second.cpu->LDA(0x0);
|
||||
auto data = pair.second.cpu->_registers.a;
|
||||
pair.second.cpu->LDX(0x0);
|
||||
auto data = pair.second.cpu->_registers.x;
|
||||
cr_assert_eq(data, 0x0000, "The stored value should be 0x0000 but it was 0x%x.", data);
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.z, true, "The zero flag register should be set.");
|
||||
cr_assert_eq(pair.second.cpu->_registers.p.n, false, "The negative flag register should not be set.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user