Adding 8-bit Logical Operations

Testing every current operands
This commit is contained in:
Melefo
2020-02-26 20:57:05 +01:00
parent 2776be601e
commit 27c1220ca7
10 changed files with 457 additions and 85 deletions
+56
View File
@@ -0,0 +1,56 @@
//
// Created by Melefo on 26/02/2020.
//
#include "../APU.hpp"
namespace ComSquare::APU
{
int APU::AND(uint24_t operand1, uint24_t operand2, int cycles)
{
uint8_t data = this->_internalRead(operand1) & this->_internalRead(operand2);
this->_internalWrite(operand1, data);
this->_setNZflags(data);
return cycles;
}
int APU::ANDacc(uint24_t addr, int cycles)
{
this->_internalRegisters.a &= this->_internalRead(addr);
this->_setNZflags(this->_internalRegisters.a);
return cycles;
}
int APU::OR(uint24_t operand1, uint24_t operand2, int cycles)
{
uint8_t data = this->_internalRead(operand1) | this->_internalRead(operand2);
this->_internalWrite(operand1, data);
this->_setNZflags(data);
return cycles;
}
int APU::ORacc(uint24_t addr, int cycles)
{
this->_internalRegisters.a |= this->_internalRead(addr);
this->_setNZflags(this->_internalRegisters.a);
return cycles;
}
int APU::EOR(uint24_t operand1, uint24_t operand2, int cycles)
{
uint8_t data = this->_internalRead(operand1) ^ this->_internalRead(operand2);
this->_internalWrite(operand1, data);
this->_setNZflags(data);
return cycles;
}
int APU::EORacc(uint24_t addr, int cycles)
{
this->_internalRegisters.a ^= this->_internalRead(addr);
this->_setNZflags(this->_internalRegisters.a);
return cycles;
}
}
+1 -1
View File
@@ -8,7 +8,7 @@ namespace ComSquare::APU
{
int APU::BRA()
{
int8_t offset = this->_getDirectValue();
int8_t offset = this->_getImmediateData();
this->_internalRegisters.pc += offset;
return 4;
+1 -1
View File
@@ -17,7 +17,7 @@ namespace ComSquare::APU
int APU::PCALL()
{
this->CALL(0xFF00u + this->_getDirectValue());
this->CALL(0xFF00u + this->_getImmediateData());
return 6;
}