mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-03 10:26:36 +00:00
Adding 8-bit Logical Operations
Testing every current operands
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace ComSquare::APU
|
||||
|
||||
int APU::PCALL()
|
||||
{
|
||||
this->CALL(0xFF00u + this->_getDirectValue());
|
||||
this->CALL(0xFF00u + this->_getImmediateData());
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user