Starting to test addressings modes

This commit is contained in:
AnonymusRaccoon
2020-02-10 14:47:25 +01:00
parent fd90957f21
commit a25daa18b6
8 changed files with 49 additions and 16 deletions
+4 -4
View File
@@ -227,20 +227,20 @@ namespace ComSquare::CPU
uint24_t CPU::_GetImmediateAddr()
{
return this->_registers.pc++;
return this->_registers.pac++;
}
uint24_t CPU::_GetDirectAddr()
{
uint8_t addr = this->_bus->read(this->_registers.pc++);
uint8_t addr = this->_bus->read(this->_registers.pac++);
return this->_registers.d + addr;
}
uint24_t CPU::_GetAbsoluteAddr()
{
uint24_t addr = this->_registers.dbr << 16u;
addr += this->_bus->read(this->_registers.pc++) << 8u;
addr += this->_bus->read(this->_registers.pc++);
addr += this->_bus->read(this->_registers.pac++) << 8u;
addr += this->_bus->read(this->_registers.pac++);
return addr;
}
+12 -6
View File
@@ -33,15 +33,21 @@ namespace ComSquare::CPU
};
uint16_t d;
};
//! @brief The program banK register;
uint8_t k;
//! @brief The Program Counter;
union {
struct {
uint8_t pch;
uint8_t pcl;
//! @brief The Program Bank Register;
uint8_t pbr;
//! @brief The Program Counter;
union {
struct {
uint8_t pch;
uint8_t pcl;
};
uint16_t pc;
};
};
uint16_t pc;
//! @brief The current Program Address Counter (does not exist in a snes but is useful here).
uint24_t pac;
};
//! @brief The Stack pointer
union {