Fixing a bug with the write in 0x0

This commit is contained in:
AnonymusRaccoon
2020-02-13 11:09:18 +01:00
parent b1a2222b55
commit a6c3e54f9f
11 changed files with 96 additions and 9 deletions
+11
View File
@@ -441,4 +441,15 @@ namespace ComSquare::CPU
base += this->_registers.dbr << 16u;
return base + this->_registers.y;
}
unsigned CPU::STA(uint24_t addr)
{
if (this->_registers.p.m)
this->_bus->write(addr, this->_registers.al);
else {
this->_bus->write(addr, this->_registers.al);
this->_bus->write(addr + 1, this->_registers.ah);
}
return 0;
}
}
+2
View File
@@ -288,6 +288,8 @@ namespace ComSquare::CPU
//! @brief Add with carry - Adds operand to the Accumulator; adds an additional 1 if carry is set.
//! @return The number of extra cycles that this operation took.
unsigned ADC(uint24_t valueAddr);
//! @brief Store the accumulator to memory.
unsigned STA(uint24_t addr);
public:
explicit CPU(std::shared_ptr<Memory::MemoryBus> bus, Cartridge::Header &cartridgeHeader);
//! @brief This function continue to execute the Cartridge code.