Finishing Bit operations

This commit is contained in:
Melefo
2020-02-20 17:40:09 +01:00
parent d958bd5131
commit 98c5036b58
5 changed files with 276 additions and 19 deletions
+47 -17
View File
@@ -163,51 +163,69 @@ namespace ComSquare::APU
case 0x00:
return this->NOP();
case 0x02:
return this->SET1(_getDirectAddr(), 0);
return this->SET1(this->_getDirectAddr(), 0);
case 0x0A:
return this->OR1(this->_getAbsoluteBit());
case 0x0E:
return this->TSET1(_getAbsoluteAddr());
return this->TSET1(this->_getAbsoluteAddr());
case 0x12:
return this->CLR1(_getDirectAddr(), 0);
return this->CLR1(this->_getDirectAddr(), 0);
case 0x20:
return this->CLRP();
case 0x22:
return this->SET1(_getDirectAddr(), 1);
return this->SET1(this->_getDirectAddr(), 1);
case 0x2A:
return this->OR1(this->_getAbsoluteBit(), true);
case 0x32:
return this->CLR1(_getDirectAddr(), 1);
return this->CLR1(this->_getDirectAddr(), 1);
case 0x40:
return this->SETP();
case 0x42:
return this->SET1(_getDirectAddr(), 2);
return this->SET1(this->_getDirectAddr(), 2);
case 0x4A:
return this->AND1(this->_getAbsoluteBit());
case 0x4E:
return this->TCLR1(this->_getAbsoluteAddr());
case 0x52:
return this->CLR1(_getDirectAddr(), 2);
return this->CLR1(this->_getDirectAddr(), 2);
case 0x60:
return this->CLRC();
case 0x62:
return this->SET1(_getDirectAddr(), 3);
return this->SET1(this->_getDirectAddr(), 3);
case 0x6A:
return this->AND1(this->_getAbsoluteBit(), true);
case 0x72:
return this->CLR1(_getDirectAddr(), 3);
return this->CLR1(this->_getDirectAddr(), 3);
case 0x80:
return this->SETC();
case 0x82:
return this->SET1(_getDirectAddr(), 4);
return this->SET1(this->_getDirectAddr(), 4);
case 0x8A:
return this->EOR1(this->_getAbsoluteBit());
case 0x92:
return this->CLR1(_getDirectAddr(), 4);
return this->CLR1(this->_getDirectAddr(), 4);
case 0xA0:
return this->EI();
case 0xA2:
return this->SET1(_getDirectAddr(), 5);
return this->SET1(this->_getDirectAddr(), 5);
case 0xAA:
return this->MOV1(this->_getAbsoluteBit(), true);
case 0xB2:
return this->CLR1(_getDirectAddr(), 5);
return this->CLR1(this->_getDirectAddr(), 5);
case 0xC0:
return this->DI();
case 0xC2:
return this->SET1(_getDirectAddr(), 6);
return this->SET1(this->_getDirectAddr(), 6);
case 0xC1:
return this->MOV1(this->_getAbsoluteBit());
case 0xD2:
return this->CLR1(_getDirectAddr(), 6);
return this->CLR1(this->_getDirectAddr(), 6);
case 0xE2:
return this->SET1(_getDirectAddr(), 7);
return this->SET1(this->_getDirectAddr(), 7);
case 0xF2:
return this->CLR1(_getDirectAddr(), 7);
return this->CLR1(this->_getDirectAddr(), 7);
case 0xEA:
return this->NOT1(this->_getAbsoluteBit());
case 0xED:
return this->NOTC();
case 0xEF:
@@ -247,6 +265,18 @@ namespace ComSquare::APU
return (addr2 << 8u) | addr1;
}
std::pair<uint24_t, uint24_t> APU::_getAbsoluteBit()
{
uint24_t addr1 = this->_internalRead(this->_internalRegisters.pc++);
uint24_t addr2 = this->_internalRead(this->_internalRegisters.pc++);
uint24_t operandA = (addr2 << 8u) | addr1;
uint24_t operandB = operandA >> 13u;
operandA = operandA & 0x1FFFu;
return std::make_pair(operandA, operandB);
}
MemoryMap::MemoryMap() :
Page0(0x00F0),
Page1(0x0100),