simplify irq and wait4IRQ handling and related cleanup. this could potentially cause bugs.
This commit is contained in:
parent
ec51fa5be0
commit
6a33eb0cf8
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -2754,49 +2750,6 @@ template<bool MOSAIC> 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;
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
|
|
@ -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<int PROCNUM> static void REG_IF_WriteLong(u32 val)
|
|||
template<int PROCNUM>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2008-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -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<int procnum, int num> 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<int PROCNUM> static void execHardware_interrupts_core()
|
||||
{
|
||||
u32 IF = MMU.gen_IF<PROCNUM>();
|
||||
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<ARMCPU_ARM9>();
|
||||
execHardware_interrupts_core<ARMCPU_ARM7>();
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2008-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NDSSYSTEM_H
|
||||
|
@ -457,43 +454,6 @@ template<bool FORCE> 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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
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 3 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -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;
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2008-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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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<<num));
|
||||
setIF(PROCNUM,1<<num);
|
||||
}
|
||||
|
||||
static INLINE void NDS_makeARM7Int(u32 num)
|
||||
{
|
||||
setIF(1, (1<<num));
|
||||
}
|
||||
|
||||
static INLINE void NDS_makeInt(u8 proc_ID,u32 num)
|
||||
{
|
||||
switch (proc_ID)
|
||||
{
|
||||
case 0:
|
||||
NDS_makeARM9Int(num) ;
|
||||
break ;
|
||||
case 1:
|
||||
NDS_makeARM7Int(num) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static INLINE char *decodeIntruction(bool thumb_mode, u32 instr)
|
||||
{
|
||||
char txt[20] = {0};
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
Copyright (C) 2008-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 3 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cp15.h"
|
||||
|
@ -213,26 +209,8 @@ 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);
|
||||
cpu->waitIRQ = TRUE;
|
||||
cpu->halt_IE_and_IF = TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -256,8 +234,8 @@ TEMPLATE u32 intrWaitARM()
|
|||
//if(!noDiscard)
|
||||
// intrFlag &= cpu->newIrqFlags;
|
||||
|
||||
MMU.reg_IME[PROCNUM] = 1;
|
||||
_MMU_write32<PROCNUM>(0x04000208, 1); // set IME=1
|
||||
//set IME=1
|
||||
_MMU_write32<PROCNUM>(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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
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 3 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -415,36 +411,9 @@ BOOL armcp15_moveCP2ARM(armcp15_t *armcp15, u32 * R, u8 CRn, u8 CRm, u8 opcode1,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -464,15 +433,6 @@ 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;
|
||||
}
|
||||
|
@ -590,15 +550,10 @@ BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1,
|
|||
{
|
||||
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);*/
|
||||
return TRUE;
|
||||
case 1:
|
||||
armcp15->ITCMRegion = val;
|
||||
/* ITCM base is not writeable! */
|
||||
//ITCM base is not writeable!
|
||||
MMU.ITCMRegion = 0;
|
||||
return TRUE;
|
||||
default:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -3,21 +3,18 @@
|
|||
Copyright (C) 2007 Pascal Giard
|
||||
Copyright (C) 2008-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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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 }
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="false"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="0"
|
||||
EnableFiberSafeOptimizations="false"
|
||||
WholeProgramOptimization="false"
|
||||
|
|
|
@ -2,21 +2,18 @@
|
|||
Copyright 2006 Theo Berkau
|
||||
Copyright (C) 2006-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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
along with the this software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// 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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue