diff --git a/desmume/src/FIFO.cpp b/desmume/src/FIFO.cpp
index 7098e64a7..6312d1c8f 100644
--- a/desmume/src/FIFO.cpp
+++ b/desmume/src/FIFO.cpp
@@ -241,30 +241,23 @@ BOOL GFX_PIPErecv(u8 *cmd, u32 *param)
void GFX_FIFOcnt(u32 val)
{
- //zeromus: i dont like any of this.
-
////INFO("gxFIFO: write cnt 0x%08X (prev 0x%08X) FIFO size %03i PIPE size %03i\n", val, gxstat, gxFIFO.size, gxPIPE.size);
- //if (val & (1<<29)) // clear? (only in homebrew?)
- //{
- // GFX_PIPEclear();
- // GFX_FIFOclear();
- // return;
- //}
+ if (val & (1<<29)) // clear? (only in homebrew?)
+ {
+ GFX_PIPEclear();
+ GFX_FIFOclear();
+ return;
+ }
+ //zeromus says: what happened to clear stack?
//if (val & (1<<15)) // projection stack pointer reset
//{
// gfx3d_ClearStack();
// val &= 0xFFFF5FFF; // clear reset (bit15) & stack level (bit13)
//}
- //T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, val);
-
- //if (gxFIFO.size == 0) // empty
- //{
- // if (val & 0x80000000) // IRQ: empty
- // setIF(0, (1<<21));
- //}
+ T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x600, val);
}
// ========================================================= DISP FIFO
diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp
index 582a3bd8e..dcb1dae96 100644
--- a/desmume/src/GPU.cpp
+++ b/desmume/src/GPU.cpp
@@ -1,24 +1,20 @@
-/* GPU.cpp
- Copyright (C) 2006 yopyop
+/* Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 Theo Berkau
Copyright (C) 2007 shash
Copyright (C) 2008-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#include
@@ -2754,49 +2750,6 @@ template void GPU::modeRender(int layer)
}
}
-void gpu_UpdateRender()
-{
- /*int x = 0, y = 0;
- u16 *src = (u16*)GPU_screen;
- u16 *dst = (u16*)GPU_screen;
-
- switch (gpu_angle)
- {
- case 0:
- memcpy(dst, src, 256*192*4);
- break;
-
- case 90:
- for(y = 0; y < 384; y++)
- {
- for(x = 0; x < 256; x++)
- {
- dst[(383 - y) + (x * 384)] = src[x + (y * 256)];
- }
- }
- break;
- case 180:
- for(y = 0; y < 384; y++)
- {
- for(x = 0; x < 256; x++)
- {
- dst[(255 - x) + ((383 - y) * 256)] = src[x + (y * 256)];
- }
- }
- break;
- case 270:
- for(y = 0; y < 384; y++)
- {
- for(x = 0; x < 256; x++)
- {
- dst[y + ((255 - x) * 384)] = src[x + (y * 256)];
- }
- }
- default:
- break;
- }*/
-}
-
void gpu_SetRotateScreen(u16 angle)
{
gpu_angle = angle;
diff --git a/desmume/src/GPU.h b/desmume/src/GPU.h
index c3da7f448..82d791aee 100644
--- a/desmume/src/GPU.h
+++ b/desmume/src/GPU.h
@@ -1,26 +1,20 @@
/* Copyright (C) 2006 yopyop
- yopyop156@ifrance.com
- yopyop156.ifrance.com
-
Copyright (C) 2006-2007 Theo Berkau
Copyright (C) 2007 shash
- Copyright (C) 2009-2009 DeSmuME team
+ Copyright (C) 2009-2010 DeSmuME team
- This file is part of DeSmuME
-
- DeSmuME is free software; you can redistribute it and/or modify
+ This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
- DeSmuME is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ along with the this software. If not, see .
*/
#ifndef GPU_H
@@ -992,8 +986,6 @@ void SetupFinalPixelBlitter (GPU *gpu);
//#define GPU_setBGxHOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxHOFS = ((val) & 0x1FF)
//#define GPU_setBGxVOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxVOFS = ((val) & 0x1FF)
-// render
-void gpu_UpdateRender();
void gpu_SetRotateScreen(u16 angle);
//#undef FORCEINLINE
diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp
index b7be7e9e8..9e1fed578 100644
--- a/desmume/src/MMU.cpp
+++ b/desmume/src/MMU.cpp
@@ -1197,7 +1197,7 @@ u32 MMU_readFromGC()
// if needed, throw irq for the end of transfer
if(MMU.AUX_SPI_CNT & 0x4000)
- NDS_makeInt(TEST_PROCNUM, 19);
+ NDS_makeIrq(TEST_PROCNUM, IRQ_BIT_GC_TRANSFER_COMPLETE);
return val;
}
@@ -1244,8 +1244,6 @@ template static void REG_IF_WriteLong(u32 val)
template
u32 MMU_struct::gen_IF()
{
- //TODO - analyze setIF behaviour in GXF_FIFO_handleEvents
-
u32 IF = reg_IF_bits[PROCNUM];
if(PROCNUM==ARMCPU_ARM9)
@@ -1904,8 +1902,7 @@ void DmaController::doStop()
running = FALSE;
if(!repeatMode) enable = FALSE;
if(irq) {
- if(procnum==0) NDS_makeARM9Int(8+chan);
- else NDS_makeARM7Int(8+chan);
+ NDS_makeIrq(procnum,IRQ_BIT_DMA_0+chan);
}
}
diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp
index 1a705cf68..d09e8b419 100644
--- a/desmume/src/NDSSystem.cpp
+++ b/desmume/src/NDSSystem.cpp
@@ -1,21 +1,18 @@
/* Copyright (C) 2006 yopyop
Copyright (C) 2008-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#include
@@ -942,7 +939,7 @@ void NDS_ToggleCardEject()
if(!nds.cardEjected)
{
//staff of kings will test this (it also uses the arm9 0xB8 poll)
- NDS_makeInt(1, 20);
+ NDS_makeIrq(ARMCPU_ARM7, IRQ_BIT_GC_IREQ_MC);
}
nds.cardEjected ^= TRUE;
}
@@ -1171,8 +1168,7 @@ template struct TSequenceItem_Timer : public TSequenceItem
MMU.timer[procnum][i] = MMU.timerReload[procnum][i];
if(T1ReadWord(regs, 0x102 + i*4) & 0x40)
{
- if(procnum==0) NDS_makeARM9Int(3 + i);
- else NDS_makeARM7Int(3 + i);
+ NDS_makeIrq(procnum, IRQ_BIT_TIMER_0 + i);
}
}
else
@@ -1488,8 +1484,8 @@ static void execHardware_hblank()
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 2);
//fire hblank interrupts if necessary
- NDS_ARM9HBlankInt();
- NDS_ARM7HBlankInt();
+ if(T1ReadWord(MMU.ARM9_REG, 4) & 0x10) NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_LCD_HBLANK);
+ if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10) NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_LCD_HBLANK);
//emulation housekeeping. for some reason we always do this at hblank,
//even though it sounds more reasonable to do it at hstart
@@ -1520,8 +1516,8 @@ static void execHardware_hstart_vblankStart()
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1);
//fire vblank interrupts if necessary
- NDS_ARM9VBlankInt();
- NDS_ARM7VBlankInt();
+ if(T1ReadWord(MMU.ARM9_REG, 4) & 0x8) NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_LCD_VBLANK);
+ if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8) NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_LCD_VBLANK);
//some emulation housekeeping
gfx3d_VBlankSignal();
@@ -1547,7 +1543,7 @@ static void execHardware_hstart_vcount()
//arm9 vmatch
T1WriteWord(MMU.ARM9_REG, 4, T1ReadWord(MMU.ARM9_REG, 4) | 4);
if(T1ReadWord(MMU.ARM9_REG, 4) & 32) {
- NDS_makeARM9Int(2);
+ NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_LCD_VMATCH);
}
}
else
@@ -1560,7 +1556,7 @@ static void execHardware_hstart_vcount()
//arm7 vmatch
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 4);
if(T1ReadWord(MMU.ARM7_REG, 4) & 32)
- NDS_makeARM7Int(2);
+ NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_LCD_VMATCH);
}
else
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) & 0xFFFB);
@@ -1947,8 +1943,6 @@ void NDS_exec(s32 nb)
if(nds.sleeping)
{
- gpu_UpdateRender();
-
//speculative code: if ANY irq happens, wake up the arm7.
//I think the arm7 program analyzes the system and may decide not to wake up
//if it is dissatisfied with the conditions
@@ -2061,33 +2055,25 @@ void NDS_exec(s32 nb)
cheats->process();
}
+template static void execHardware_interrupts_core()
+{
+ u32 IF = MMU.gen_IF();
+ u32 IE = MMU.reg_IE[PROCNUM];
+ u32 masked = IF & IE;
+ if(ARMPROC.halt_IE_and_IF && masked)
+ {
+ ARMPROC.halt_IE_and_IF = FALSE;
+ ARMPROC.waitIRQ = FALSE;
+ }
+
+ if(masked && MMU.reg_IME[PROCNUM] && !ARMPROC.CPSR.bits.I)
+ armcpu_irqException(&ARMPROC);
+}
+
void execHardware_interrupts()
{
- if((MMU.reg_IME[0]) && (MMU.gen_IF<0>()&MMU.reg_IE[0]))
- {
- //TODO - remove GDB specific code
-//#ifdef GDB_STUB
-// if ( armcpu_flagIrq( &NDS_ARM9))
-//#else
- if ( armcpu_irqException(&NDS_ARM9))
-//#endif
- {
- //printf("ARM9 interrupt! flags: %08X ; mask: %08X ; result: %08X\n",MMU.reg_IF[0],MMU.reg_IE[0],MMU.reg_IF[0]&MMU.reg_IE[0]);
- //nds.ARM9Cycle = nds.cycles;
- }
- }
-//TODO - remove GDB specific code
- if((MMU.reg_IME[1]) && (MMU.gen_IF<1>()&MMU.reg_IE[1]))
- {
-//#ifdef GDB_STUB
-// if ( armcpu_flagIrq( &NDS_ARM7))
-//#else
- if ( armcpu_irqException(&NDS_ARM7))
-//#endif
- {
- //nds.ARM7Cycle = nds.cycles;
- }
- }
+ execHardware_interrupts_core();
+ execHardware_interrupts_core();
}
static void resetUserInput();
@@ -2741,11 +2727,11 @@ static void NDS_applyFinalInput()
u16 k_cnt_selected = (k_cnt & 0x3F);
if (k_cnt&(1<<15)) // AND
{
- if ((~pad & k_cnt_selected) == k_cnt_selected) NDS_makeARM9Int(12);
+ if ((~pad & k_cnt_selected) == k_cnt_selected) NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_KEYPAD);
}
else // OR
{
- if (~pad & k_cnt_selected) NDS_makeARM9Int(12);
+ if (~pad & k_cnt_selected) NDS_makeIrq(ARMCPU_ARM9,IRQ_BIT_KEYPAD);
}
}
@@ -2756,11 +2742,11 @@ static void NDS_applyFinalInput()
u16 k_cnt_selected = (k_cnt & 0x3F);
if (k_cnt&(1<<15)) // AND
{
- if ((~pad & k_cnt_selected) == k_cnt_selected) NDS_makeARM7Int(12);
+ if ((~pad & k_cnt_selected) == k_cnt_selected) NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_KEYPAD);
}
else // OR
{
- if (~pad & k_cnt_selected) NDS_makeARM7Int(12);
+ if (~pad & k_cnt_selected) NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_KEYPAD);
}
}
@@ -2789,7 +2775,7 @@ static void NDS_applyFinalInput()
if (!LidClosed)
{
// SPU_Pause(FALSE);
- NDS_makeARM7Int(22);
+ NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_ARM7_FOLD);
}
//else
diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h
index 635b81933..1078848ac 100644
--- a/desmume/src/NDSSystem.h
+++ b/desmume/src/NDSSystem.h
@@ -1,21 +1,18 @@
/* Copyright (C) 2006 yopyop
Copyright (C) 2008-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#ifndef NDSSYSTEM_H
@@ -457,43 +454,6 @@ template void NDS_exec(s32 nb = 560190<<1);
extern int lagframecounter;
-static INLINE void NDS_ARM9HBlankInt(void)
-{
- if(T1ReadWord(MMU.ARM9_REG, 4) & 0x10)
- {
- //MMU.reg_IF[0] |= 2;// & (MMU.reg_IME[0] << 1);// (MMU.reg_IE[0] & (1<<1));
- setIF(0, 2);
- }
-}
-
-static INLINE void NDS_ARM7HBlankInt(void)
-{
- if(T1ReadWord(MMU.ARM7_REG, 4) & 0x10)
- {
- // MMU.reg_IF[1] |= 2;// & (MMU.reg_IME[1] << 1);// (MMU.reg_IE[1] & (1<<1));
- setIF(1, 2);
- }
-}
-
-static INLINE void NDS_ARM9VBlankInt(void)
-{
- if(T1ReadWord(MMU.ARM9_REG, 4) & 0x8)
- {
- // MMU.reg_IF[0] |= 1;// & (MMU.reg_IME[0]);// (MMU.reg_IE[0] & 1);
- setIF(0, 1);
- //emu_halt();
- /*logcount++;*/
- }
-}
-
-static INLINE void NDS_ARM7VBlankInt(void)
-{
- if(T1ReadWord(MMU.ARM7_REG, 4) & 0x8)
- // MMU.reg_IF[1] |= 1;// & (MMU.reg_IME[1]);// (MMU.reg_IE[1] & 1);
- setIF(1, 1);
- //emu_halt();
-}
-
static INLINE void NDS_swapScreen(void)
{
u16 tmp = MainScreen.offset;
@@ -503,8 +463,6 @@ static INLINE void NDS_swapScreen(void)
int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename);
-
-
extern struct TCommonSettings {
TCommonSettings()
: GFX3D_HighResolutionInterpolateColor(true)
diff --git a/desmume/src/addons/slot1_r4.cpp b/desmume/src/addons/slot1_r4.cpp
index b02acab19..593124ed2 100644
--- a/desmume/src/addons/slot1_r4.cpp
+++ b/desmume/src/addons/slot1_r4.cpp
@@ -94,7 +94,7 @@ static void write32_GCDATAIN(u32 val)
// if needed, throw irq for the end of transfer
if(MMU.AUX_SPI_CNT & 0x4000)
- NDS_makeInt(0, 19);
+ NDS_makeIrq(ARMCPU_ARM9, IRQ_BIT_GC_TRANSFER_COMPLETE);
return;
}
@@ -124,7 +124,7 @@ static void write32_GCDATAIN(u32 val)
// if needed, throw irq for the end of transfer
if(MMU.AUX_SPI_CNT & 0x4000)
- NDS_makeInt(0, 19);
+ NDS_makeIrq(ARMCPU_ARM9, IRQ_BIT_GC_TRANSFER_COMPLETE);
}
/*if(log)
diff --git a/desmume/src/armcpu.cpp b/desmume/src/armcpu.cpp
index 9b566fe0c..bff45cc58 100644
--- a/desmume/src/armcpu.cpp
+++ b/desmume/src/armcpu.cpp
@@ -1,21 +1,18 @@
/* Copyright (C) 2006 yopyop
- Copyright (C) 2009 DeSmuME team
+ Copyright (C) 2009-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#include
@@ -211,6 +208,8 @@ int armcpu_new( armcpu_t *armcpu, u32 id)
void armcpu_t::changeCPSR()
{
//but all it does is give them a chance to unleash by forcing an immediate reschedule
+ //TODO - we could actually set CPSR through here and look for a change in the I bit
+ //that would be a little optimization as well as a safety measure if we prevented setting CPSR directly
NDS_Reschedule();
}
@@ -221,7 +220,7 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
armcpu->LDTBit = (armcpu->proc_ID==0); //Si ARM9 utiliser le syte v5 pour le load
armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0);
armcpu->waitIRQ = FALSE;
- armcpu->wirq = FALSE;
+ armcpu->halt_IE_and_IF = FALSE;
//#ifdef GDB_STUB
// armcpu->irq_flag = 0;
@@ -373,30 +372,8 @@ u32 armcpu_switchMode(armcpu_t *armcpu, u8 mode)
u32 armcpu_Wait4IRQ(armcpu_t *cpu)
{
- u32 instructAddr = cpu->instruct_adr;
- // on the first call, wirq is not set
- if(cpu->wirq)
- {
- // check wether an irq was issued
- if(!cpu->waitIRQ)
- {
- cpu->waitIRQ = 0;
- cpu->wirq = 0;
- return 1; // return execution
- }
- // otherwise, repeat this instruction
- cpu->R[15] = instructAddr;
- cpu->next_instruction = instructAddr;
- return 1;
- }
-
- // first run, set us into waiting state
- cpu->waitIRQ = 1;
- cpu->wirq = 1;
- // and set next instruction to repeat this
- cpu->R[15] = instructAddr;
- cpu->next_instruction = instructAddr;
- // only SWI set IME to 1
+ cpu->waitIRQ = TRUE;
+ cpu->halt_IE_and_IF = TRUE;
return 1;
}
@@ -538,8 +515,6 @@ BOOL armcpu_irqException(armcpu_t *armcpu)
{
Status_Reg tmp;
- if(armcpu->CPSR.bits.I) return FALSE;
-
//TODO - remove GDB specific code
//#ifdef GDB_STUB
// armcpu->irq_flag = 0;
diff --git a/desmume/src/armcpu.h b/desmume/src/armcpu.h
index 0aca4c6da..051c8d75d 100644
--- a/desmume/src/armcpu.h
+++ b/desmume/src/armcpu.h
@@ -1,21 +1,18 @@
/* Copyright (C) 2006 yopyop
Copyright (C) 2008-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#ifndef ARM_CPU
@@ -208,7 +205,7 @@ struct armcpu_t
u32 intVector;
u8 LDTBit; //1 : ARMv5 style 0 : non ARMv5
BOOL waitIRQ;
- BOOL wirq;
+ BOOL halt_IE_and_IF; //the cpu is halted, waiting for IE&IF to signal something
BOOL BIOS_loaded;
@@ -268,42 +265,13 @@ static INLINE void setIF(int PROCNUM, u32 flag)
extern void NDS_Reschedule();
NDS_Reschedule();
-
- //TODO SEP - was this necessary??? - CrazyMax 2010/09/25: needs for boot firmware
- //generate the interrupt if enabled
- if ((MMU.reg_IE[PROCNUM] & (flag)) && MMU.reg_IME[PROCNUM])
- {
- if(PROCNUM==0)
- NDS_ARM9.waitIRQ = FALSE;
- else
- NDS_ARM7.waitIRQ = FALSE;
- }
}
-static INLINE void NDS_makeARM9Int(u32 num)
+static INLINE void NDS_makeIrq(int PROCNUM, u32 num)
{
- setIF(0, (1<.
*/
#include "cp15.h"
@@ -213,27 +209,9 @@ TEMPLATE static u32 WaitByLoop()
TEMPLATE static u32 wait4IRQ()
{
- //execute= FALSE;
- u32 instructAddr = cpu->instruct_adr;
- if(cpu->wirq)
- {
- if(!cpu->waitIRQ)
- {
- cpu->waitIRQ = 0;
- cpu->wirq = 0;
- //cpu->switchMode(oldmode[cpu->proc_ID]);
- return 1;
- }
- cpu->R[15] = instructAddr;
- cpu->next_instruction = instructAddr;
- return 1;
- }
- cpu->waitIRQ = 1;
- cpu->wirq = 1;
- cpu->R[15] = instructAddr;
- cpu->next_instruction = instructAddr;
- //oldmode[cpu->proc_ID] = cpu->switchMode(SVC);
- return 1;
+ cpu->waitIRQ = TRUE;
+ cpu->halt_IE_and_IF = TRUE;
+ return 1;
}
TEMPLATE u32 intrWaitARM()
@@ -256,8 +234,8 @@ TEMPLATE u32 intrWaitARM()
//if(!noDiscard)
// intrFlag &= cpu->newIrqFlags;
- MMU.reg_IME[PROCNUM] = 1;
- _MMU_write32(0x04000208, 1); // set IME=1
+ //set IME=1
+ _MMU_write32(0x04000208, 1);
if (intrFlag)
{
@@ -269,8 +247,8 @@ TEMPLATE u32 intrWaitARM()
u32 instructAddr = cpu->instruct_adr;
cpu->R[15] = instructAddr;
cpu->next_instruction = instructAddr;
- cpu->waitIRQ = 1;
- cpu->wirq = 1;
+ cpu->waitIRQ = TRUE;
+ cpu->halt_IE_and_IF = TRUE;
return 1;
}
diff --git a/desmume/src/cp15.cpp b/desmume/src/cp15.cpp
index d793d2f91..756ab8ddd 100644
--- a/desmume/src/cp15.cpp
+++ b/desmume/src/cp15.cpp
@@ -1,22 +1,18 @@
/* Copyright (C) 2006 yopyop
- yopyop156@ifrance.com
- yopyop156.ifrance.com
+ Copyright (C) 2006-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#include
@@ -30,7 +26,7 @@ armcp15_t *armcp15_new(armcpu_t * c)
int i;
armcp15_t *armcp15 = (armcp15_t*)malloc(sizeof(armcp15_t));
if(!armcp15) return NULL;
-
+
armcp15->cpu = c;
armcp15->IDCode = 0x41049460;
@@ -62,22 +58,22 @@ armcp15_t *armcp15_new(armcpu_t * c)
armcp15->cpu->intVector = 0xFFFF0000 * (BIT13(armcp15->ctrl));
armcp15->cpu->LDTBit = !BIT15(armcp15->ctrl); //TBit
- /* preset calculated regionmasks */
+ /* preset calculated regionmasks */
for (i=0;i<8;i++) {
- armcp15->regionWriteMask_USR[i] = 0 ;
- armcp15->regionWriteMask_SYS[i] = 0 ;
- armcp15->regionReadMask_USR[i] = 0 ;
- armcp15->regionReadMask_SYS[i] = 0 ;
- armcp15->regionExecuteMask_USR[i] = 0 ;
- armcp15->regionExecuteMask_SYS[i] = 0 ;
- armcp15->regionWriteSet_USR[i] = 0 ;
- armcp15->regionWriteSet_SYS[i] = 0 ;
- armcp15->regionReadSet_USR[i] = 0 ;
- armcp15->regionReadSet_SYS[i] = 0 ;
- armcp15->regionExecuteSet_USR[i] = 0 ;
- armcp15->regionExecuteSet_SYS[i] = 0 ;
- } ;
-
+ armcp15->regionWriteMask_USR[i] = 0 ;
+ armcp15->regionWriteMask_SYS[i] = 0 ;
+ armcp15->regionReadMask_USR[i] = 0 ;
+ armcp15->regionReadMask_SYS[i] = 0 ;
+ armcp15->regionExecuteMask_USR[i] = 0 ;
+ armcp15->regionExecuteMask_SYS[i] = 0 ;
+ armcp15->regionWriteSet_USR[i] = 0 ;
+ armcp15->regionWriteSet_SYS[i] = 0 ;
+ armcp15->regionReadSet_USR[i] = 0 ;
+ armcp15->regionReadSet_SYS[i] = 0 ;
+ armcp15->regionExecuteSet_USR[i] = 0 ;
+ armcp15->regionExecuteSet_SYS[i] = 0 ;
+ } ;
+
return armcp15;
}
@@ -198,19 +194,19 @@ static void armcp15_setSingleRegionAccess(armcp15_t *armcp15,u32 dAccess,u32 iAc
/* precalculate region masks/sets from cp15 register */
static void armcp15_maskPrecalc(armcp15_t *armcp15)
{
- #define precalc(num) { \
+#define precalc(num) { \
u32 mask = 0, set = 0xFFFFFFFF ; /* (x & 0) == 0xFF..FF is allways false (disabled) */ \
if (BIT_N(armcp15->protectBaseSize##num,0)) /* if region is enabled */ \
{ /* reason for this define: naming includes var */ \
- mask = MASKFROMREG(armcp15->protectBaseSize##num) ; \
- set = SETFROMREG(armcp15->protectBaseSize##num) ; \
- if (SIZEIDENTIFIER(armcp15->protectBaseSize##num)==0x1F) \
- { /* for the 4GB region, u32 suffers wraparound */ \
- mask = 0 ; set = 0 ; /* (x & 0) == 0 is allways true (enabled) */ \
- } \
- } \
- armcp15_setSingleRegionAccess(armcp15,armcp15->DaccessPerm,armcp15->IaccessPerm,num,mask,set) ; \
- }
+ mask = MASKFROMREG(armcp15->protectBaseSize##num) ; \
+ set = SETFROMREG(armcp15->protectBaseSize##num) ; \
+ if (SIZEIDENTIFIER(armcp15->protectBaseSize##num)==0x1F) \
+ { /* for the 4GB region, u32 suffers wraparound */ \
+ mask = 0 ; set = 0 ; /* (x & 0) == 0 is allways true (enabled) */ \
+} \
+} \
+ armcp15_setSingleRegionAccess(armcp15,armcp15->DaccessPerm,armcp15->IaccessPerm,num,mask,set) ; \
+}
precalc(0) ;
precalc(1) ;
precalc(2) ;
@@ -253,208 +249,181 @@ BOOL armcp15_isAccessAllowed(armcp15_t *armcp15,u32 address,u32 access)
BOOL armcp15_dataProcess(armcp15_t *armcp15, u8 CRd, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2)
{
- LOG("Unsupported CP15 operation : DataProcess\n");
- return FALSE;
+ LOG("Unsupported CP15 operation : DataProcess\n");
+ return FALSE;
}
BOOL armcp15_load(armcp15_t *armcp15, u8 CRd, u8 adr)
{
LOG("Unsupported CP15 operation : Load\n");
- return FALSE;
+ return FALSE;
}
BOOL armcp15_store(armcp15_t *armcp15, u8 CRd, u8 adr)
{
LOG("Unsupported CP15 operation : Store\n");
- return FALSE;
+ return FALSE;
}
BOOL armcp15_moveCP2ARM(armcp15_t *armcp15, u32 * R, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2)
{
if(armcp15->cpu->CPSR.bits.mode == USR) return FALSE;
-
+
switch(CRn)
{
- case 0 :
- if((opcode1 == 0)&&(CRm==0))
- {
+ case 0:
+ if((opcode1 == 0)&&(CRm==0))
+ {
switch(opcode2)
{
- case 1 :
- *R = armcp15->cacheType;
- return TRUE;
- case 2 :
- *R = armcp15->TCMSize;
- return TRUE;
- default :
- *R = armcp15->IDCode;
- return TRUE;
- }
- }
- return FALSE;
- case 1 :
- if((opcode1==0) && (opcode2==0) && (CRm==0))
- {
- *R = armcp15->ctrl;
- //LOG("CP15: CPtoARM ctrl %08X\n", armcp15->ctrl);
+ case 1:
+ *R = armcp15->cacheType;
+ return TRUE;
+ case 2:
+ *R = armcp15->TCMSize;
+ return TRUE;
+ default:
+ *R = armcp15->IDCode;
return TRUE;
}
- return FALSE;
-
- case 2 :
- if((opcode1==0) && (CRm==0))
- {
- switch(opcode2)
- {
- case 0 :
- *R = armcp15->DCConfig;
- return TRUE;
- case 1 :
- *R = armcp15->ICConfig;
- return TRUE;
- default :
- return FALSE;
- }
- }
- return FALSE;
- case 3 :
- if((opcode1==0) && (opcode2==0) && (CRm==0))
- {
- *R = armcp15->writeBuffCtrl;
- //LOG("CP15: CPtoARM writeBuffer ctrl %08X\n", armcp15->writeBuffCtrl);
- return TRUE;
- }
- return FALSE;
- case 5 :
- if((opcode1==0) && (CRm==0))
- {
- switch(opcode2)
- {
- case 2 :
- *R = armcp15->DaccessPerm;
- return TRUE;
- case 3 :
- *R = armcp15->IaccessPerm;
- return TRUE;
- default :
- return FALSE;
- }
- }
- return FALSE;
- case 6 :
- if((opcode1==0) && (opcode2==0))
- {
- switch(CRm)
- {
- case 0 :
- *R = armcp15->protectBaseSize0;
- return TRUE;
- case 1 :
- *R = armcp15->protectBaseSize1;
- return TRUE;
- case 2 :
- *R = armcp15->protectBaseSize2;
- return TRUE;
- case 3 :
- *R = armcp15->protectBaseSize3;
- return TRUE;
- case 4 :
- *R = armcp15->protectBaseSize4;
- return TRUE;
- case 5 :
- *R = armcp15->protectBaseSize5;
- return TRUE;
- case 6 :
- *R = armcp15->protectBaseSize6;
- return TRUE;
- case 7 :
- *R = armcp15->protectBaseSize7;
- return TRUE;
- default :
- return FALSE;
- }
- }
- return FALSE;
- case 9 :
- if((opcode1==0))
- {
- switch(CRm)
- {
- case 0 :
- switch(opcode2)
- {
- case 0 :
- *R = armcp15->DcacheLock;
- return TRUE;
- case 1 :
- *R = armcp15->IcacheLock;
- return TRUE;
- default :
- return FALSE;
- }
- case 1 :
- switch(opcode2)
- {
- case 0 :
- *R = armcp15->DTCMRegion;
- return TRUE;
- case 1 :
- *R = armcp15->ITCMRegion;
- return TRUE;
- default :
- return FALSE;
- }
- }
- }
+ }
+ return FALSE;
+ case 1:
+ if((opcode1==0) && (opcode2==0) && (CRm==0))
+ {
+ *R = armcp15->ctrl;
+ //LOG("CP15: CPtoARM ctrl %08X\n", armcp15->ctrl);
+ return TRUE;
+ }
+ return FALSE;
+
+ case 2:
+ if((opcode1==0) && (CRm==0))
+ {
+ switch(opcode2)
+ {
+ case 0:
+ *R = armcp15->DCConfig;
+ return TRUE;
+ case 1:
+ *R = armcp15->ICConfig;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ }
+ return FALSE;
+ case 3:
+ if((opcode1==0) && (opcode2==0) && (CRm==0))
+ {
+ *R = armcp15->writeBuffCtrl;
+ //LOG("CP15: CPtoARM writeBuffer ctrl %08X\n", armcp15->writeBuffCtrl);
+ return TRUE;
+ }
+ return FALSE;
+ case 5:
+ if((opcode1==0) && (CRm==0))
+ {
+ switch(opcode2)
+ {
+ case 2:
+ *R = armcp15->DaccessPerm;
+ return TRUE;
+ case 3:
+ *R = armcp15->IaccessPerm;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ }
+ return FALSE;
+ case 6:
+ if((opcode1==0) && (opcode2==0))
+ {
+ switch(CRm)
+ {
+ case 0:
+ *R = armcp15->protectBaseSize0;
+ return TRUE;
+ case 1:
+ *R = armcp15->protectBaseSize1;
+ return TRUE;
+ case 2:
+ *R = armcp15->protectBaseSize2;
+ return TRUE;
+ case 3:
+ *R = armcp15->protectBaseSize3;
+ return TRUE;
+ case 4:
+ *R = armcp15->protectBaseSize4;
+ return TRUE;
+ case 5:
+ *R = armcp15->protectBaseSize5;
+ return TRUE;
+ case 6:
+ *R = armcp15->protectBaseSize6;
+ return TRUE;
+ case 7:
+ *R = armcp15->protectBaseSize7;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ }
+ return FALSE;
+ case 9:
+ if((opcode1==0))
+ {
+ switch(CRm)
+ {
+ case 0:
+ switch(opcode2)
+ {
+ case 0:
+ *R = armcp15->DcacheLock;
+ return TRUE;
+ case 1:
+ *R = armcp15->IcacheLock;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ case 1:
+ switch(opcode2)
+ {
+ case 0:
+ *R = armcp15->DTCMRegion;
+ return TRUE;
+ case 1:
+ *R = armcp15->ITCMRegion;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ }
+ }
+ return FALSE;
+ default:
+ LOG("Unsupported CP15 operation : MRC\n");
return FALSE;
- default :
- LOG("Unsupported CP15 operation : MRC\n");
- return FALSE;
}
}
static u32 CP15wait4IRQ(armcpu_t *cpu)
{
-#if 1
- u32 instructAddr = cpu->instruct_adr;
- // on the first call, wirq is not set
- if(cpu->wirq)
- {
- // check wether an irq was issued
- if(!cpu->waitIRQ)
- {
- cpu->waitIRQ = 0;
- cpu->wirq = 0;
- return 1; // return execution
- }
- // otherwise, repeat this instruction
- cpu->R[15] = instructAddr;
- cpu->next_instruction = instructAddr;
- return 1;
- }
-
- // first run, set us into waiting state
- cpu->waitIRQ = 1;
- cpu->wirq = 1;
- // and set next instruction to repeat this
- cpu->R[15] = instructAddr;
- cpu->next_instruction = instructAddr;
-#else
- //printf("CP15: IME %X, IE %08X, IF %08X res %08X\n", MMU.reg_IME[0], MMU.reg_IE[0], MMU.reg_IF[0], MMU.reg_IE[0] & MMU.reg_IF[0]);
- //if ((MMU.reg_IE[0] & MMU.reg_IF[0]) == 0) return 1;
- cpu->waitIRQ = 1;
-#endif
- // only SWI set IME to 1
+ cpu->waitIRQ = TRUE;
+ cpu->halt_IE_and_IF = TRUE;
+ //IME set deliberately omitted: only SWI sets IME to 1
return 1;
}
BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2)
{
if(armcp15->cpu->CPSR.bits.mode == USR) return FALSE;
-
+
switch(CRn)
{
- case 1 :
+ case 1:
if((opcode1==0) && (opcode2==0) && (CRm==0))
{
@@ -464,36 +433,27 @@ BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1,
//zero 31-jan-2010: change from 0x0FFF0000 to 0xFFFF0000 per gbatek
armcp15->cpu->intVector = 0xFFFF0000 * (BIT13(val));
armcp15->cpu->LDTBit = !BIT15(val); //TBit
- /*if(BIT17(val))
- {
- log::ajouter("outch !!!!!!!");
- }
- if(BIT19(val))
- {
- log::ajouter("outch !!!!!!!");
- }*/
-
//LOG("CP15: ARMtoCP ctrl %08X (val %08X)\n", armcp15->ctrl, val);
return TRUE;
}
return FALSE;
- case 2 :
+ case 2:
if((opcode1==0) && (CRm==0))
{
switch(opcode2)
{
- case 0 :
- armcp15->DCConfig = val;
- return TRUE;
- case 1 :
- armcp15->ICConfig = val;
- return TRUE;
- default :
- return FALSE;
+ case 0:
+ armcp15->DCConfig = val;
+ return TRUE;
+ case 1:
+ armcp15->ICConfig = val;
+ return TRUE;
+ default:
+ return FALSE;
}
}
return FALSE;
- case 3 :
+ case 3:
if((opcode1==0) && (opcode2==0) && (CRm==0))
{
armcp15->writeBuffCtrl = val;
@@ -501,114 +461,109 @@ BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1,
return TRUE;
}
return FALSE;
- case 5 :
+ case 5:
if((opcode1==0) && (CRm==0))
{
switch(opcode2)
{
- case 2 :
- armcp15->DaccessPerm = val;
- armcp15_maskPrecalc(armcp15);
- return TRUE;
- case 3 :
- armcp15->IaccessPerm = val;
- armcp15_maskPrecalc(armcp15);
- return TRUE;
- default :
- return FALSE;
+ case 2:
+ armcp15->DaccessPerm = val;
+ armcp15_maskPrecalc(armcp15);
+ return TRUE;
+ case 3:
+ armcp15->IaccessPerm = val;
+ armcp15_maskPrecalc(armcp15);
+ return TRUE;
+ default:
+ return FALSE;
}
}
return FALSE;
- case 6 :
+ case 6:
if((opcode1==0) && (opcode2==0))
{
switch(CRm)
{
- case 0 :
- armcp15->protectBaseSize0 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 1 :
- armcp15->protectBaseSize1 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 2 :
- armcp15->protectBaseSize2 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 3 :
- armcp15->protectBaseSize3 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 4 :
- armcp15->protectBaseSize4 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 5 :
- armcp15->protectBaseSize5 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 6 :
- armcp15->protectBaseSize6 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- case 7 :
- armcp15->protectBaseSize7 = val;
- armcp15_maskPrecalc(armcp15) ;
- return TRUE;
- default :
- return FALSE;
+ case 0:
+ armcp15->protectBaseSize0 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 1:
+ armcp15->protectBaseSize1 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 2:
+ armcp15->protectBaseSize2 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 3:
+ armcp15->protectBaseSize3 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 4:
+ armcp15->protectBaseSize4 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 5:
+ armcp15->protectBaseSize5 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 6:
+ armcp15->protectBaseSize6 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ case 7:
+ armcp15->protectBaseSize7 = val;
+ armcp15_maskPrecalc(armcp15) ;
+ return TRUE;
+ default:
+ return FALSE;
}
}
return FALSE;
- case 7 :
+ case 7:
if((CRm==0)&&(opcode1==0)&&((opcode2==4)))
{
CP15wait4IRQ(armcp15->cpu);
return TRUE;
}
return FALSE;
- case 9 :
+ case 9:
if((opcode1==0))
{
switch(CRm)
{
- case 0 :
+ case 0:
switch(opcode2)
{
- case 0 :
- armcp15->DcacheLock = val;
- return TRUE;
- case 1 :
- armcp15->IcacheLock = val;
- return TRUE;
- default :
- return FALSE;
- }
- case 1 :
- switch(opcode2)
- {
- case 0 :
- MMU.DTCMRegion = armcp15->DTCMRegion = val & 0x0FFFF000;
- //MMU.DTCMRegion = val;
- //MMU.DTCMRegion = val & 0x0FFFFFFC0;
- //LOG("CP15: set DTCM %08X (size %i)\n", MMU.DTCMRegion, 512<<(val & 0x00000FFF));
- /*sprintf(logbuf, "%08X", val);
- log::ajouter(logbuf);*/
+ case 0:
+ armcp15->DcacheLock = val;
return TRUE;
- case 1 :
+ case 1:
+ armcp15->IcacheLock = val;
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ case 1:
+ switch(opcode2)
+ {
+ case 0:
+ MMU.DTCMRegion = armcp15->DTCMRegion = val & 0x0FFFF000;
+ return TRUE;
+ case 1:
armcp15->ITCMRegion = val;
- /* ITCM base is not writeable! */
+ //ITCM base is not writeable!
MMU.ITCMRegion = 0;
return TRUE;
- default :
+ default:
return FALSE;
}
}
}
return FALSE;
- default :
- return FALSE;
+ default:
+ return FALSE;
}
}
diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp
index cb4cc086c..dfbd24cdf 100644
--- a/desmume/src/gfx3d.cpp
+++ b/desmume/src/gfx3d.cpp
@@ -1977,23 +1977,6 @@ void gfx3d_execute3D()
} else break;
}
-
- //i thought it might be right to move these here, but it didnt help.
- //maybe its a good idea for later.
-
- //if(gxFIFO.size <= 127)
- //{
- // if(gxstat.gxfifo_irq == 1)
- // setIF(0, (1<<21)); //the half gxfifo irq
- //
- // //might need to trigger a gxfifo dma
- // triggerDma(EDMAMode_GXFifo);
- //}
-
- //if(gxFIFO.size == 0) {
- // if(gxstat.gxfifo_irq == 2)
- // setIF(0, (1<<21)); //the empty gxfifo irq
- //}
}
void gfx3d_glFlush(u32 v)
diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp
index 0da61ded7..81e518dbd 100644
--- a/desmume/src/saves.cpp
+++ b/desmume/src/saves.cpp
@@ -3,21 +3,18 @@
Copyright (C) 2007 Pascal Giard
Copyright (C) 2008-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#ifdef HAVE_LIBZ
@@ -96,8 +93,7 @@ SFORMAT SF_ARM7[]={
{ "7int", 4, 1, &NDS_ARM7.intVector },
{ "7LDT", 1, 1, &NDS_ARM7.LDTBit },
{ "7Wai", 4, 1, &NDS_ARM7.waitIRQ },
- //{ "7wIR", 4, 1, &NDS_ARM7.wIRQ, },
- { "7wir", 4, 1, &NDS_ARM7.wirq, },
+ { "7hef", 4, 1, &NDS_ARM7.halt_IE_and_IF },
{ 0 }
};
@@ -133,8 +129,7 @@ SFORMAT SF_ARM9[]={
{ "9int", 4, 1, &NDS_ARM9.intVector},
{ "9LDT", 1, 1, &NDS_ARM9.LDTBit},
{ "9Wai", 4, 1, &NDS_ARM9.waitIRQ},
- //{ "9wIR", 4, 1, &NDS_ARM9.wIRQ},
- { "9wir", 4, 1, &NDS_ARM9.wirq},
+ { "9hef", 4, 1, &NDS_ARM9.halt_IE_and_IF },
{ 0 }
};
diff --git a/desmume/src/wifi.cpp b/desmume/src/wifi.cpp
index 79027a8ad..52955573e 100644
--- a/desmume/src/wifi.cpp
+++ b/desmume/src/wifi.cpp
@@ -1,21 +1,18 @@
/* Copyright (C) 2007 Tim Seidel
- Copyright (C) 2008-2009 DeSmuME team
+ Copyright (C) 2008-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
#include
@@ -588,7 +585,7 @@ static void WIFI_triggerIRQMask(u16 mask)
if (!oResult && nResult)
{
- NDS_makeARM7Int(24); /* cascade it via arm7 wifi irq */
+ NDS_makeIrq(ARMCPU_ARM7,IRQ_BIT_ARM7_WIFI); /* cascade it via arm7 wifi irq */
}
}
diff --git a/desmume/src/windows/DeSmuME_2005.vcproj b/desmume/src/windows/DeSmuME_2005.vcproj
index 575bdec7b..5d31ded47 100644
--- a/desmume/src/windows/DeSmuME_2005.vcproj
+++ b/desmume/src/windows/DeSmuME_2005.vcproj
@@ -51,7 +51,7 @@
AdditionalOptions="/MP"
Optimization="0"
InlineFunctionExpansion="0"
- EnableIntrinsicFunctions="false"
+ EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="0"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp
index 972f83211..b82233c53 100644
--- a/desmume/src/windows/main.cpp
+++ b/desmume/src/windows/main.cpp
@@ -2,21 +2,18 @@
Copyright 2006 Theo Berkau
Copyright (C) 2006-2010 DeSmuME team
- This file is part of DeSmuME
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- DeSmuME is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This file is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- DeSmuME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DeSmuME; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ You should have received a copy of the GNU General Public License
+ along with the this software. If not, see .
*/
// icon gradient: #f6f6fb to #8080c0
@@ -2646,7 +2643,7 @@ int _main()
return 1;
}
cmdline.validate();
- start_paused = cmdline.start_paused;
+ start_paused = cmdline.start_paused!=0;
Desmume_InitOnce();