diff options
author | 2012-07-15 15:09:46 +0000 | |
---|---|---|
committer | 2012-07-15 15:09:46 +0000 | |
commit | 7018fde0a3222ad3260b4d5893afc1b6774b8fe4 (patch) | |
tree | d769f4d985f4aed65b7151d832eaa971b2fa1d66 /src | |
parent | 032b0f355ef3a148c6e548db25efba31a954ba1e (diff) |
OV flag is cleared on (OV-)branch-and-call instructions
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/cpu/tms32051/32051ops.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/emu/cpu/tms32051/32051ops.c b/src/emu/cpu/tms32051/32051ops.c index d98d7addfb2..6127c637bc6 100644 --- a/src/emu/cpu/tms32051/32051ops.c +++ b/src/emu/cpu/tms32051/32051ops.c @@ -204,32 +204,37 @@ static UINT16 GET_ADDRESS(tms32051_state *cpustate) INLINE int GET_ZLVC_CONDITION(tms32051_state *cpustate, int zlvc, int zlvc_mask) { - if (zlvc_mask & 0x8) // Z-bit + if (zlvc_mask & 0x2) // OV-bit { - if ((zlvc & 0x8) && (INT32)(cpustate->acc) == 0) // EQ + if ((zlvc & 0x2) && cpustate->st0.ov) // OV + { + // clear OV + cpustate->st0.ov = 0; + return 1; - else if ((zlvc & 0x8) == 0 && (INT32)(cpustate->acc) != 0) // NEQ + } + else if ((zlvc & 0x2) == 0 && cpustate->st0.ov == 0) // NOV return 1; } - if (zlvc_mask & 0x4) // L-bit + if (zlvc_mask & 0x1) // C-bit { - if ((zlvc & 0x4) && (INT32)(cpustate->acc) < 0) // LT + if ((zlvc & 0x1) && cpustate->st1.c) // C return 1; - else if ((zlvc & 0x4) == 0 && (INT32)(cpustate->acc) > 0) // GT + else if ((zlvc & 0x1) == 0 && cpustate->st1.c == 0) // NC return 1; } - if (zlvc_mask & 0x2) // OV-bit + if (zlvc_mask & 0x8) // Z-bit { - if ((zlvc & 0x2) && cpustate->st0.ov) // OV + if ((zlvc & 0x8) && (INT32)(cpustate->acc) == 0) // EQ return 1; - else if ((zlvc & 0x2) == 0 && cpustate->st0.ov == 0) // NOV + else if ((zlvc & 0x8) == 0 && (INT32)(cpustate->acc) != 0) // NEQ return 1; } - if (zlvc_mask & 0x1) // C-bit + if (zlvc_mask & 0x4) // L-bit { - if ((zlvc & 0x1) && cpustate->st1.c) // C + if ((zlvc & 0x4) && (INT32)(cpustate->acc) < 0) // LT return 1; - else if ((zlvc & 0x1) == 0 && cpustate->st1.c == 0) // NC + else if ((zlvc & 0x4) == 0 && (INT32)(cpustate->acc) > 0) // GT return 1; } return 0; @@ -1038,7 +1043,7 @@ static void op_bcnd(tms32051_state *cpustate) { UINT16 pma = ROPCODE(cpustate); - if (GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3) || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf)) + if (GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf) || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3)) { CHANGE_PC(cpustate, pma); CYCLES(4); @@ -1053,7 +1058,7 @@ static void op_bcndd(tms32051_state *cpustate) { UINT16 pma = ROPCODE(cpustate); - if (GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3) || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf)) + if (GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf) || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3)) { delay_slot(cpustate, cpustate->pc); CHANGE_PC(cpustate, pma); @@ -1127,7 +1132,7 @@ static void op_ccd(tms32051_state *cpustate) { UINT16 pma = ROPCODE(cpustate); - if (GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3) || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf)) + if (GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf) || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3)) { PUSH_STACK(cpustate, cpustate->pc+2); @@ -1150,7 +1155,7 @@ static void op_nmi(tms32051_state *cpustate) static void op_retc(tms32051_state *cpustate) { - if ((cpustate->op & 0x3ff) == 0x300 || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3) || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf)) + if ((cpustate->op & 0x3ff) == 0x300 || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf) || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3)) { UINT16 pc = POP_STACK(cpustate); CHANGE_PC(cpustate, pc); @@ -1164,7 +1169,7 @@ static void op_retc(tms32051_state *cpustate) static void op_retcd(tms32051_state *cpustate) { - if ((cpustate->op & 0x3ff) == 0x300 || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3) || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf)) + if ((cpustate->op & 0x3ff) == 0x300 || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf) || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3)) { UINT16 pc = POP_STACK(cpustate); delay_slot(cpustate, cpustate->pc); @@ -1201,7 +1206,7 @@ static void op_trap(tms32051_state *cpustate) static void op_xc(tms32051_state *cpustate) { - if (GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3) || GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf)) + if (GET_ZLVC_CONDITION(cpustate, (cpustate->op >> 4) & 0xf, cpustate->op & 0xf) || GET_TP_CONDITION(cpustate, (cpustate->op >> 8) & 0x3)) { CYCLES(1); } |