include more information in DataRegion
This commit is contained in:
parent
59f710158f
commit
5d0f244f3c
16
src/ARM.h
16
src/ARM.h
|
@ -308,7 +308,7 @@ public:
|
||||||
void DataRead8(u32 addr, u32* val)
|
void DataRead8(u32 addr, u32* val)
|
||||||
{
|
{
|
||||||
*val = NDS::ARM7Read8(addr);
|
*val = NDS::ARM7Read8(addr);
|
||||||
DataRegion = addr >> 24;
|
DataRegion = addr >> 20;
|
||||||
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ public:
|
||||||
addr &= ~1;
|
addr &= ~1;
|
||||||
|
|
||||||
*val = NDS::ARM7Read16(addr);
|
*val = NDS::ARM7Read16(addr);
|
||||||
DataRegion = addr >> 24;
|
DataRegion = addr >> 20;
|
||||||
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public:
|
||||||
addr &= ~3;
|
addr &= ~3;
|
||||||
|
|
||||||
*val = NDS::ARM7Read32(addr);
|
*val = NDS::ARM7Read32(addr);
|
||||||
DataRegion = addr >> 24;
|
DataRegion = addr >> 20;
|
||||||
DataCycles = NDS::ARM7MemTimings[addr >> 15][2];
|
DataCycles = NDS::ARM7MemTimings[addr >> 15][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public:
|
||||||
void DataWrite8(u32 addr, u8 val)
|
void DataWrite8(u32 addr, u8 val)
|
||||||
{
|
{
|
||||||
NDS::ARM7Write8(addr, val);
|
NDS::ARM7Write8(addr, val);
|
||||||
DataRegion = addr >> 24;
|
DataRegion = addr >> 20;
|
||||||
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ public:
|
||||||
addr &= ~1;
|
addr &= ~1;
|
||||||
|
|
||||||
NDS::ARM7Write16(addr, val);
|
NDS::ARM7Write16(addr, val);
|
||||||
DataRegion = addr >> 24;
|
DataRegion = addr >> 20;
|
||||||
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
DataCycles = NDS::ARM7MemTimings[addr >> 15][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ public:
|
||||||
addr &= ~3;
|
addr &= ~3;
|
||||||
|
|
||||||
NDS::ARM7Write32(addr, val);
|
NDS::ARM7Write32(addr, val);
|
||||||
DataRegion = addr >> 24;
|
DataRegion = addr >> 20;
|
||||||
DataCycles = NDS::ARM7MemTimings[addr >> 15][2];
|
DataCycles = NDS::ARM7MemTimings[addr >> 15][2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ public:
|
||||||
s32 numC = NDS::ARM7MemTimings[CodeCycles][(CPSR&0x20)?0:2];
|
s32 numC = NDS::ARM7MemTimings[CodeCycles][(CPSR&0x20)?0:2];
|
||||||
s32 numD = DataCycles;
|
s32 numD = DataCycles;
|
||||||
|
|
||||||
if (DataRegion == 0x02) // mainRAM
|
if ((DataRegion >> 4) == 0x02) // mainRAM
|
||||||
{
|
{
|
||||||
if (CodeRegion == 0x02)
|
if (CodeRegion == 0x02)
|
||||||
Cycles += numC + numD;
|
Cycles += numC + numD;
|
||||||
|
@ -417,7 +417,7 @@ public:
|
||||||
s32 numC = NDS::ARM7MemTimings[CodeCycles][(CPSR&0x20)?0:2];
|
s32 numC = NDS::ARM7MemTimings[CodeCycles][(CPSR&0x20)?0:2];
|
||||||
s32 numD = DataCycles;
|
s32 numD = DataCycles;
|
||||||
|
|
||||||
if (DataRegion == 0x02)
|
if ((DataRegion >> 4) == 0x02)
|
||||||
{
|
{
|
||||||
if (CodeRegion == 0x02)
|
if (CodeRegion == 0x02)
|
||||||
Cycles += numC + numD;
|
Cycles += numC + numD;
|
||||||
|
|
|
@ -650,7 +650,7 @@ void Compiler::Comp_AddCycles_CDI()
|
||||||
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
||||||
s32 numD = CurInstr.DataCycles;
|
s32 numD = CurInstr.DataCycles;
|
||||||
|
|
||||||
if (CurInstr.DataRegion == 0x02) // mainRAM
|
if ((CurInstr.DataRegion >> 4) == 0x02) // mainRAM
|
||||||
{
|
{
|
||||||
if (CodeRegion == 0x02)
|
if (CodeRegion == 0x02)
|
||||||
cycles = numC + numD;
|
cycles = numC + numD;
|
||||||
|
@ -695,7 +695,7 @@ void Compiler::Comp_AddCycles_CD()
|
||||||
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
||||||
s32 numD = CurInstr.DataCycles;
|
s32 numD = CurInstr.DataCycles;
|
||||||
|
|
||||||
if (CurInstr.DataRegion == 0x02)
|
if ((CurInstr.DataRegion >> 4) == 0x02)
|
||||||
{
|
{
|
||||||
if (CodeRegion == 0x02)
|
if (CodeRegion == 0x02)
|
||||||
cycles += numC + numD;
|
cycles += numC + numD;
|
||||||
|
|
|
@ -40,9 +40,9 @@ struct FetchedInstr
|
||||||
u32 Instr;
|
u32 Instr;
|
||||||
u32 Addr;
|
u32 Addr;
|
||||||
|
|
||||||
u8 CodeCycles;
|
|
||||||
u8 DataCycles;
|
u8 DataCycles;
|
||||||
u8 DataRegion;
|
u16 CodeCycles;
|
||||||
|
u32 DataRegion;
|
||||||
|
|
||||||
ARMInstrInfo::Info Info;
|
ARMInstrInfo::Info Info;
|
||||||
};
|
};
|
||||||
|
@ -195,6 +195,9 @@ typedef void (*InterpreterFunc)(ARM* cpu);
|
||||||
extern InterpreterFunc InterpretARM[];
|
extern InterpreterFunc InterpretARM[];
|
||||||
extern InterpreterFunc InterpretTHUMB[];
|
extern InterpreterFunc InterpretTHUMB[];
|
||||||
|
|
||||||
|
extern u8 MemRegion9[0x80000];
|
||||||
|
extern u8 MemRegion7[0x80000];
|
||||||
|
|
||||||
void* GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size);
|
void* GetFuncForAddr(ARM* cpu, u32 addr, bool store, int size);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,7 +578,7 @@ void Compiler::Comp_AddCycles_CDI()
|
||||||
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
||||||
s32 numD = CurInstr.DataCycles;
|
s32 numD = CurInstr.DataCycles;
|
||||||
|
|
||||||
if (CurInstr.DataRegion == 0x02) // mainRAM
|
if ((CurInstr.DataRegion >> 4) == 0x02) // mainRAM
|
||||||
{
|
{
|
||||||
if (CodeRegion == 0x02)
|
if (CodeRegion == 0x02)
|
||||||
cycles = numC + numD;
|
cycles = numC + numD;
|
||||||
|
@ -623,7 +623,7 @@ void Compiler::Comp_AddCycles_CD()
|
||||||
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
s32 numC = NDS::ARM7MemTimings[CurInstr.CodeCycles][Thumb ? 0 : 2];
|
||||||
s32 numD = CurInstr.DataCycles;
|
s32 numD = CurInstr.DataCycles;
|
||||||
|
|
||||||
if (CurInstr.DataRegion == 0x02)
|
if ((CurInstr.DataRegion >> 4) == 0x02)
|
||||||
{
|
{
|
||||||
if (CodeRegion == 0x02)
|
if (CodeRegion == 0x02)
|
||||||
cycles += numC + numD;
|
cycles += numC + numD;
|
||||||
|
|
12
src/CP15.cpp
12
src/CP15.cpp
|
@ -728,6 +728,8 @@ u32 ARMv5::CodeRead32(u32 addr, bool branch)
|
||||||
|
|
||||||
void ARMv5::DataRead8(u32 addr, u32* val)
|
void ARMv5::DataRead8(u32 addr, u32* val)
|
||||||
{
|
{
|
||||||
|
DataRegion = addr >> 12;
|
||||||
|
|
||||||
if (addr < ITCMSize)
|
if (addr < ITCMSize)
|
||||||
{
|
{
|
||||||
DataCycles = 1;
|
DataCycles = 1;
|
||||||
|
@ -747,6 +749,8 @@ void ARMv5::DataRead8(u32 addr, u32* val)
|
||||||
|
|
||||||
void ARMv5::DataRead16(u32 addr, u32* val)
|
void ARMv5::DataRead16(u32 addr, u32* val)
|
||||||
{
|
{
|
||||||
|
DataRegion = addr >> 12;
|
||||||
|
|
||||||
addr &= ~1;
|
addr &= ~1;
|
||||||
|
|
||||||
if (addr < ITCMSize)
|
if (addr < ITCMSize)
|
||||||
|
@ -768,6 +772,8 @@ void ARMv5::DataRead16(u32 addr, u32* val)
|
||||||
|
|
||||||
void ARMv5::DataRead32(u32 addr, u32* val)
|
void ARMv5::DataRead32(u32 addr, u32* val)
|
||||||
{
|
{
|
||||||
|
DataRegion = addr >> 12;
|
||||||
|
|
||||||
addr &= ~3;
|
addr &= ~3;
|
||||||
|
|
||||||
if (addr < ITCMSize)
|
if (addr < ITCMSize)
|
||||||
|
@ -810,6 +816,8 @@ void ARMv5::DataRead32S(u32 addr, u32* val)
|
||||||
|
|
||||||
void ARMv5::DataWrite8(u32 addr, u8 val)
|
void ARMv5::DataWrite8(u32 addr, u8 val)
|
||||||
{
|
{
|
||||||
|
DataRegion = addr >> 12;
|
||||||
|
|
||||||
if (addr < ITCMSize)
|
if (addr < ITCMSize)
|
||||||
{
|
{
|
||||||
DataCycles = 1;
|
DataCycles = 1;
|
||||||
|
@ -832,6 +840,8 @@ void ARMv5::DataWrite8(u32 addr, u8 val)
|
||||||
|
|
||||||
void ARMv5::DataWrite16(u32 addr, u16 val)
|
void ARMv5::DataWrite16(u32 addr, u16 val)
|
||||||
{
|
{
|
||||||
|
DataRegion = addr >> 12;
|
||||||
|
|
||||||
addr &= ~1;
|
addr &= ~1;
|
||||||
|
|
||||||
if (addr < ITCMSize)
|
if (addr < ITCMSize)
|
||||||
|
@ -856,6 +866,8 @@ void ARMv5::DataWrite16(u32 addr, u16 val)
|
||||||
|
|
||||||
void ARMv5::DataWrite32(u32 addr, u32 val)
|
void ARMv5::DataWrite32(u32 addr, u32 val)
|
||||||
{
|
{
|
||||||
|
DataRegion = addr >> 12;
|
||||||
|
|
||||||
addr &= ~3;
|
addr &= ~3;
|
||||||
|
|
||||||
if (addr < ITCMSize)
|
if (addr < ITCMSize)
|
||||||
|
|
Loading…
Reference in New Issue