Finishing to implements JSR/JLR and push

This commit is contained in:
AnonymusRaccoon
2020-02-14 15:20:19 +01:00
parent 31aa3c843e
commit 55d87bf9ac
5 changed files with 302 additions and 12 deletions
@@ -19,4 +19,90 @@ namespace ComSquare::CPU
this->_registers.p.m = true;
}
}
void CPU::JSR(uint24_t valueAddr)
{
this->_push(--this->_registers.pc);
this->_registers.pc = this->_bus->read(valueAddr) + (this->_bus->read(valueAddr + 1) << 8u);
}
void CPU::JSL(uint24_t valueAddr)
{
this->_registers.pac--;
this->_push(this->_registers.pbr);
this->_push(this->_registers.pc);
this->_registers.pc = this->_bus->read(valueAddr) + (this->_bus->read(valueAddr + 1) << 8u);
}
void CPU::PHA()
{
this->_push(this->_registers.a);
}
void CPU::PHB()
{
this->_push(this->_registers.dbr);
}
void CPU::PHD()
{
this->_push(this->_registers.d);
}
void CPU::PHK()
{
this->_push(this->_registers.pbr);
}
void CPU::PHP()
{
this->_push(this->_registers.p.flags);
}
void CPU::PHX()
{
this->_push(this->_registers.x);
}
void CPU::PHY()
{
this->_push(this->_registers.y);
}
void CPU::PLA()
{
this->_registers.a = this->_pop16();
this->_registers.p.z = this->_registers.a == 0;
this->_registers.p.n = this->_registers.a & 0x8000u;
}
void CPU::PLB()
{
}
void CPU::PLD()
{
}
void CPU::PLK()
{
}
void CPU::PLP()
{
}
void CPU::PLX()
{
}
void CPU::PLY()
{
}
}