mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-21 06:35:10 +00:00
Implementing TRB
This commit is contained in:
@@ -28,6 +28,27 @@ namespace ComSquare::CPU
|
||||
return cycles;
|
||||
}
|
||||
|
||||
int CPU::TRB(uint24_t valueAddr, AddressingMode mode)
|
||||
{
|
||||
uint16_t value = this->_bus->read(valueAddr);
|
||||
if (!this->_registers.p.m)
|
||||
value += this->_bus->read(valueAddr + 1) << 8u;
|
||||
|
||||
uint16_t newValue = value & ~this->_registers.a;
|
||||
this->_bus->write(valueAddr, newValue);
|
||||
if (!this->_registers.p.m)
|
||||
this->_bus->write(valueAddr + 1, newValue >> 8u);
|
||||
|
||||
this->_registers.p.z = (value & this->_registers.a) == 0;
|
||||
|
||||
int cycles = 0;
|
||||
if (!this->_registers.p.m)
|
||||
cycles += 2;
|
||||
if (mode == DirectPage)
|
||||
cycles += this->_registers.dl != 0;
|
||||
return cycles;
|
||||
}
|
||||
|
||||
int CPU::BIT(uint24_t valueAddr, AddressingMode mode)
|
||||
{
|
||||
unsigned negativeMask = this->_registers.p.m ? 0x80u : 0x8000u;
|
||||
|
||||
Reference in New Issue
Block a user