DSP - fix ROM loading (seriously, have we only been loading half the ROMs??? doesn't make sense).
Also delete some unused old junk variables. Add some comments. Start #defining SR flag constants. "implement" nx. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2872 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a9e71fe351
commit
6eb6db21ce
|
@ -78,7 +78,7 @@ s8 GetMultiplyModifier()
|
||||||
{
|
{
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
return(2);
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,6 @@ s8 GetMultiplyModifier()
|
||||||
bool CheckCondition(u8 _Condition)
|
bool CheckCondition(u8 _Condition)
|
||||||
{
|
{
|
||||||
bool taken = false;
|
bool taken = false;
|
||||||
|
|
||||||
switch (_Condition & 0xf)
|
switch (_Condition & 0xf)
|
||||||
{
|
{
|
||||||
case 0x0: //NS - NOT SIGN
|
case 0x0: //NS - NOT SIGN
|
||||||
|
@ -124,7 +123,7 @@ bool CheckCondition(u8 _Condition)
|
||||||
case 0x5: // Z - ZERO
|
case 0x5: // Z - ZERO
|
||||||
|
|
||||||
if (g_dsp.r[R_SR] & 0x04)
|
if (g_dsp.r[R_SR] & 0x04)
|
||||||
taken = true;
|
taken = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x6: // L - LESS
|
case 0x6: // L - LESS
|
||||||
|
@ -660,9 +659,11 @@ void andc(const UDSPInstruction& opc)
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
// TODO: Implement
|
|
||||||
void nx(const UDSPInstruction& opc)
|
void nx(const UDSPInstruction& opc)
|
||||||
{}
|
{
|
||||||
|
// This opcode is supposed to do nothing - it's used if you want to use
|
||||||
|
// an opcode extension but not do anything. At least according to duddie.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME inside
|
// FIXME inside
|
||||||
|
@ -1410,4 +1411,4 @@ void lrs(const UDSPInstruction& opc)
|
||||||
g_dsp.r[reg] = dsp_dmem_read(addr);
|
g_dsp.r[reg] = dsp_dmem_read(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
} // namespace
|
||||||
|
|
|
@ -23,6 +23,6 @@ namespace DSPJit {
|
||||||
// TODO(XK): Fill
|
// TODO(XK): Fill
|
||||||
|
|
||||||
|
|
||||||
};
|
} // namespace
|
||||||
|
|
||||||
#endif // _DSPJIT_H
|
#endif // _DSPJIT_H
|
||||||
|
|
|
@ -198,7 +198,7 @@ DSPOPCTemplate opcodes[] =
|
||||||
// opcodes that can be extended
|
// opcodes that can be extended
|
||||||
// extended opcodes, note size of opcode will be set to 0
|
// extended opcodes, note size of opcode will be set to 0
|
||||||
|
|
||||||
{"NX", 0x8000, 0xf700, DSPInterpreter::nx, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"NX", 0x8000, 0xf700, DSPInterpreter::nx, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"M2", 0x8a00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"M2", 0x8a00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"M0", 0x8b00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"M0", 0x8b00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"CLR15", 0x8c00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"CLR15", 0x8c00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
@ -206,36 +206,36 @@ DSPOPCTemplate opcodes[] =
|
||||||
{"SET40", 0x8e00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"SET40", 0x8e00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"SET16", 0x8f00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"SET16", 0x8f00, 0xffff, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"DECM", 0x7800, 0xfeff, DSPInterpreter::decm, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"DECM", 0x7800, 0xfeff, DSPInterpreter::decm, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"INCM", 0x7400, 0xfeff, DSPInterpreter::incm, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"INCM", 0x7400, 0xfeff, DSPInterpreter::incm, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"DEC", 0x7a00, 0xfeff, DSPInterpreter::dec, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"DEC", 0x7a00, 0xfeff, DSPInterpreter::dec, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"INC", 0x7600, 0xfeff, DSPInterpreter::inc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"INC", 0x7600, 0xfeff, DSPInterpreter::inc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"NEG", 0x7c00, 0xfeff, DSPInterpreter::neg, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"NEG", 0x7c00, 0xfeff, DSPInterpreter::neg, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MOVNP", 0x7e00, 0xfeff, DSPInterpreter::movnp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MOVNP", 0x7e00, 0xfeff, DSPInterpreter::movnp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"TST", 0xb100, 0xf7ff, DSPInterpreter::tsta, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"TST", 0xb100, 0xf7ff, DSPInterpreter::tsta, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"TSTAXH", 0x8600, 0xfeff, DSPInterpreter::tstaxh, nop, 1 | P_EXT, 1, {{P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"TSTAXH", 0x8600, 0xfeff, DSPInterpreter::tstaxh, nop, 1 | P_EXT, 1, {{P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"CMP", 0x8200, 0xffff, DSPInterpreter::cmp, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"CMP", 0x8200, 0xffff, DSPInterpreter::cmp, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
// {"CMPAR" , 0xc100, 0xe7ff, DSPInterpreter::cmpar, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 12, 0x1000}, {P_REG1A, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
// {"CMPAR" , 0xc100, 0xe7ff, DSPInterpreter::cmpar, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 12, 0x1000}, {P_REG1A, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"CLRAL0", 0xfc00, 0xffff, nop, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acl0
|
{"CLRAL0", 0xfc00, 0xffff, nop, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acl0
|
||||||
{"CLRAL1", 0xfd00, 0xffff, nop, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acl1
|
{"CLRAL1", 0xfd00, 0xffff, nop, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acl1
|
||||||
{"CLRA0", 0x8100, 0xffff, DSPInterpreter::clr, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acc0
|
{"CLRA0", 0x8100, 0xffff, DSPInterpreter::clr, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acc0
|
||||||
{"CLRA1", 0x8900, 0xffff, DSPInterpreter::clr, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acc1
|
{"CLRA1", 0x8900, 0xffff, DSPInterpreter::clr, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // clear acc1
|
||||||
{"CLRP", 0x8400, 0xffff, DSPInterpreter::clrp, nop, 1 | P_EXT, 0, {}, },
|
{"CLRP", 0x8400, 0xffff, DSPInterpreter::clrp, nop, 1 | P_EXT, 0, {}, },
|
||||||
|
|
||||||
|
|
||||||
{"MOV", 0x6c00, 0xfeff, DSPInterpreter::mov, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MOV", 0x6c00, 0xfeff, DSPInterpreter::mov, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MOVAX", 0x6800, 0xfcff, DSPInterpreter::movax, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MOVAX", 0x6800, 0xfcff, DSPInterpreter::movax, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MOVR", 0x6000, 0xf8ff, DSPInterpreter::movr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MOVR", 0x6000, 0xf8ff, DSPInterpreter::movr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MOVP", 0x6e00, 0xfeff, DSPInterpreter::movp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MOVP", 0x6e00, 0xfeff, DSPInterpreter::movp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MOVPZ", 0xfe00, 0xfeff, DSPInterpreter::movpz, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MOVPZ", 0xfe00, 0xfeff, DSPInterpreter::movpz, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"ADDPAXZ", 0xf800, 0xfcff, DSPInterpreter::addpaxz, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 9, 0x0200}, {P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ADDPAXZ", 0xf800, 0xfcff, DSPInterpreter::addpaxz, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 9, 0x0200}, {P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ADDP", 0x4e00, 0xfeff, DSPInterpreter::addp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ADDP", 0x4e00, 0xfeff, DSPInterpreter::addp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"LSL16", 0xf000, 0xfeff, DSPInterpreter::lsl16, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"LSL16", 0xf000, 0xfeff, DSPInterpreter::lsl16, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"LSR16", 0xf400, 0xfeff, DSPInterpreter::lsr16, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"LSR16", 0xf400, 0xfeff, DSPInterpreter::lsr16, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
@ -243,35 +243,35 @@ DSPOPCTemplate opcodes[] =
|
||||||
|
|
||||||
{"XORR", 0x3000, 0xfcff, DSPInterpreter::xorr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"XORR", 0x3000, 0xfcff, DSPInterpreter::xorr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ANDR", 0x3400, 0xfcff, DSPInterpreter::andr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ANDR", 0x3400, 0xfcff, DSPInterpreter::andr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ORR", 0x3800, 0xfcff, DSPInterpreter::orr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ORR", 0x3800, 0xfcff, DSPInterpreter::orr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ANDC", 0x3C00, 0xfeff, DSPInterpreter::andc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // Hermes doesn't list this
|
{"ANDC", 0x3C00, 0xfeff, DSPInterpreter::andc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // Hermes doesn't list this
|
||||||
{"ORC", 0x3E00, 0xfeff, nop, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // Hermes doesn't list this
|
{"ORC", 0x3E00, 0xfeff, nop, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // Hermes doesn't list this
|
||||||
|
|
||||||
{"MULX", 0xa000, 0xe7ff, DSPInterpreter::mulx, nop, 1 | P_EXT, 2, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULX", 0xa000, 0xe7ff, DSPInterpreter::mulx, nop, 1 | P_EXT, 2, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULXAC", 0xa400, 0xe6ff, DSPInterpreter::mulxac, nop, 1 | P_EXT, 3, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULXAC", 0xa400, 0xe6ff, DSPInterpreter::mulxac, nop, 1 | P_EXT, 3, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULXMV", 0xa600, 0xe6ff, DSPInterpreter::mulxmv, nop, 1 | P_EXT, 3, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULXMV", 0xa600, 0xe6ff, DSPInterpreter::mulxmv, nop, 1 | P_EXT, 3, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULXMVZ", 0xa200, 0xe6ff, DSPInterpreter::mulxmvz, nop, 1 | P_EXT, 3, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULXMVZ", 0xa200, 0xe6ff, DSPInterpreter::mulxmvz, nop, 1 | P_EXT, 3, {{P_REGM18, 1, 0, 11, 0x1000}, {P_REGM19, 1, 0, 10, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"MUL", 0x9000, 0xf7ff, DSPInterpreter::mul, nop, 1 | P_EXT, 2, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MUL", 0x9000, 0xf7ff, DSPInterpreter::mul, nop, 1 | P_EXT, 2, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULAC", 0x9400, 0xf6ff, DSPInterpreter::mulac, nop, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULAC", 0x9400, 0xf6ff, DSPInterpreter::mulac, nop, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULMV", 0x9600, 0xf6ff, DSPInterpreter::mulmv, nop, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULMV", 0x9600, 0xf6ff, DSPInterpreter::mulmv, nop, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULMVZ", 0x9200, 0xf6ff, DSPInterpreter::mulmvz, nop, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULMVZ", 0x9200, 0xf6ff, DSPInterpreter::mulmvz, nop, 1 | P_EXT, 3, {{P_REG18, 1, 0, 11, 0x0800}, {P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"MULC", 0xc000, 0xe7ff, DSPInterpreter::mulc, nop, 1 | P_EXT, 2, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULC", 0xc000, 0xe7ff, DSPInterpreter::mulc, nop, 1 | P_EXT, 2, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULCAC", 0xc400, 0xe6ff, DSPInterpreter::mulcac, nop, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULCAC", 0xc400, 0xe6ff, DSPInterpreter::mulcac, nop, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULCMV", 0xc600, 0xe6ff, DSPInterpreter::mulcmv, nop, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULCMV", 0xc600, 0xe6ff, DSPInterpreter::mulcmv, nop, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MULCMVZ", 0xc200, 0xe6ff, DSPInterpreter::mulcmvz, nop, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MULCMVZ", 0xc200, 0xe6ff, DSPInterpreter::mulcmvz, nop, 1 | P_EXT, 3, {{P_REG1A, 1, 0, 11, 0x0800}, {P_ACCM, 1, 0, 12, 0x1000}, {P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"ADDR", 0x4000, 0xf8ff, DSPInterpreter::addr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ADDR", 0x4000, 0xf8ff, DSPInterpreter::addr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ADDAX", 0x4800, 0xfcff, DSPInterpreter::addax, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ADDAX", 0x4800, 0xfcff, DSPInterpreter::addax, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ADD", 0x4c00, 0xfeff, DSPInterpreter::add, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ADD", 0x4c00, 0xfeff, DSPInterpreter::add, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"ADDAXL", 0x7000, 0xfcff, DSPInterpreter::addaxl, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"ADDAXL", 0x7000, 0xfcff, DSPInterpreter::addaxl, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"SUBR", 0x5000, 0xf8ff, DSPInterpreter::subr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"SUBR", 0x5000, 0xf8ff, DSPInterpreter::subr, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0600}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"SUBAX", 0x5800, 0xfcff, DSPInterpreter::subax, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"SUBAX", 0x5800, 0xfcff, DSPInterpreter::subax, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_REG18, 1, 0, 9, 0x0200}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"SUB", 0x5c00, 0xfeff, DSPInterpreter::sub, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"SUB", 0x5c00, 0xfeff, DSPInterpreter::sub, nop, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_ACCM_D, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
||||||
{"MADD", 0xf200, 0xfeff, DSPInterpreter::madd, nop, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MADD", 0xf200, 0xfeff, DSPInterpreter::madd, nop, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MSUB", 0xf600, 0xfeff, DSPInterpreter::msub , nop, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MSUB", 0xf600, 0xfeff, DSPInterpreter::msub , nop, 1 | P_EXT, 2, {{P_REG18, 1, 0, 8, 0x0100}, {P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MADDX", 0xe000, 0xfcff, DSPInterpreter::maddx, nop, 1 | P_EXT, 2, {{P_REGM18, 1, 0, 8, 0x0200}, {P_REGM19, 1, 0, 7, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MADDX", 0xe000, 0xfcff, DSPInterpreter::maddx, nop, 1 | P_EXT, 2, {{P_REGM18, 1, 0, 8, 0x0200}, {P_REGM19, 1, 0, 7, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
{"MSUBX", 0xe400, 0xfcff, DSPInterpreter::msubx, nop, 1 | P_EXT, 2, {{P_REGM18, 1, 0, 8, 0x0200}, {P_REGM19, 1, 0, 7, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
{"MSUBX", 0xe400, 0xfcff, DSPInterpreter::msubx, nop, 1 | P_EXT, 2, {{P_REGM18, 1, 0, 8, 0x0200}, {P_REGM19, 1, 0, 7, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define _DSPTABLES_H
|
#define _DSPTABLES_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
enum parameterType
|
enum parameterType
|
||||||
{
|
{
|
||||||
P_NONE = 0x0000,
|
P_NONE = 0x0000,
|
||||||
|
|
|
@ -52,28 +52,31 @@ u8 SDSP::exceptions;
|
||||||
// lets make stack depth to 32 for now
|
// lets make stack depth to 32 for now
|
||||||
u16 SDSP::reg_stack[4][DSP_STACK_DEPTH];
|
u16 SDSP::reg_stack[4][DSP_STACK_DEPTH];
|
||||||
void (*SDSP::irq_request)() = NULL;
|
void (*SDSP::irq_request)() = NULL;
|
||||||
bool SDSP::exception_in_progress_hack = false;
|
bool SDSP::exception_in_progress_hack = false; // should be replaced with bit9 in SR?
|
||||||
|
|
||||||
// for debugger only
|
// for debugger only
|
||||||
bool SDSP::dump_imem = false;
|
bool SDSP::dump_imem = false;
|
||||||
u32 SDSP::iram_crc = 0;
|
u32 SDSP::iram_crc = 0;
|
||||||
u64 SDSP::step_counter = 0;
|
u64 SDSP::step_counter = 0;
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
static bool CR_HALT = true;
|
|
||||||
static bool CR_EXTERNAL_INT = false;
|
|
||||||
|
|
||||||
|
|
||||||
bool gdsp_running;
|
bool gdsp_running;
|
||||||
extern volatile u32 dsp_running;
|
extern volatile u32 dsp_running;
|
||||||
|
|
||||||
|
static bool cr_halt = true;
|
||||||
|
static bool cr_external_int = false;
|
||||||
|
|
||||||
|
// SR flag defines.
|
||||||
|
// These are probably not accurate. Do not use yet.
|
||||||
|
#define SR_LOGIC_ZERO 0x0040 // ?? duddie's doc sometimes say & 1<<6, sometimes 1<<14 (0x4000)
|
||||||
|
#define SR_PROD_MUL2 0x2000
|
||||||
|
#define SR_SIGN 0x0008
|
||||||
|
#define SR_ARITH_ZERO 0x0002
|
||||||
|
#define SR_INT_ENABLE 0x0200
|
||||||
|
|
||||||
void UpdateCachedCR()
|
void UpdateCachedCR()
|
||||||
{
|
{
|
||||||
CR_HALT = (g_dsp.cr & 0x4) != 0;
|
cr_halt = (g_dsp.cr & 0x4) != 0;
|
||||||
CR_EXTERNAL_INT = (g_dsp.cr & 0x02) != 0;
|
cr_external_int = (g_dsp.cr & 0x02) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -85,12 +88,14 @@ void dbg_error(char* err_msg)
|
||||||
|
|
||||||
void gdsp_init()
|
void gdsp_init()
|
||||||
{
|
{
|
||||||
|
// Why do we have DROM? Does it exist? Has it been dumped?
|
||||||
g_dsp.irom = (u16*)malloc(DSP_IROM_SIZE * sizeof(u16));
|
g_dsp.irom = (u16*)malloc(DSP_IROM_SIZE * sizeof(u16));
|
||||||
g_dsp.iram = (u16*)malloc(DSP_IRAM_SIZE * sizeof(u16));
|
g_dsp.iram = (u16*)malloc(DSP_IRAM_SIZE * sizeof(u16));
|
||||||
g_dsp.drom = (u16*)malloc(DSP_DROM_SIZE * sizeof(u16));
|
g_dsp.drom = (u16*)malloc(DSP_DROM_SIZE * sizeof(u16));
|
||||||
g_dsp.dram = (u16*)malloc(DSP_DRAM_SIZE * sizeof(u16));
|
g_dsp.dram = (u16*)malloc(DSP_DRAM_SIZE * sizeof(u16));
|
||||||
g_dsp.coef = (u16*)malloc(DSP_COEF_SIZE * sizeof(u16));
|
g_dsp.coef = (u16*)malloc(DSP_COEF_SIZE * sizeof(u16));
|
||||||
|
|
||||||
|
// Fill memories with junk.
|
||||||
for (int i = 0; i < DSP_IRAM_SIZE; i++)
|
for (int i = 0; i < DSP_IRAM_SIZE; i++)
|
||||||
{
|
{
|
||||||
g_dsp.iram[i] = 0x0021; // HALT opcode
|
g_dsp.iram[i] = 0x0021; // HALT opcode
|
||||||
|
@ -101,6 +106,8 @@ void gdsp_init()
|
||||||
g_dsp.dram[i] = 0x0021; // HALT opcode
|
g_dsp.dram[i] = 0x0021; // HALT opcode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fill roms with zeros.
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
g_dsp.r[i] = 0;
|
g_dsp.r[i] = 0;
|
||||||
|
@ -132,7 +139,7 @@ void gdsp_init()
|
||||||
void gdsp_reset()
|
void gdsp_reset()
|
||||||
{
|
{
|
||||||
// _assert_msg_(0, "gdsp_reset()");
|
// _assert_msg_(0, "gdsp_reset()");
|
||||||
_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception");
|
_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "reset while exception");
|
||||||
g_dsp.pc = DSP_RESET_VECTOR;
|
g_dsp.pc = DSP_RESET_VECTOR;
|
||||||
g_dsp.exception_in_progress_hack = false;
|
g_dsp.exception_in_progress_hack = false;
|
||||||
}
|
}
|
||||||
|
@ -144,36 +151,51 @@ void gdsp_generate_exception(u8 level)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool gdsp_load_rom(char* fname)
|
bool gdsp_load_rom(const char *fname)
|
||||||
{
|
{
|
||||||
FILE* pFile = fopen(fname, "rb");
|
FILE *pFile = fopen(fname, "rb");
|
||||||
|
|
||||||
if (pFile)
|
if (pFile)
|
||||||
{
|
{
|
||||||
fread(g_dsp.irom, 1, DSP_IRAM_SIZE, pFile);
|
size_t size_in_bytes = DSP_IROM_SIZE * sizeof(u16);
|
||||||
|
size_t read_bytes = fread(g_dsp.irom, 1, size_in_bytes, pFile);
|
||||||
|
if (read_bytes != size_in_bytes)
|
||||||
|
{
|
||||||
|
PanicAlert("IROM too short : %i/%i", (int)read_bytes, (int)size_in_bytes);
|
||||||
|
fclose(pFile);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
return(true);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool gdsp_load_coef(char* fname)
|
bool gdsp_load_coef(const char *fname)
|
||||||
{
|
{
|
||||||
FILE* pFile = fopen(fname, "rb");
|
FILE *pFile = fopen(fname, "rb");
|
||||||
|
|
||||||
if (pFile)
|
if (pFile)
|
||||||
{
|
{
|
||||||
fread(g_dsp.coef, 1, DSP_COEF_SIZE, pFile);
|
size_t size_in_bytes = DSP_COEF_SIZE * sizeof(u16);
|
||||||
|
size_t read_bytes = fread(g_dsp.coef, 1, size_in_bytes, pFile);
|
||||||
|
if (read_bytes != size_in_bytes)
|
||||||
|
{
|
||||||
|
PanicAlert("COEF too short : %i/%i", (int)read_bytes, (int)size_in_bytes);
|
||||||
|
fclose(pFile);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
return(true);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hm, should instructions that change CR use this? Probably not (but they
|
||||||
|
// should call UpdateCachedCR())
|
||||||
void gdsp_write_cr(u16 val)
|
void gdsp_write_cr(u16 val)
|
||||||
{
|
{
|
||||||
// reset
|
// reset
|
||||||
|
@ -191,7 +213,8 @@ void gdsp_write_cr(u16 val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u16 gdsp_read_cr()
|
// Hm, should instructions that read CR use this? (Probably not).
|
||||||
|
u16 gdsp_read_cr()
|
||||||
{
|
{
|
||||||
if (g_dsp.pc & 0x8000)
|
if (g_dsp.pc & 0x8000)
|
||||||
{
|
{
|
||||||
|
@ -204,14 +227,17 @@ u16 gdsp_read_cr()
|
||||||
|
|
||||||
UpdateCachedCR();
|
UpdateCachedCR();
|
||||||
|
|
||||||
return(g_dsp.cr);
|
return g_dsp.cr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// special loop step.. because exception in loop or loopi fails
|
// special loop step.. because exception in loop or loopi fails
|
||||||
// dunno how we have to fix it
|
// dunno how we have to fix it
|
||||||
// atm we execute this instructions directly inside the loop command
|
// atm we execute this instructions directly inside the loop command
|
||||||
// so it cant be interrupted by an exception
|
// so it cant be interrupted by an exception.
|
||||||
|
// TODO - we really should figure this out - on the real DSP, exception inside
|
||||||
|
// loop should work. Think through the stack management and how it works
|
||||||
|
// with exceptions and in loops.
|
||||||
void gdsp_loop_step()
|
void gdsp_loop_step()
|
||||||
{
|
{
|
||||||
g_dsp.err_pc = g_dsp.pc;
|
g_dsp.err_pc = g_dsp.pc;
|
||||||
|
@ -275,7 +301,7 @@ void gdsp_step()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there is an external interrupt
|
// check if there is an external interrupt
|
||||||
if (CR_EXTERNAL_INT)
|
if (cr_external_int)
|
||||||
{
|
{
|
||||||
if (dsp_SR_is_flag_set(FLAG_ENABLE_INTERUPT) && (g_dsp.exception_in_progress_hack == false))
|
if (dsp_SR_is_flag_set(FLAG_ENABLE_INTERUPT) && (g_dsp.exception_in_progress_hack == false))
|
||||||
{
|
{
|
||||||
|
@ -313,16 +339,16 @@ bool gdsp_run()
|
||||||
{
|
{
|
||||||
gdsp_running = true;
|
gdsp_running = true;
|
||||||
|
|
||||||
while (!CR_HALT)
|
while (!cr_halt)
|
||||||
{
|
{
|
||||||
gdsp_step();
|
gdsp_step();
|
||||||
|
|
||||||
if(!gdsp_running)
|
if (!gdsp_running)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdsp_running = false;
|
gdsp_running = false;
|
||||||
return(true);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -342,7 +368,7 @@ bool gdsp_runx(u16 cnt)
|
||||||
}
|
}
|
||||||
|
|
||||||
gdsp_running = false;
|
gdsp_running = false;
|
||||||
return(true);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
// Are these in bytes or 16-bit words? Probably 16-bit words.
|
||||||
#define DSP_IRAM_SIZE (0x1000)
|
#define DSP_IRAM_SIZE (0x1000)
|
||||||
#define DSP_IRAM_MASK (0x0fff)
|
#define DSP_IRAM_MASK (0x0fff)
|
||||||
#define DSP_IROM_SIZE (0x1000)
|
#define DSP_IROM_SIZE (0x1000)
|
||||||
|
@ -92,8 +93,8 @@ extern SDSP g_dsp;
|
||||||
|
|
||||||
void gdsp_init(void);
|
void gdsp_init(void);
|
||||||
void gdsp_reset(void);
|
void gdsp_reset(void);
|
||||||
bool gdsp_load_rom(char* fname);
|
bool gdsp_load_rom(const char *fname);
|
||||||
bool gdsp_load_coef(char* fname);
|
bool gdsp_load_coef(const char *fname);
|
||||||
|
|
||||||
|
|
||||||
// steps through DSP code, returns false if error occured
|
// steps through DSP code, returns false if error occured
|
||||||
|
|
|
@ -49,9 +49,6 @@ SoundStream *soundStream = NULL;
|
||||||
#define GDSP_MBOX_CPU 0
|
#define GDSP_MBOX_CPU 0
|
||||||
#define GDSP_MBOX_DSP 1
|
#define GDSP_MBOX_DSP 1
|
||||||
|
|
||||||
u32 g_LastDMAAddress = 0;
|
|
||||||
u32 g_LastDMASize = 0;
|
|
||||||
|
|
||||||
extern u32 m_addressPBs;
|
extern u32 m_addressPBs;
|
||||||
bool AXTask(u32& _uMail);
|
bool AXTask(u32& _uMail);
|
||||||
|
|
||||||
|
@ -234,14 +231,14 @@ void Initialize(void *init)
|
||||||
g_dsp.irq_request = dspi_req_dsp_irq;
|
g_dsp.irq_request = dspi_req_dsp_irq;
|
||||||
gdsp_reset();
|
gdsp_reset();
|
||||||
|
|
||||||
if (!gdsp_load_rom((char *)DSP_ROM_FILE)) {
|
if (!gdsp_load_rom(DSP_ROM_FILE)) {
|
||||||
bCanWork = false;
|
bCanWork = false;
|
||||||
PanicAlert("Cannot load DSP ROM");
|
PanicAlert("Failed loading DSP ROM from " DSP_ROM_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gdsp_load_coef((char *)DSP_COEF_FILE)) {
|
if (!gdsp_load_coef(DSP_COEF_FILE)) {
|
||||||
bCanWork = false;
|
bCanWork = false;
|
||||||
PanicAlert("Cannot load DSP COEF");
|
PanicAlert("Failed loading DSP COEF from " DSP_COEF_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!bCanWork)
|
if(!bCanWork)
|
||||||
|
@ -250,7 +247,6 @@ void Initialize(void *init)
|
||||||
bIsRunning = true;
|
bIsRunning = true;
|
||||||
|
|
||||||
g_hDSPThread = new Common::Thread(dsp_thread, NULL);
|
g_hDSPThread = new Common::Thread(dsp_thread, NULL);
|
||||||
|
|
||||||
soundStream = AudioCommon::InitSoundStream();
|
soundStream = AudioCommon::InitSoundStream();
|
||||||
|
|
||||||
InitInstructionTable();
|
InitInstructionTable();
|
||||||
|
@ -272,12 +268,12 @@ void Shutdown(void)
|
||||||
u16 DSP_WriteControlRegister(u16 _uFlag)
|
u16 DSP_WriteControlRegister(u16 _uFlag)
|
||||||
{
|
{
|
||||||
gdsp_write_cr(_uFlag);
|
gdsp_write_cr(_uFlag);
|
||||||
return(gdsp_read_cr());
|
return gdsp_read_cr();
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 DSP_ReadControlRegister()
|
u16 DSP_ReadControlRegister()
|
||||||
{
|
{
|
||||||
return(gdsp_read_cr());
|
return gdsp_read_cr();
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 DSP_ReadMailboxHigh(bool _CPUMailbox)
|
u16 DSP_ReadMailboxHigh(bool _CPUMailbox)
|
||||||
|
|
Loading…
Reference in New Issue