summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2008-07-15 16:42:05 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2008-07-15 16:42:05 +0000
commit837d59500a7314b4b3389986bf35fc5eee472d36 (patch)
treec12e5850c0912910954c5376e6399894bb9d71e4
parentefcaebaea269e641cc314241e8cffa58158216e8 (diff)
i960: respect the rounding mode for CVTRI [ElSemi]
-rw-r--r--src/emu/cpu/i960/i960.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c
index 5283f30516f..6ae3abde0b3 100644
--- a/src/emu/cpu/i960/i960.c
+++ b/src/emu/cpu/i960/i960.c
@@ -1566,7 +1566,17 @@ static int i960_execute(int cycles)
case 0x0: // cvtri
i960_icount -= 33;
t1f = get_1_rif(opcode);
- set_ri(opcode, (INT32)t1f);
+ // apply rounding mode
+ // we do this a little indirectly to avoid some odd GCC warnings
+ t2f = 0.0;
+ switch((i960.AC>>30)&3)
+ {
+ case 0: t2f = floor(t1f+0.5); break;
+ case 1: t2f = floor(t1f); break;
+ case 2: t2f = ceil(t1f); break;
+ case 3: t2f = t1f; break;
+ }
+ set_rif(opcode, (INT32)t2f);
break;
case 0x2: // cvtzri