1.1 --- a/src/sh4/sh4core.c Tue Mar 21 11:14:04 2006 +0000
1.2 +++ b/src/sh4/sh4core.c Wed Mar 22 11:58:01 2006 +0000
1.5 - * $Id: sh4core.c,v 1.24 2006-03-21 11:14:04 nkeynes Exp $
1.6 + * $Id: sh4core.c,v 1.25 2006-03-22 11:58:01 nkeynes Exp $
1.8 * SH4 emulation core, and parent module for all the SH4 peripheral
1.12 #include "syscall.h"
1.14 +#define MAX_INT 0x7FFFFFFF
1.15 +#define MIN_INT 0x80000000
1.16 +#define MAX_INTF 2147483647.0
1.17 +#define MIN_INTF -2147483648.0
1.19 /* CPU-generated exception code/vector pairs */
1.20 #define EXC_POWER_RESET 0x000 /* vector special */
1.21 #define EXC_MANUAL_RESET 0x020
1.29 #define R0 sh4r.r[0]
1.31 @@ -1230,8 +1237,13 @@
1.32 DRN(ir) = (float)FPULi;
1.34 case 3: /* FTRC FRn, FPUL */
1.35 - FPULi = (uint32_t)DRN(ir);
1.36 - /* FIXME: is this sufficient? */
1.38 + if( dtmp >= MAX_INTF )
1.40 + else if( dtmp <= MIN_INTF )
1.43 + FPULi = (int32_t)dtmp;
1.45 case 4: /* FNEG FRn */
1.47 @@ -1349,8 +1361,13 @@
1.48 FRN(ir) = (float)FPULi;
1.50 case 3: /* FTRC FRn, FPUL */
1.51 - FPULi = (uint32_t)FRN(ir);
1.52 - /* FIXME: is this sufficient? */
1.54 + if( ftmp >= MAX_INTF )
1.56 + else if( ftmp <= MIN_INTF )
1.59 + FPULi = (int32_t)ftmp;
1.61 case 4: /* FNEG FRn */