dsp: Support 'inc d'

This commit is contained in:
Jannik Vogel 2017-06-25 13:51:54 +02:00 committed by mborgerson
parent e582e64fd6
commit fae1e33622
2 changed files with 39 additions and 1 deletions

View File

@ -249,7 +249,7 @@ static const OpcodeEntry nonparallel_opcodes[] = {
{ "0000110000011010100sSSSD", "extractu S1, S2, D", NULL, NULL },
{ "0000110000011000100s000D", "extractu #CO, S2, D", NULL, NULL },
{ "000000000000000000000101", "ill", NULL, emu_illegal },
{ "00000000000000000000100d", "inc D", NULL, NULL },
{ "00000000000000000000100d", "inc D", NULL, emu_inc },
{ "00001100000110110qqqSSSD", "insert S1, S2, D", NULL, NULL },
{ "00001100000110010qqq000D", "insert #CO, S2, D", NULL, NULL },
{ "00001110CCCCaaaaaaaaaaaa", "jcc xxx", dis_jcc_imm, emu_jcc_imm },

View File

@ -6808,6 +6808,44 @@ static void emu_illegal(dsp_core_t* dsp)
}
}
static void emu_inc(dsp_core_t* dsp)
{
uint32_t destreg, source[3], dest[3];
uint16_t newsr;
destreg = DSP_REG_A + (dsp->cur_inst & 1);
if (destreg == DSP_REG_A) {
dest[0] = dsp->registers[DSP_REG_A2];
dest[1] = dsp->registers[DSP_REG_A1];
dest[2] = dsp->registers[DSP_REG_A0];
} else {
dest[0] = dsp->registers[DSP_REG_B2];
dest[1] = dsp->registers[DSP_REG_B1];
dest[2] = dsp->registers[DSP_REG_B0];
}
source[2] = 1;
source[1] = 0;
source[0] = 0;
newsr = dsp_add56(source, dest);
if (destreg == DSP_REG_A) {
dsp->registers[DSP_REG_A2] = dest[0];
dsp->registers[DSP_REG_A1] = dest[1];
dsp->registers[DSP_REG_A0] = dest[2];
} else {
dsp->registers[DSP_REG_B2] = dest[0];
dsp->registers[DSP_REG_B1] = dest[1];
dsp->registers[DSP_REG_B0] = dest[2];
}
emu_ccr_update_e_u_n_z(dsp, dest[0], dest[1], dest[2]);
dsp->registers[DSP_REG_SR] &= BITMASK(16)-((1<<DSP_SR_V)|(1<<DSP_SR_C));
dsp->registers[DSP_REG_SR] |= newsr;
}
static void emu_jcc_imm(dsp_core_t* dsp)
{
uint32_t cc_code, newpc;