aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2014-10-28 05:39:03 +0100
committeraliaspider2014-10-28 05:39:03 +0100
commit76fef9625dd83399979a653b74f377f730725a70 (patch)
treef043e3774bc36acd7af98a2e8c3beb4a6fcbbf88
parent5a96997f186b2cff1a24ed5572430fe0f031e8d3 (diff)
downloadsnesemu-76fef9625dd83399979a653b74f377f730725a70.tar.gz
snesemu-76fef9625dd83399979a653b74f377f730725a70.tar.bz2
snesemu-76fef9625dd83399979a653b74f377f730725a70.zip
64-bit safer
-rw-r--r--source/apudebug.cpp4
-rw-r--r--source/cpuaddr.h6
-rw-r--r--source/cpuops.cpp6
-rw-r--r--source/gfx.cpp3
-rw-r--r--source/nds/draw.c8
-rw-r--r--source/spc700.cpp4
6 files changed, 16 insertions, 15 deletions
diff --git a/source/apudebug.cpp b/source/apudebug.cpp
index a016977..9fa2668 100644
--- a/source/apudebug.cpp
+++ b/source/apudebug.cpp
@@ -326,7 +326,7 @@ int S9xAPUOPrint (char *buffer, uint16 Address)
break;
case DPREL:
sprintf (mnem, S9xMnemonics [*p], *(p + 1),
- (int) (p + 3 - IAPU.RAM) + (signed char) *(p + 2));
+ (intptr_t) (p + 3 - IAPU.RAM) + (signed char) *(p + 2));
break;
case ABSBIT:
sprintf (mnem, S9xMnemonics [*p], (*(p + 1) + (*(p + 2) << 8)) & 0x1fff,
@@ -334,7 +334,7 @@ int S9xAPUOPrint (char *buffer, uint16 Address)
break;
case REL:
sprintf (mnem, S9xMnemonics [*p],
- (int) (p + 2 - IAPU.RAM) + (signed char) *(p + 1));
+ (intptr_t) (p + 2 - IAPU.RAM) + (signed char) *(p + 1));
break;
}
diff --git a/source/cpuaddr.h b/source/cpuaddr.h
index 4423b7c..6335495 100644
--- a/source/cpuaddr.h
+++ b/source/cpuaddr.h
@@ -119,7 +119,7 @@ static void Immediate16 (AccessMode a, InternalOp op)
static void Relative (AccessMode a, InternalOp op)
{
int8 Int8 = *CPU.PC++;
- long Addr = ((int) (CPU.PC - CPU.PCBase) + Int8) & 0xffff;
+ long Addr = ((intptr_t) (CPU.PC - CPU.PCBase) + Int8) & 0xffff;
(*op)(Addr);
}
@@ -207,7 +207,7 @@ static void AbsoluteLong (AccessMode a, InternalOp op)
#ifdef FAST_LSB_WORD_ACCESS
Addr = (*(uint32 *) CPU.PC) & 0xffffff;
#elif defined FAST_ALIGNED_LSB_WORD_ACCESS
- if (((int) CPU.PC & 1) == 0)
+ if (((intptr_t) CPU.PC & 1) == 0)
Addr = (*(uint16 *) CPU.PC) + (*(CPU.PC + 2) << 16);
else
Addr = *CPU.PC + ((*(uint16 *) (CPU.PC + 1)) << 8);
@@ -322,7 +322,7 @@ static void AbsoluteLongIndexedX (AccessMode a, InternalOp op)
#ifdef FAST_LSB_WORD_ACCESS
Addr = (*(uint32 *) CPU.PC + ICPU.Registers.X.W) & 0xffffff;
#elif defined FAST_ALIGNED_LSB_WORD_ACCESS
- if (((int) CPU.PC & 1) == 0)
+ if (((intptr_t) CPU.PC & 1) == 0)
Addr = ((*(uint16 *) CPU.PC) + (*(CPU.PC + 2) << 16) + ICPU.Registers.X.W) & 0xFFFFFF;
else
Addr = (*CPU.PC + ((*(uint16 *) (CPU.PC + 1)) << 8) + ICPU.Registers.X.W) & 0xFFFFFF;
diff --git a/source/cpuops.cpp b/source/cpuops.cpp
index db88c34..2279158 100644
--- a/source/cpuops.cpp
+++ b/source/cpuops.cpp
@@ -790,7 +790,7 @@ static void Op3CM0 (void)
/* CMP *************************************************************************************** */
static void OpC9M1 (void)
{
- int32 Int32 = (int) ICPU.Registers.AL - (int) *CPU.PC++;
+ int32 Int32 = (int) ICPU.Registers.AL - (intptr_t) *CPU.PC++;
ICPU._Carry = Int32 >= 0;
SetZN8 ((uint8) Int32);
#ifndef SA1_OPCODES
@@ -1052,7 +1052,7 @@ static void OpD3M0 (void)
/* CMX *************************************************************************************** */
static void OpE0X1 (void)
{
- int32 Int32 = (int) ICPU.Registers.XL - (int) *CPU.PC++;
+ int32 Int32 = (int) ICPU.Registers.XL - (intptr_t) *CPU.PC++;
ICPU._Carry = Int32 >= 0;
SetZN8 ((uint8) Int32);
#ifndef SA1_OPCODES
@@ -1114,7 +1114,7 @@ static void OpECX0 (void)
/* CMY *************************************************************************************** */
static void OpC0X1 (void)
{
- int32 Int32 = (int) ICPU.Registers.YL - (int) *CPU.PC++;
+ int32 Int32 = (int) ICPU.Registers.YL - (intptr_t) *CPU.PC++;
ICPU._Carry = Int32 >= 0;
SetZN8 ((uint8) Int32);
#ifndef SA1_OPCODES
diff --git a/source/gfx.cpp b/source/gfx.cpp
index 9ea0a97..438e094 100644
--- a/source/gfx.cpp
+++ b/source/gfx.cpp
@@ -2517,7 +2517,8 @@ static void DrawBackground (uint32 BGMode, uint32 bg, uint8 Z1, uint8 Z2)
Count = 8 - Offset;
if (Count > Width)
Count = Width;
- s -= Offset * GFX.PixSize;
+// if (s >= Offset * GFX.PixSize)
+ s -= Offset * GFX.PixSize;
Tile = READ_2BYTES(t);
GFX.Z1 = GFX.Z2 = depths [(Tile & 0x2000) >> 13];
diff --git a/source/nds/draw.c b/source/nds/draw.c
index 9a96e43..6344f5b 100644
--- a/source/nds/draw.c
+++ b/source/nds/draw.c
@@ -884,7 +884,7 @@ int show_background(void *screen, char *bgname)
ret= BMP_read(bgname, buff, 256, 192, &type);
if(ret != BMP_OK)
{
- free((int)buff);
+ free((intptr_t)buff);
return(-1);
}
@@ -919,11 +919,11 @@ int show_background(void *screen, char *bgname)
}
else
{
- free((int)buff);
+ free((intptr_t)buff);
return(-1);
}
- free((int)src);
+ free((intptr_t)src);
strcpy(back_ground.bgname, bgname);
}
@@ -1101,7 +1101,7 @@ int icon_init(u32 language_id)
printf("GUI buff %d\n", icondst - gui_picture);
#endif
- free((int)src);
+ free((intptr_t)src);
#endif
return ret;
diff --git a/source/spc700.cpp b/source/spc700.cpp
index c12cd08..7f2c5d2 100644
--- a/source/spc700.cpp
+++ b/source/spc700.cpp
@@ -247,11 +247,11 @@ APUSetZN8 ((uint8) Int16);
#define Relative()\
int8 Int8 = OP1;\
- int16 Int16 = (int) (IAPU.PC + 2 - IAPU.RAM) + Int8;
+ int16 Int16 = (intptr_t) (IAPU.PC + 2 - IAPU.RAM) + Int8;
#define Relative2()\
int8 Int8 = OP2;\
- int16 Int16 = (int) (IAPU.PC + 3 - IAPU.RAM) + Int8;
+ int16 Int16 = (intptr_t) (IAPU.PC + 3 - IAPU.RAM) + Int8;
#ifdef FAST_LSB_WORD_ACCESS
#define IndexedXIndirect()\