Fixing call to some isntructions

This commit is contained in:
Melefo
2021-06-07 17:45:05 +02:00
parent 06cdafbf16
commit eec17c9321
5 changed files with 213 additions and 97 deletions
+171 -78
View File
@@ -200,8 +200,11 @@ namespace ComSquare::APU
return this->TCALL(0); return this->TCALL(0);
case 0x02: case 0x02:
return this->SET1(this->_getDirectAddr(), 0); return this->SET1(this->_getDirectAddr(), 0);
case 0x03: case 0x03: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 0); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 0);
}
case 0x04: case 0x04:
return this->ORacc(this->_getDirectAddr(), 3); return this->ORacc(this->_getDirectAddr(), 3);
case 0x05: case 0x05:
@@ -212,8 +215,11 @@ namespace ComSquare::APU
return this->ORacc(this->_getAbsoluteDirectByXAddr(), 6); return this->ORacc(this->_getAbsoluteDirectByXAddr(), 6);
case 0x08: case 0x08:
return this->ORacc(this->_getImmediateData(), 2); return this->ORacc(this->_getImmediateData(), 2);
case 0x09: case 0x09: {
return this->OR(this->_getDirectAddr(), this->_getDirectAddr(), 6); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getDirectAddr();
return this->OR(ope1, ope2, 6);
}
case 0x0A: case 0x0A:
return this->OR1(this->_getAbsoluteBit()); return this->OR1(this->_getAbsoluteBit());
case 0x0B: case 0x0B:
@@ -232,8 +238,11 @@ namespace ComSquare::APU
return this->TCALL(1); return this->TCALL(1);
case 0x12: case 0x12:
return this->CLR1(this->_getDirectAddr(), 0); return this->CLR1(this->_getDirectAddr(), 0);
case 0x13: case 0x13: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 0); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->BBC(ope1, ope2, 0);
}
case 0x14: case 0x14:
return this->ORacc(this->_getDirectAddrByX(), 4); return this->ORacc(this->_getDirectAddrByX(), 4);
case 0x15: case 0x15:
@@ -242,8 +251,11 @@ namespace ComSquare::APU
return this->ORacc(this->_getAbsoluteAddrByY(), 5); return this->ORacc(this->_getAbsoluteAddrByY(), 5);
case 0x17: case 0x17:
return this->ORacc(this->_getAbsoluteDirectAddrByY(), 6); return this->ORacc(this->_getAbsoluteDirectAddrByY(), 6);
case 0x18: case 0x18: {
return this->OR(this->_getDirectAddr(), this->_getImmediateData(), 5); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->OR(ope1, ope2, 5);
}
case 0x19: case 0x19:
return this->OR(this->_getIndexXAddr(), this->_getIndexYAddr(), 5); return this->OR(this->_getIndexXAddr(), this->_getIndexYAddr(), 5);
case 0x1A: case 0x1A:
@@ -264,8 +276,11 @@ namespace ComSquare::APU
return this->TCALL(2); return this->TCALL(2);
case 0x22: case 0x22:
return this->SET1(this->_getDirectAddr(), 1); return this->SET1(this->_getDirectAddr(), 1);
case 0x23: case 0x23: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 1); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->BBS(ope1, ope2, 1);
}
case 0x24: case 0x24:
return this->ANDacc(this->_getDirectAddr(), 3); return this->ANDacc(this->_getDirectAddr(), 3);
case 0x25: case 0x25:
@@ -276,8 +291,11 @@ namespace ComSquare::APU
return this->ANDacc(this->_getAbsoluteDirectByXAddr(), 6); return this->ANDacc(this->_getAbsoluteDirectByXAddr(), 6);
case 0x28: case 0x28:
return this->ANDacc(this->_getImmediateData(), 2); return this->ANDacc(this->_getImmediateData(), 2);
case 0x29: case 0x29: {
return this->AND(this->_getDirectAddr(), this->_getDirectAddr(), 6); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getDirectAddr();
return this->AND(ope1, ope2, 6);
}
case 0x2A: case 0x2A:
return this->OR1(this->_getAbsoluteBit(), true); return this->OR1(this->_getAbsoluteBit(), true);
case 0x2B: case 0x2B:
@@ -286,8 +304,11 @@ namespace ComSquare::APU
return this->ROL(this->_getAbsoluteAddr(), 5); return this->ROL(this->_getAbsoluteAddr(), 5);
case 0x2D: case 0x2D:
return this->PUSH(this->_internalRegisters.a); return this->PUSH(this->_internalRegisters.a);
case 0x2E: case 0x2E: {
return this->CBNE(this->_getImmediateData(), this->_getImmediateData()); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->CBNE(addr, offset);
}
case 0x2F: case 0x2F:
return this->BRA(this->_getImmediateData()); return this->BRA(this->_getImmediateData());
case 0x30: case 0x30:
@@ -296,8 +317,11 @@ namespace ComSquare::APU
return this->TCALL(3); return this->TCALL(3);
case 0x32: case 0x32:
return this->CLR1(this->_getDirectAddr(), 1); return this->CLR1(this->_getDirectAddr(), 1);
case 0x33: case 0x33: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 1); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 1);
}
case 0x34: case 0x34:
return this->ANDacc(this->_getDirectAddrByX(), 4); return this->ANDacc(this->_getDirectAddrByX(), 4);
case 0x35: case 0x35:
@@ -306,8 +330,11 @@ namespace ComSquare::APU
return this->ANDacc(this->_getAbsoluteAddrByY(), 5); return this->ANDacc(this->_getAbsoluteAddrByY(), 5);
case 0x37: case 0x37:
return this->ANDacc(this->_getAbsoluteDirectAddrByY(), 6); return this->ANDacc(this->_getAbsoluteDirectAddrByY(), 6);
case 0x38: case 0x38: {
return this->AND(this->_getDirectAddr(), this->_getImmediateData(), 5); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->AND(ope1, ope2, 5);
}
case 0x39: case 0x39:
return this->AND(this->_getIndexXAddr(), this->_getIndexYAddr(), 5); return this->AND(this->_getIndexXAddr(), this->_getIndexYAddr(), 5);
case 0x3A: case 0x3A:
@@ -328,8 +355,11 @@ namespace ComSquare::APU
return this->TCALL(4); return this->TCALL(4);
case 0x42: case 0x42:
return this->SET1(this->_getDirectAddr(), 2); return this->SET1(this->_getDirectAddr(), 2);
case 0x43: case 0x43: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 2); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 2);
}
case 0x44: case 0x44:
return this->EORacc(this->_getDirectAddr(), 3); return this->EORacc(this->_getDirectAddr(), 3);
case 0x45: case 0x45:
@@ -340,8 +370,11 @@ namespace ComSquare::APU
return this->EORacc(this->_getAbsoluteDirectByXAddr(), 6); return this->EORacc(this->_getAbsoluteDirectByXAddr(), 6);
case 0x48: case 0x48:
return this->EORacc(this->_getImmediateData(), 2); return this->EORacc(this->_getImmediateData(), 2);
case 0x49: case 0x49: {
return this->EOR(this->_getDirectAddr(), this->_getDirectAddr(), 6); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getDirectAddr();
return this->EOR(ope1, ope2, 6);
}
case 0x4A: case 0x4A:
return this->AND1(this->_getAbsoluteBit()); return this->AND1(this->_getAbsoluteBit());
case 0x4B: case 0x4B:
@@ -360,8 +393,11 @@ namespace ComSquare::APU
return this->TCALL(5); return this->TCALL(5);
case 0x52: case 0x52:
return this->CLR1(this->_getDirectAddr(), 2); return this->CLR1(this->_getDirectAddr(), 2);
case 0x53: case 0x53: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 2); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 2);
}
case 0x54: case 0x54:
return this->EORacc(this->_getDirectAddrByX(), 4); return this->EORacc(this->_getDirectAddrByX(), 4);
case 0x55: case 0x55:
@@ -370,8 +406,11 @@ namespace ComSquare::APU
return this->EORacc(this->_getAbsoluteAddrByY(), 5); return this->EORacc(this->_getAbsoluteAddrByY(), 5);
case 0x57: case 0x57:
return this->EORacc(this->_getAbsoluteDirectAddrByY(), 6); return this->EORacc(this->_getAbsoluteDirectAddrByY(), 6);
case 0x58: case 0x58: {
return this->EOR(this->_getDirectAddr(), this->_getImmediateData(), 5); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->EOR(ope1, ope2, 5);
}
case 0x59: case 0x59:
return this->EOR(this->_getIndexXAddr(), this->_getIndexYAddr(), 5); return this->EOR(this->_getIndexXAddr(), this->_getIndexYAddr(), 5);
case 0x5A: case 0x5A:
@@ -392,8 +431,11 @@ namespace ComSquare::APU
return this->TCALL(6); return this->TCALL(6);
case 0x62: case 0x62:
return this->SET1(this->_getDirectAddr(), 3); return this->SET1(this->_getDirectAddr(), 3);
case 0x63: case 0x63: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 3); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 3);
}
case 0x64: case 0x64:
return this->CMPreg(this->_internalRegisters.a, this->_getDirectAddr(), 3); return this->CMPreg(this->_internalRegisters.a, this->_getDirectAddr(), 3);
case 0x65: case 0x65:
@@ -404,8 +446,11 @@ namespace ComSquare::APU
return this->CMPreg(this->_internalRegisters.a, this->_getAbsoluteDirectByXAddr(), 6); return this->CMPreg(this->_internalRegisters.a, this->_getAbsoluteDirectByXAddr(), 6);
case 0x68: case 0x68:
return this->CMPreg(this->_internalRegisters.a, this->_getImmediateData(), 2); return this->CMPreg(this->_internalRegisters.a, this->_getImmediateData(), 2);
case 0x69: case 0x69: {
return this->CMP(this->_getDirectAddr(), this->_getDirectAddr(), 6); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getDirectAddr();
return this->CMP(ope1, ope2, 6);
}
case 0x6A: case 0x6A:
return this->AND1(this->_getAbsoluteBit(), true); return this->AND1(this->_getAbsoluteBit(), true);
case 0x6B: case 0x6B:
@@ -424,8 +469,11 @@ namespace ComSquare::APU
return this->TCALL(7); return this->TCALL(7);
case 0x72: case 0x72:
return this->CLR1(this->_getDirectAddr(), 3); return this->CLR1(this->_getDirectAddr(), 3);
case 0x73: case 0x73: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 3); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 3);
}
case 0x74: case 0x74:
return this->CMPreg(this->_internalRegisters.a, this->_getDirectAddrByX(), 4); return this->CMPreg(this->_internalRegisters.a, this->_getDirectAddrByX(), 4);
case 0x75: case 0x75:
@@ -434,8 +482,11 @@ namespace ComSquare::APU
return this->CMPreg(this->_internalRegisters.a, this->_getAbsoluteAddrByY(), 5); return this->CMPreg(this->_internalRegisters.a, this->_getAbsoluteAddrByY(), 5);
case 0x77: case 0x77:
return this->CMPreg(this->_internalRegisters.a, this->_getAbsoluteDirectAddrByY(), 6); return this->CMPreg(this->_internalRegisters.a, this->_getAbsoluteDirectAddrByY(), 6);
case 0x78: case 0x78: {
return this->CMP(this->_getDirectAddr(), this->_getImmediateData(), 5); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->CMP(ope1, ope2, 5);
}
case 0x79: case 0x79:
return this->CMP(this->_getIndexXAddr(), this->_getIndexYAddr(), 5); return this->CMP(this->_getIndexXAddr(), this->_getIndexYAddr(), 5);
case 0x7A: case 0x7A:
@@ -456,8 +507,11 @@ namespace ComSquare::APU
return this->TCALL(8); return this->TCALL(8);
case 0x82: case 0x82:
return this->SET1(this->_getDirectAddr(), 4); return this->SET1(this->_getDirectAddr(), 4);
case 0x83: case 0x83: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 4); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 4);
}
case 0x84: case 0x84:
return this->ADCacc(this->_getDirectAddr(), 3); return this->ADCacc(this->_getDirectAddr(), 3);
case 0x85: case 0x85:
@@ -468,8 +522,11 @@ namespace ComSquare::APU
return this->ADCacc(this->_getAbsoluteDirectByXAddr(), 6); return this->ADCacc(this->_getAbsoluteDirectByXAddr(), 6);
case 0x88: case 0x88:
return this->ADCacc(this->_getImmediateData(), 2); return this->ADCacc(this->_getImmediateData(), 2);
case 0x89: case 0x89: {
return this->ADC(this->_getDirectAddr(), this->_getDirectAddr(), 6); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getDirectAddr();
return this->ADC(ope1, ope2, 6);
}
case 0x8A: case 0x8A:
return this->EOR1(this->_getAbsoluteBit()); return this->EOR1(this->_getAbsoluteBit());
case 0x8B: case 0x8B:
@@ -480,16 +537,22 @@ namespace ComSquare::APU
return this->MOV(this->_getImmediateData(), this->_internalRegisters.y, 2); return this->MOV(this->_getImmediateData(), this->_internalRegisters.y, 2);
case 0x8E: case 0x8E:
return this->POP(this->_internalRegisters.psw); return this->POP(this->_internalRegisters.psw);
case 0x8F: case 0x8F: {
return this->MOV(this->_getDirectAddr(), this->_getImmediateData()); auto to = this->_getDirectAddr();
auto from = this->_getImmediateData();
return this->MOV(to, from);
}
case 0x90: case 0x90:
return this->BCC(this->_getImmediateData()); return this->BCC(this->_getImmediateData());
case 0x91: case 0x91:
return this->TCALL(9); return this->TCALL(9);
case 0x92: case 0x92:
return this->CLR1(this->_getDirectAddr(), 4); return this->CLR1(this->_getDirectAddr(), 4);
case 0x93: case 0x93: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 4); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 4);
}
case 0x94: case 0x94:
return this->ADCacc(this->_getDirectAddrByX(), 4); return this->ADCacc(this->_getDirectAddrByX(), 4);
case 0x95: case 0x95:
@@ -498,8 +561,11 @@ namespace ComSquare::APU
return this->ADCacc(this->_getAbsoluteAddrByY(), 5); return this->ADCacc(this->_getAbsoluteAddrByY(), 5);
case 0x97: case 0x97:
return this->ADCacc(this->_getAbsoluteDirectAddrByY(), 6); return this->ADCacc(this->_getAbsoluteDirectAddrByY(), 6);
case 0x98: case 0x98: {
return this->ADC(this->_getDirectAddr(), this->_getImmediateData(), 5); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->ADC(ope1, ope2, 5);
}
case 0x99: case 0x99:
return this->ADC(this->_getIndexXAddr(), this->_getIndexYAddr(), 3); return this->ADC(this->_getIndexXAddr(), this->_getIndexYAddr(), 3);
case 0x9A: case 0x9A:
@@ -520,8 +586,11 @@ namespace ComSquare::APU
return this->TCALL(10); return this->TCALL(10);
case 0xA2: case 0xA2:
return this->SET1(this->_getDirectAddr(), 5); return this->SET1(this->_getDirectAddr(), 5);
case 0xA3: case 0xA3: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 5); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 5);
}
case 0xA4: case 0xA4:
return this->SBCacc(this->_getDirectAddr(), 3); return this->SBCacc(this->_getDirectAddr(), 3);
case 0xA5: case 0xA5:
@@ -532,8 +601,11 @@ namespace ComSquare::APU
return this->SBCacc(this->_getAbsoluteDirectByXAddr(), 6); return this->SBCacc(this->_getAbsoluteDirectByXAddr(), 6);
case 0xA8: case 0xA8:
return this->SBCacc(this->_getImmediateData(), 2); return this->SBCacc(this->_getImmediateData(), 2);
case 0xA9: case 0xA9: {
return this->SBC(this->_getDirectAddr(), this->_getDirectAddr(), 6); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getDirectAddr();
return this->SBC(ope1, ope2, 6);
}
case 0xAA: case 0xAA:
return this->MOV1(this->_getAbsoluteBit(), true); return this->MOV1(this->_getAbsoluteBit(), true);
case 0xAB: case 0xAB:
@@ -552,8 +624,11 @@ namespace ComSquare::APU
return this->TCALL(11); return this->TCALL(11);
case 0xB2: case 0xB2:
return this->CLR1(this->_getDirectAddr(), 5); return this->CLR1(this->_getDirectAddr(), 5);
case 0xB3: case 0xB3: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 5); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 5);
}
case 0xB4: case 0xB4:
return this->SBCacc(this->_getDirectAddrByX(), 4); return this->SBCacc(this->_getDirectAddrByX(), 4);
case 0xB5: case 0xB5:
@@ -562,8 +637,11 @@ namespace ComSquare::APU
return this->SBCacc(this->_getAbsoluteAddrByY(), 5); return this->SBCacc(this->_getAbsoluteAddrByY(), 5);
case 0xB7: case 0xB7:
return this->SBCacc(this->_getAbsoluteDirectAddrByY(), 6); return this->SBCacc(this->_getAbsoluteDirectAddrByY(), 6);
case 0xB8: case 0xB8: {
return this->SBC(this->_getDirectAddr(), this->_getImmediateData(), 5); auto ope1 = this->_getDirectAddr();
auto ope2 = this->_getImmediateData();
return this->SBC(ope1, ope2, 5);
}
case 0xB9: case 0xB9:
return this->SBC(this->_getIndexXAddr(), this->_getIndexYAddr(), 5); return this->SBC(this->_getIndexXAddr(), this->_getIndexYAddr(), 5);
case 0xBA: case 0xBA:
@@ -584,8 +662,11 @@ namespace ComSquare::APU
return this->TCALL(12); return this->TCALL(12);
case 0xC2: case 0xC2:
return this->SET1(this->_getDirectAddr(), 6); return this->SET1(this->_getDirectAddr(), 6);
case 0xC3: case 0xC3: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 6); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 6);
}
case 0xC4: case 0xC4:
return this->MOV(this->_internalRegisters.a, this->_getDirectAddr(), 4); return this->MOV(this->_internalRegisters.a, this->_getDirectAddr(), 4);
case 0xC5: case 0xC5:
@@ -616,8 +697,11 @@ namespace ComSquare::APU
return this->TCALL(13); return this->TCALL(13);
case 0xD2: case 0xD2:
return this->CLR1(this->_getDirectAddr(), 6); return this->CLR1(this->_getDirectAddr(), 6);
case 0xD3: case 0xD3: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 6); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 6);
}
case 0xD4: case 0xD4:
return this->MOV(this->_internalRegisters.a, this->_getDirectAddrByX(), 5); return this->MOV(this->_internalRegisters.a, this->_getDirectAddrByX(), 5);
case 0xD5: case 0xD5:
@@ -638,8 +722,11 @@ namespace ComSquare::APU
return this->DECreg(this->_internalRegisters.y); return this->DECreg(this->_internalRegisters.y);
case 0xDD: case 0xDD:
return this->MOV(this->_internalRegisters.y, this->_internalRegisters.a); return this->MOV(this->_internalRegisters.y, this->_internalRegisters.a);
case 0xDE: case 0xDE: {
return this->CBNE(this->_getDirectAddrByX(), this->_getImmediateData(), true); auto addr = this->_getDirectAddrByX();
auto offset = this->_getImmediateData();
return this->CBNE(addr, offset, true);
}
case 0xDF: case 0xDF:
return this->DAA(); return this->DAA();
case 0xE0: case 0xE0:
@@ -648,26 +735,29 @@ namespace ComSquare::APU
return this->TCALL(14); return this->TCALL(14);
case 0xE2: case 0xE2:
return this->SET1(this->_getDirectAddr(), 7); return this->SET1(this->_getDirectAddr(), 7);
case 0xE3: case 0xE3: {
return this->BBS(this->_getDirectAddr(), this->_getImmediateData(), 7); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBS(addr, offset, 7);
}
case 0xE4: case 0xE4:
return this->MOV(this->_internalRead(this->_getDirectAddr()), this->_internalRegisters.a, 3); return this->MOV(this->_internalRegisters.a, this->_internalRead(this->_getDirectAddr()), 3);
case 0xE5: case 0xE5:
return this->MOV(this->_getAbsoluteAddrByX(), this->_internalRegisters.a, 5); return this->MOV(this->_internalRegisters.a, this->_getAbsoluteAddrByX(), 5);
case 0xE6: case 0xE6:
return this->MOV(this->_getIndexXAddr(), this->_internalRegisters.a, 3); return this->MOV(this->_internalRegisters.a, this->_getIndexXAddr(), 3);
case 0xE7: case 0xE7:
return this->MOV(this->_getAbsoluteDirectByXAddr(), this->_internalRegisters.a, 6); return this->MOV(this->_internalRegisters.a, this->_getAbsoluteDirectByXAddr(), 6);
case 0xE8: case 0xE8:
return this->MOV(this->_getImmediateData(), this->_internalRegisters.a, 2); return this->MOV(this->_internalRegisters.a, this->_getImmediateData(), 2);
case 0xE9: case 0xE9:
return this->MOV(this->_getAbsoluteAddr(), this->_internalRegisters.x, 4); return this->MOV(this->_internalRegisters.x, this->_getAbsoluteAddr(),4);
case 0xEA: case 0xEA:
return this->NOT1(this->_getAbsoluteBit()); return this->NOT1(this->_getAbsoluteBit());
case 0xEB: case 0xEB:
return this->MOV(this->_internalRead(this->_getDirectAddr()), this->_internalRegisters.y, 3); return this->MOV(this->_internalRegisters.y, this->_getDirectAddr(),3);
case 0xEC: case 0xEC:
return this->MOV(this->_getAbsoluteAddr(), this->_internalRegisters.y, 4); return this->MOV(this->_internalRegisters.y, this->_getAbsoluteAddr(), 4);
case 0xED: case 0xED:
return this->NOTC(); return this->NOTC();
case 0xEE: case 0xEE:
@@ -680,28 +770,31 @@ namespace ComSquare::APU
return this->TCALL(15); return this->TCALL(15);
case 0xF2: case 0xF2:
return this->CLR1(this->_getDirectAddr(), 7); return this->CLR1(this->_getDirectAddr(), 7);
case 0xF3: case 0xF3: {
return this->BBC(this->_getDirectAddr(), this->_getImmediateData(), 7); auto addr = this->_getDirectAddr();
auto offset = this->_getImmediateData();
return this->BBC(addr, offset, 7);
}
case 0xF4: case 0xF4:
return this->MOV(this->_internalRead(this->_getDirectAddrByX()), this->_internalRegisters.a, 4); return this->MOV(this->_internalRegisters.a, this->_internalRead(this->_getDirectAddrByX()), 4);
case 0xF5: case 0xF5:
return this->MOV(this->_getAbsoluteAddrByX(), this->_internalRegisters.a, 5); return this->MOV(this->_internalRegisters.a, this->_internalRead(this->_getAbsoluteAddrByX()), 5);
case 0xF6: case 0xF6:
return this->MOV(this->_getAbsoluteAddrByY(), this->_internalRegisters.a, 5); return this->MOV(this->_internalRegisters.a, this->_getAbsoluteAddrByY(), 5);
case 0xF7: case 0xF7:
return this->MOV(this->_getAbsoluteDirectAddrByY(), this->_internalRegisters.a, 6); return this->MOV(this->_internalRegisters.a, this->_getAbsoluteDirectAddrByY(), 6);
case 0xF8: case 0xF8:
return this->MOV(this->_getDirectAddr(), this->_internalRegisters.x, 3); return this->MOV(this->_internalRegisters.x, this->_getDirectAddr(), 3);
case 0xF9: case 0xF9:
return this->MOV(this->_getDirectAddrByY(), this->_internalRegisters.x, 4); return this->MOV(this->_internalRegisters.x, this->_getDirectAddrByY(), 4);
case 0xFA: case 0xFA:
return this->MOV(this->_getDirectAddr(), this->_getDirectAddr()); return this->MOV(this->_getDirectAddr(), this->_getDirectAddr());
case 0xFB: case 0xFB:
return this->MOV(this->_getDirectAddrByX(), this->_internalRegisters.y, 4); return this->MOV(this->_internalRegisters.y, this->_getDirectAddrByX(), 4);
case 0xFC: case 0xFC:
return this->INCreg(this->_internalRegisters.y); return this->INCreg(this->_internalRegisters.y);
case 0xFD: case 0xFD:
return this->MOV(this->_internalRegisters.a, this->_internalRegisters.y); return this->MOV(this->_internalRegisters.y, this->_internalRegisters.a);
case 0xFE: case 0xFE:
return this->DBNZ(this->_getImmediateData()); return this->DBNZ(this->_getImmediateData());
case 0xFF: case 0xFF:
+1 -1
View File
@@ -365,7 +365,7 @@ namespace ComSquare::APU
int MOV(uint8_t &regFrom, uint8_t &regTo, bool setFlags = true); int MOV(uint8_t &regFrom, uint8_t &regTo, bool setFlags = true);
int MOV(uint8_t &regFrom, uint24_t memTo, int cycles, bool incrementX = false); int MOV(uint8_t &regFrom, uint24_t memTo, int cycles, bool incrementX = false);
int MOV(uint24_t memFrom, uint8_t &regTo, int cycles, bool incrementX = false); int MOV(uint24_t memFrom, uint8_t &regTo, int cycles, bool incrementX = false);
int MOV(uint24_t memTo, uint24_t memFrom); int MOV(uint24_t memFrom, uint24_t memTo);
public: public:
explicit APU(Renderer::IRenderer &renderer); explicit APU(Renderer::IRenderer &renderer);
APU(const APU &) = default; APU(const APU &) = default;
+1 -1
View File
@@ -200,7 +200,7 @@ namespace ComSquare::APU::DSP
//! @brief Size of buffer //! @brief Size of buffer
uint32_t bufferSize; uint32_t bufferSize;
//! @brief Current position in the buffer of samples //! @brief Current position in the buffer of samples
uint32_t bufferOffset; uint32_t bufferOffset = 0;
}; };
struct Timer { struct Timer {
+33 -16
View File
@@ -256,33 +256,49 @@ namespace ComSquare::Debugger
QStringList labels = QStringList(); QStringList labels = QStringList();
uint16_t offset = 0; uint16_t offset = 0;
for (uint16_t i = 0; i < 0x20; i++) if (this->_pc != 0)
{ {
auto pc = this->_internalRegisters.pc; auto pc = this->_internalRegisters.pc;
auto instruction = this->_getInstruction();
std::string operand;
this->_ui.logger->setItem(i, 0, new QTableWidgetItem(instruction.name.c_str())); this->_internalRegisters.pc = this->_pc;
this->_appendInstruction(0);
operand = this->_getOperand(std::get<0>(instruction.operands)); labels.append(Utility::to_hex(this->_pc).c_str());
this->_ui.logger->setItem(i, 1, new QTableWidgetItem(operand.c_str())); this->_internalRegisters.pc = pc;
if (operand.empty()) }
this->_ui.logger->item(i, 1)->setData(Qt::BackgroundRole, QColor(220, 220, 220)); else
labels.append("$0000");
operand = this->_getOperand(std::get<1>(instruction.operands)); for (uint16_t i = 1; i < 0x20; i++)
this->_ui.logger->setItem(i, 2, new QTableWidgetItem(operand.c_str())); {
if (operand.empty()) auto pc = this->_internalRegisters.pc;
this->_ui.logger->item(i, 2)->setData(Qt::BackgroundRole, QColor(220, 220, 220));
offset += this->_appendInstruction(i);
labels.append(Utility::to_hex(pc).c_str()); labels.append(Utility::to_hex(pc).c_str());
offset += instruction.size;
} }
this->_ui.logger->setVerticalHeaderLabels(labels); this->_ui.logger->setVerticalHeaderLabels(labels);
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
this->_ui.logger->item(0, i)->setData(Qt::BackgroundRole, QColor(200, 255, 148)); this->_ui.logger->item(1, i)->setData(Qt::BackgroundRole, QColor(200, 255, 148));
this->_internalRegisters.pc -= offset; this->_internalRegisters.pc -= offset;
} }
int APUDebug::_appendInstruction(int row)
{
auto instruction = this->_getInstruction();
std::string operand;
this->_ui.logger->setItem(row, 0, new QTableWidgetItem(instruction.name.c_str()));
operand = this->_getOperand(std::get<0>(instruction.operands));
this->_ui.logger->setItem(row, 1, new QTableWidgetItem(operand.c_str()));
if (operand.empty())
this->_ui.logger->item(row, 1)->setData(Qt::BackgroundRole, QColor(220, 220, 220));
operand = this->_getOperand(std::get<1>(instruction.operands));
this->_ui.logger->setItem(row, 2, new QTableWidgetItem(operand.c_str()));
if (operand.empty())
this->_ui.logger->item(row, 2)->setData(Qt::BackgroundRole, QColor(220, 220, 220));
return instruction.size;
}
std::string APUDebug::_getOperand(Operand ope) std::string APUDebug::_getOperand(Operand ope)
{ {
switch (ope) { switch (ope) {
@@ -354,6 +370,7 @@ namespace ComSquare::Debugger
void APUDebug::update(unsigned cycles) void APUDebug::update(unsigned cycles)
{ {
this->_pc = this->_internalRegisters.pc;
try { try {
if (this->_isPaused) if (this->_isPaused)
return; return;
+7 -1
View File
@@ -94,7 +94,7 @@ namespace ComSquare::Debugger
{"ROL", 2, {DirectAddr, None}}, {"ROL", 2, {DirectAddr, None}},
{"ROL", 3, {AbsoluteAddr, None}}, {"ROL", 3, {AbsoluteAddr, None}},
{"PUSH", 1, {A, None}}, {"PUSH", 1, {A, None}},
{"CBNE", 3, {ImmediateData, ImmediateData}}, {"CBNE", 3, {DirectAddrByX, ImmediateData}},
{"BRA", 2, {ImmediateData, None}}, {"BRA", 2, {ImmediateData, None}},
{"BMI", 2, {ImmediateData, None}}, {"BMI", 2, {ImmediateData, None}},
{"TCALL", 1, {None, None}}, {"TCALL", 1, {None, None}},
@@ -306,6 +306,12 @@ namespace ComSquare::Debugger
{"STOP", 1, {None, None}} {"STOP", 1, {None, None}}
}}; }};
//! @brief Position of the last instruction executed
uint16_t _pc;
//! @brief Add instruction to disassembly
int _appendInstruction(int row);
//! @brief The QT window for this debugger. //! @brief The QT window for this debugger.
ClosableWindow<APUDebug> *_window; ClosableWindow<APUDebug> *_window;