add some asserts to identify emulator bugs as a source of incompatibility

This commit is contained in:
zeromus 2008-09-28 22:04:24 +00:00
parent 8e97a058dc
commit 0fdebc6e69
3 changed files with 16 additions and 6 deletions

View File

@ -21,13 +21,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//#define RENDER3D
#include <stdlib.h>
#include <math.h>
#include <string.h>
//#include "gl_vertex.h"
#include <assert.h>
#include "debug.h"
#include "NDSSystem.h"
@ -3573,12 +3570,14 @@ struct armcpu_memory_iface arm9_direct_memory_iface = {
u32 FASTCALL MMU_read32(u32 proc, u32 adr)
{
assert((adr&3)==0);
if(proc==0) return _MMU_read32<0ul>(adr);
else return _MMU_read32<1ul>(adr);
}
u16 FASTCALL MMU_read16(u32 proc, u32 adr)
{
assert((adr&1)==0);
if(proc==0) return _MMU_read16<0ul>(adr);
else return _MMU_read16<1ul>(adr);
}
@ -3591,12 +3590,14 @@ u8 FASTCALL MMU_read8(u32 proc, u32 adr)
void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
{
assert((adr&3)==0);
if(proc==0) _MMU_write32<0ul>(adr,val);
else _MMU_write32<1ul>(adr,val);
}
void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
{
assert((adr&1)==0);
if(proc==0) _MMU_write16<0ul>(adr,val);
else _MMU_write16<1ul>(adr,val);
}

View File

@ -60,6 +60,11 @@ typedef struct {
//Unused ram
u8 UNUSED_RAM[4];
//this is here so that we can trap glitchy emulator code
//which is accessing offsets 5,6,7 of unused ram due to unaligned accesses
//(also since the emulator doesn't prevent unaligned accesses)
u8 MORE_UNUSED_RAM[4];
u8 * * MMU_MEM[2];
u32 * MMU_MASK[2];

View File

@ -19,12 +19,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "arm_instructions.h"
#include "thumb_instructions.h"
#include "cp15.h"
#include "bios.h"
#include <stdlib.h>
#include <stdio.h>
template<u32> static u32 armcpu_prefetch();
@ -538,6 +540,8 @@ u32 armcpu_exec()
{
u32 c = 1;
assert(ARMPROC.instruct_adr!=0x00000000);
#ifdef GDB_STUB
if (ARMPROC.stalled)
return STALLED_CYCLE_COUNT;