summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2008-04-06 22:48:25 +0000
committer smf- <smf-@users.noreply.github.com>2008-04-06 22:48:25 +0000
commit4d21cff79939a5470b9420455ed3a4914401eb9f (patch)
tree18f3de3e7dcd9744326b26b1e7e258261cf09fa7
parent436adc3c4892ffcc2c6833701d8f541de47cf3f3 (diff)
added IR1/IR2/IR3 saturation when calculating ORGB
fixed spelling mistake.
-rw-r--r--src/emu/cpu/mips/psx.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/emu/cpu/mips/psx.c b/src/emu/cpu/mips/psx.c
index 10439fffd71..944807d6008 100644
--- a/src/emu/cpu/mips/psx.c
+++ b/src/emu/cpu/mips/psx.c
@@ -42,7 +42,7 @@
* is complicated. Left over instruction fetches are currently emulated as they are the most
* 'interesting' and have no impact on the rest of the emulation.
*
- * MTC0 timing is not emulated, switching to user mode while in kernal space continues
+ * MTC0 timing is not emulated, switching to user mode while in kernel space continues
* execution for another two instructions before taking an exception. Using RFE to do the same
* thing causes the exception straight away, unless the RFE is the first instructio that follows
* an MTC0 instruction.
@@ -3080,6 +3080,19 @@ static void setcp3cr( int reg, UINT32 n_value )
#define ZSF4 ( mipscpu.cp2cr[ 30 ].w.l )
#define FLAG ( mipscpu.cp2cr[ 31 ].d )
+short betweenINT16( INT16 v, INT16 l, INT16 u )
+{
+ if( v < l )
+ {
+ return l;
+ }
+ if( v > u )
+ {
+ return u;
+ }
+ return v;
+}
+
static UINT32 getcp2dr( int n_reg )
{
if( n_reg == 1 || n_reg == 3 || n_reg == 5 || n_reg == 8 || n_reg == 9 || n_reg == 10 || n_reg == 11 || n_reg == 28 )
@@ -3092,7 +3105,7 @@ static UINT32 getcp2dr( int n_reg )
}
else if( n_reg == 29 )
{
- ORGB = ( ( IR1 >> 7 ) & 0x1f ) | ( ( IR2 >> 2 ) & 0x3e0 ) | ( ( IR3 << 3 ) & 0x7c00 );
+ ORGB = betweenINT16( (INT16)IR1 >> 7, 0, 0x1f ) | ( betweenINT16( (INT16)IR2 >> 7, 0, 0x1f ) << 5 ) | ( betweenINT16( (INT16)IR3 >> 7, 0, 0x1f ) << 10 );
}
GTELOG( "get CP2DR%u=%08x", n_reg, mipscpu.cp2dr[ n_reg ].d );
return mipscpu.cp2dr[ n_reg ].d;