mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-28 08:33:34 +00:00
Finishing the STA
This commit is contained in:
+6
-6
@@ -18,8 +18,8 @@ namespace ComSquare::CPU
|
||||
//! @brief The Accumulator
|
||||
union {
|
||||
struct {
|
||||
uint8_t ah;
|
||||
uint8_t al;
|
||||
uint8_t ah;
|
||||
};
|
||||
uint16_t a;
|
||||
};
|
||||
@@ -28,8 +28,8 @@ namespace ComSquare::CPU
|
||||
//! @brief The Direct Page register;
|
||||
union {
|
||||
struct {
|
||||
uint8_t dh;
|
||||
uint8_t dl;
|
||||
uint8_t dh;
|
||||
};
|
||||
uint16_t d;
|
||||
};
|
||||
@@ -40,8 +40,8 @@ namespace ComSquare::CPU
|
||||
//! @brief The Program Counter;
|
||||
union {
|
||||
struct {
|
||||
uint8_t pch;
|
||||
uint8_t pcl;
|
||||
uint8_t pch;
|
||||
};
|
||||
uint16_t pc;
|
||||
};
|
||||
@@ -52,24 +52,24 @@ namespace ComSquare::CPU
|
||||
//! @brief The Stack pointer
|
||||
union {
|
||||
struct {
|
||||
uint8_t sh;
|
||||
uint8_t sl;
|
||||
uint8_t sh;
|
||||
};
|
||||
uint16_t s;
|
||||
};
|
||||
//! @brief The X index register
|
||||
union {
|
||||
struct {
|
||||
uint8_t xh;
|
||||
uint8_t xl;
|
||||
uint8_t xh;
|
||||
};
|
||||
uint16_t x;
|
||||
};
|
||||
//! @brief The Y index register
|
||||
union {
|
||||
struct {
|
||||
uint8_t yh;
|
||||
uint8_t yl;
|
||||
uint8_t yh;
|
||||
};
|
||||
uint16_t y;
|
||||
};
|
||||
|
||||
+20
-10
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user