shashclp 2007-02-14 00:20:12 +00:00
parent 4080704c88
commit c0cb024969
2 changed files with 30 additions and 12 deletions

View File

@ -1651,8 +1651,7 @@ void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
case REG_TM3CNTH : case REG_TM3CNTH :
if(val&0x80) if(val&0x80)
{ {
if(!(val&4)) MMU.timer[proc][((adr-2)>>2)&0x3] = MMU.timerReload[proc][((adr-2)>>2)&0x3]; MMU.timer[proc][((adr-2)>>2)&0x3] = MMU.timerReload[proc][((adr-2)>>2)&0x3];
else MMU.timer[proc][((adr-2)>>2)&0x3] = 0;
} }
MMU.timerON[proc][((adr-2)>>2)&0x3] = val & 0x80; MMU.timerON[proc][((adr-2)>>2)&0x3] = val & 0x80;
switch(val&7) switch(val&7)
@ -2161,8 +2160,7 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
MMU.timerReload[proc][(adr>>2)&0x3] = (u16)val; MMU.timerReload[proc][(adr>>2)&0x3] = (u16)val;
if(val&0x800000) if(val&0x800000)
{ {
if(!(val&40000)) MMU.timer[proc][(adr>>2)&0x3] = MMU.timerReload[proc][(adr>>2)&0x3]; MMU.timer[proc][(adr>>2)&0x3] = MMU.timerReload[proc][(adr>>2)&0x3];
else MMU.timer[proc][(adr>>2)&0x3] = 0;
} }
MMU.timerON[proc][(adr>>2)&0x3] = val & 0x800000; MMU.timerON[proc][(adr>>2)&0x3] = val & 0x800000;
switch((val>>16)&7) switch((val>>16)&7)
@ -2950,3 +2948,5 @@ void FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val)
MMU_write32(proc,adr,val) ; MMU_write32(proc,adr,val) ;
} }
#endif #endif

View File

@ -418,6 +418,15 @@ int NDS_CreateDummyFirmware(void);
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFB); T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFB);
} }
} }
/* assume the timers have not expired */
nds.timerOver[0][0] = 0;
nds.timerOver[0][1] = 0;
nds.timerOver[0][2] = 0;
nds.timerOver[0][3] = 0;
nds.timerOver[1][0] = 0;
nds.timerOver[1][1] = 0;
nds.timerOver[1][2] = 0;
nds.timerOver[1][3] = 0;
if(MMU.timerON[0][0]) if(MMU.timerON[0][0])
{ {
if(MMU.timerRUN[0][0]) if(MMU.timerRUN[0][0])
@ -437,7 +446,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x102) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x102) & 0x40)
NDS_makeARM9Int(3); NDS_makeARM9Int(3);
MMU.timer[0][0] += MMU.timerReload[0][0]; MMU.timer[0][0] = MMU.timerReload[0][0];
} }
} }
break; break;
@ -464,6 +473,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40)
NDS_makeARM9Int(4); NDS_makeARM9Int(4);
MMU.timer[0][1] = MMU.timerReload[0][1];
} }
} }
break; break;
@ -478,10 +488,11 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x106) & 0x40)
NDS_makeARM9Int(4); NDS_makeARM9Int(4);
MMU.timer[0][1] += MMU.timerReload[0][1]; MMU.timer[0][1] = MMU.timerReload[0][1];
} }
} }
break; break;
} }
} }
else else
@ -505,6 +516,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40)
NDS_makeARM9Int(5); NDS_makeARM9Int(5);
MMU.timer[0][2] = MMU.timerReload[0][2];
} }
} }
break; break;
@ -519,7 +531,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10A) & 0x40)
NDS_makeARM9Int(5); NDS_makeARM9Int(5);
MMU.timer[0][2] += MMU.timerReload[0][2]; MMU.timer[0][2] = MMU.timerReload[0][2];
} }
} }
break; break;
@ -546,6 +558,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40)
NDS_makeARM9Int(6); NDS_makeARM9Int(6);
MMU.timer[0][3] = MMU.timerReload[0][3];
} }
} }
break; break;
@ -560,7 +573,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40) if(T1ReadWord(ARM9Mem.ARM9_REG, 0x10E) & 0x40)
NDS_makeARM9Int(6); NDS_makeARM9Int(6);
MMU.timer[0][3] += MMU.timerReload[0][3]; MMU.timer[0][3] = MMU.timerReload[0][3];
} }
} }
break; break;
@ -592,7 +605,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x102) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x102) & 0x40)
NDS_makeARM7Int(3); NDS_makeARM7Int(3);
MMU.timer[1][0] += MMU.timerReload[1][0]; MMU.timer[1][0] = MMU.timerReload[1][0];
} }
} }
break; break;
@ -619,6 +632,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40)
NDS_makeARM7Int(4); NDS_makeARM7Int(4);
MMU.timer[1][1] = MMU.timerReload[1][1];
} }
} }
break; break;
@ -633,7 +647,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x106) & 0x40)
NDS_makeARM7Int(4); NDS_makeARM7Int(4);
MMU.timer[1][1] += MMU.timerReload[1][1]; MMU.timer[1][1] = MMU.timerReload[1][1];
} }
} }
break; break;
@ -660,6 +674,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40)
NDS_makeARM7Int(5); NDS_makeARM7Int(5);
MMU.timer[1][2] = MMU.timerReload[1][2];
} }
} }
break; break;
@ -674,7 +689,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x10A) & 0x40)
NDS_makeARM7Int(5); NDS_makeARM7Int(5);
MMU.timer[1][2] += MMU.timerReload[1][2]; MMU.timer[1][2] = MMU.timerReload[1][2];
} }
} }
break; break;
@ -701,6 +716,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40)
NDS_makeARM7Int(6); NDS_makeARM7Int(6);
MMU.timer[1][3] += MMU.timerReload[1][3];
} }
} }
break; break;
@ -715,7 +731,7 @@ int NDS_CreateDummyFirmware(void);
{ {
if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40) if(T1ReadWord(MMU.ARM7_REG, 0x10E) & 0x40)
NDS_makeARM7Int(6); NDS_makeARM7Int(6);
MMU.timer[1][3] += MMU.timerReload[1][3]; MMU.timer[1][3] += MMU.timerReload[1][3];
} }
} }
break; break;
@ -804,3 +820,5 @@ int NDS_CreateDummyFirmware(void);
#endif #endif
#endif #endif