- I think other ports will be broken. Please change NDS_exec() to NDS_exec<FALSE>()
- Repair some things which had recently degraded win32 performance - Render 3d on scanline 213 instead of at vblank, since that is when rendering begins on the device; this eliminates transient texture corruption when dynamic textures are uploaded after vblank - myriad tiny performance boosts to emu and cpu core - fix other tool dialog boxes which were malfunctioning - add layer visibility flag to mapview tool
This commit is contained in:
parent
a47098cf71
commit
7cb8b54dc3
|
@ -1,4 +1,5 @@
|
||||||
0.8 -> ?
|
0.8 -> 0.9
|
||||||
|
There have been so many changes that this list can hardly be considered complete.
|
||||||
General/Core:
|
General/Core:
|
||||||
- Added "high-level" check for DMAs and Timer for minor (really minor) speed up [shash]
|
- Added "high-level" check for DMAs and Timer for minor (really minor) speed up [shash]
|
||||||
- Changed instruction execution to 16 at a time blocks (tested and stable) [shash]
|
- Changed instruction execution to 16 at a time blocks (tested and stable) [shash]
|
||||||
|
@ -9,18 +10,21 @@
|
||||||
- Some fixes in core (New SMB don't freeze now) [CrazyMax]
|
- Some fixes in core (New SMB don't freeze now) [CrazyMax]
|
||||||
- Some optimizations in code [CrazyMax]
|
- Some optimizations in code [CrazyMax]
|
||||||
- Make matrix 4x4 multiply routines use W-coordinate. [zeromus]
|
- Make matrix 4x4 multiply routines use W-coordinate. [zeromus]
|
||||||
- Add many matrix and vector functions to matrix.c [zeromus]
|
- Add many matrix and vector functions to matrix.cpp [zeromus]
|
||||||
- Convert to c++!
|
- Convert to c++!
|
||||||
- Added gfx3d module which emulates the whole GE as part of the core emu. Moved the windows/cocoa OGLRender to the
|
- Added gfx3d module which emulates the whole GE as part of the core emu. Moved the windows/cocoa OGLRender to the
|
||||||
emu core and replace ogl_collector. Now every platform shares the same 3d code. [zeromus]
|
emu core and replace ogl_collector. Now every platform shares the same 3d code. [zeromus]
|
||||||
- Add in some crude interpolation in the SPU (conditionally compiled) so that I can bear to listen to it. [zeromus]
|
- Add in some crude interpolation in the SPU (conditionally compiled) so that I can bear to listen to it. [zeromus]
|
||||||
|
- Experiment: always one silent SPU core at 44.1khz synched with emu for more precision.
|
||||||
|
The audible core runs with the host, causing music to slow down but not tear or pitch bend. [zeromus]
|
||||||
- Change savestate code to support loosely bound chunks and more easily other parts of the emu (GE, GPU).
|
- Change savestate code to support loosely bound chunks and more easily other parts of the emu (GE, GPU).
|
||||||
The savestate format is changed, but from now on it is in principle more resilient (it will continue to break though) [zeromus]
|
The savestate format is changed, but from now on it is in principle more resilient (it will continue to break though) [zeromus]
|
||||||
- Remove 16MB of WRAM at 0x01****** from arm9. Maped to unusued instead. What was this? [zeromus]
|
- Remove 16MB of WRAM at 0x01****** from arm9. Maped to unused instead. What was this? [zeromus]
|
||||||
- Change SPU to run two spus in parallel. SPU_core is the official one. SPU_user produces output.
|
- Change SPU to run two spus in parallel. SPU_core is the official one. SPU_user produces output.
|
||||||
This lets us do inaccurate things with SPU_user which might sound better while being more accurate with SPU_core. [zeromus]
|
This lets us do inaccurate things with SPU_user which might sound better while being more accurate with SPU_core. [zeromus]
|
||||||
- Add RTC implementations (not fully) [CrazyMax]
|
- Add RTC implementations (not fully) [CrazyMax]
|
||||||
- Rewrite VRAM mapping control and render (old save states broken) [CrazyMax]
|
- Rewrite VRAM mapping control and render (old save states broken) [CrazyMax]
|
||||||
|
- Add a GUI hud system; start adding some HUD elements
|
||||||
Mac OS X port:
|
Mac OS X port:
|
||||||
- Fixed: Filenames and paths with unicode characters now work. [Jeff]
|
- Fixed: Filenames and paths with unicode characters now work. [Jeff]
|
||||||
- Fixed: Load state from file button works again. [Jeff]
|
- Fixed: Load state from file button works again. [Jeff]
|
||||||
|
@ -54,14 +58,12 @@
|
||||||
- Defer rendering until after flush. This was a necessary architectural change, as it permits savestate
|
- Defer rendering until after flush. This was a necessary architectural change, as it permits savestate
|
||||||
for the display list, and allows us eventually to separate the GE emulation from the rendering [zeromus]
|
for the display list, and allows us eventually to separate the GE emulation from the rendering [zeromus]
|
||||||
- Fix the 2d/3d compositing well enough for NSMB to fix bugs, but it is still bad [zeromus]
|
- Fix the 2d/3d compositing well enough for NSMB to fix bugs, but it is still bad [zeromus]
|
||||||
- Reorganize 3d code to defer rendering to vblank. eliminates tearing, and maybe some texturing artifacts.
|
- Reorganize 3d code to defer rendering to after vblank. eliminates tearing, and maybe some texturing artifacts. [zeromus]
|
||||||
also possibly helps performance a bit by letting the hardware pipeline work some more before blocking for
|
|
||||||
framebuffer read. [zeromus]
|
|
||||||
- Tweak optimization flags and change entire source code to use fastcall [zeromus]
|
- Tweak optimization flags and change entire source code to use fastcall [zeromus]
|
||||||
- Add opengl state caching. This is of dubious performance assistance, but it is easy to take out so I am leaving it for now. [zeromus]
|
- Add opengl state caching. This is of dubious performance assistance, but it is easy to take out so I am leaving it for now. [zeromus]
|
||||||
- Add MMU->GPU signal for when vram mappings change, which allows it to assume textures are unchanged unless vram has changed [zeromus]
|
- Add MMU->GPU signal for when vram mappings change, which allows it to assume textures are unchanged unless vram has changed [zeromus]
|
||||||
- Added a bunch of crazy templates to the cpu and mmu which speed up a the emu little by optimizing variable accesses [zeromus]
|
- Added a bunch of crazy templates to the cpu and mmu which speed up a the emu little by optimizing variable accesses [zeromus]
|
||||||
- Add an arm9 cpu load average calculator [zeromus]
|
- Add an arm9 cpu load average calculator similar to no$ [zeromus]
|
||||||
? Fix a bug in texture transformation mode 1 [zeromus]
|
? Fix a bug in texture transformation mode 1 [zeromus]
|
||||||
- Fix the buggy auto frameskip logic which made the emu slow to a crawl. Now it runs fast! [zeromus]
|
- Fix the buggy auto frameskip logic which made the emu slow to a crawl. Now it runs fast! [zeromus]
|
||||||
- Fix resizing, rotate & aspect ration of main window. Add save window position and parameters [CrazyMax]
|
- Fix resizing, rotate & aspect ration of main window. Add save window position and parameters [CrazyMax]
|
||||||
|
|
|
@ -123,111 +123,113 @@ char szRomBaseName[512];
|
||||||
|
|
||||||
MMU_struct MMU;
|
MMU_struct MMU;
|
||||||
|
|
||||||
u8 * MMU_ARM9_MEM_MAP[256]={
|
u8 * MMU_struct::MMU_MEM[2][256] = {
|
||||||
/* 0X*/ DUP16(ARM9Mem.ARM9_ITCM),
|
//arm9
|
||||||
/* 1X*/ //DUP16(ARM9Mem.ARM9_ITCM)
|
{
|
||||||
/* 1X*/ DUP16(MMU.UNUSED_RAM),
|
/* 0X*/ DUP16(ARM9Mem.ARM9_ITCM),
|
||||||
/* 2X*/ DUP16(ARM9Mem.MAIN_MEM),
|
/* 1X*/ //DUP16(ARM9Mem.ARM9_ITCM)
|
||||||
/* 3X*/ DUP16(MMU.SWIRAM),
|
/* 1X*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* 4X*/ DUP16(ARM9Mem.ARM9_REG),
|
/* 2X*/ DUP16(ARM9Mem.MAIN_MEM),
|
||||||
/* 5X*/ DUP16(ARM9Mem.ARM9_VMEM),
|
/* 3X*/ DUP16(MMU.SWIRAM),
|
||||||
/* 6X*/ DUP2(ARM9Mem.ARM9_ABG),
|
/* 4X*/ DUP16(ARM9Mem.ARM9_REG),
|
||||||
DUP2(ARM9Mem.ARM9_BBG),
|
/* 5X*/ DUP16(ARM9Mem.ARM9_VMEM),
|
||||||
DUP2(ARM9Mem.ARM9_AOBJ),
|
/* 6X*/ DUP2(ARM9Mem.ARM9_ABG),
|
||||||
DUP2(ARM9Mem.ARM9_BOBJ),
|
DUP2(ARM9Mem.ARM9_BBG),
|
||||||
DUP8(ARM9Mem.ARM9_LCD),
|
DUP2(ARM9Mem.ARM9_AOBJ),
|
||||||
/* 7X*/ DUP16(ARM9Mem.ARM9_OAM),
|
DUP2(ARM9Mem.ARM9_BOBJ),
|
||||||
/* 8X*/ DUP16(NULL),
|
DUP8(ARM9Mem.ARM9_LCD),
|
||||||
/* 9X*/ DUP16(NULL),
|
/* 7X*/ DUP16(ARM9Mem.ARM9_OAM),
|
||||||
/* AX*/ DUP16(MMU.CART_RAM),
|
/* 8X*/ DUP16(NULL),
|
||||||
/* BX*/ DUP16(MMU.UNUSED_RAM),
|
/* 9X*/ DUP16(NULL),
|
||||||
/* CX*/ DUP16(MMU.UNUSED_RAM),
|
/* AX*/ DUP16(MMU.CART_RAM),
|
||||||
/* DX*/ DUP16(MMU.UNUSED_RAM),
|
/* BX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* EX*/ DUP16(MMU.UNUSED_RAM),
|
/* CX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* FX*/ DUP16(ARM9Mem.ARM9_BIOS)
|
/* DX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
};
|
/* EX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
|
/* FX*/ DUP16(ARM9Mem.ARM9_BIOS)
|
||||||
u32 MMU_ARM9_MEM_MASK[256]={
|
},
|
||||||
/* 0X*/ DUP16(0x00007FFF),
|
//arm7
|
||||||
/* 1X*/ //DUP16(0x00007FFF)
|
{
|
||||||
/* 1X*/ DUP16(0x00000003),
|
/* 0X*/ DUP16(MMU.ARM7_BIOS),
|
||||||
/* 2X*/ DUP16(0x003FFFFF),
|
/* 1X*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* 3X*/ DUP16(0x00007FFF),
|
/* 2X*/ DUP16(ARM9Mem.MAIN_MEM),
|
||||||
/* 4X*/ DUP16(0x00FFFFFF),
|
/* 3X*/ DUP8(MMU.SWIRAM),
|
||||||
/* 5X*/ DUP16(0x000007FF),
|
DUP8(MMU.ARM7_ERAM),
|
||||||
/* 6X*/ DUP2(0x0007FFFF),
|
/* 4X*/ DUP8(MMU.ARM7_REG),
|
||||||
DUP2(0x0001FFFF),
|
DUP8(MMU.ARM7_WIRAM),
|
||||||
DUP2(0x0003FFFF),
|
/* 5X*/ DUP16(MMU.UNUSED_RAM),
|
||||||
DUP2(0x0001FFFF),
|
/* 6X*/ DUP16(ARM9Mem.ARM9_ABG),
|
||||||
DUP8(0x000FFFFF),
|
/* 7X*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* 7X*/ DUP16(0x000007FF),
|
/* 8X*/ DUP16(NULL),
|
||||||
/* 8X*/ DUP16(ROM_MASK),
|
/* 9X*/ DUP16(NULL),
|
||||||
/* 9X*/ DUP16(ROM_MASK),
|
/* AX*/ DUP16(MMU.CART_RAM),
|
||||||
/* AX*/ DUP16(0x0000FFFF),
|
/* BX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* BX*/ DUP16(0x00000003),
|
/* CX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* CX*/ DUP16(0x00000003),
|
/* DX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* DX*/ DUP16(0x00000003),
|
/* EX*/ DUP16(MMU.UNUSED_RAM),
|
||||||
/* EX*/ DUP16(0x00000003),
|
/* FX*/ DUP16(MMU.UNUSED_RAM)
|
||||||
/* FX*/ DUP16(0x00007FFF)
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 * MMU_ARM7_MEM_MAP[256]={
|
u32 MMU_struct::MMU_MASK[2][256] = {
|
||||||
/* 0X*/ DUP16(MMU.ARM7_BIOS),
|
//arm9
|
||||||
/* 1X*/ DUP16(MMU.UNUSED_RAM),
|
{
|
||||||
/* 2X*/ DUP16(ARM9Mem.MAIN_MEM),
|
/* 0X*/ DUP16(0x00007FFF),
|
||||||
/* 3X*/ DUP8(MMU.SWIRAM),
|
/* 1X*/ //DUP16(0x00007FFF)
|
||||||
DUP8(MMU.ARM7_ERAM),
|
/* 1X*/ DUP16(0x00000003),
|
||||||
/* 4X*/ DUP8(MMU.ARM7_REG),
|
/* 2X*/ DUP16(0x003FFFFF),
|
||||||
DUP8(MMU.ARM7_WIRAM),
|
/* 3X*/ DUP16(0x00007FFF),
|
||||||
/* 5X*/ DUP16(MMU.UNUSED_RAM),
|
/* 4X*/ DUP16(0x00FFFFFF),
|
||||||
/* 6X*/ DUP16(ARM9Mem.ARM9_ABG),
|
/* 5X*/ DUP16(0x000007FF),
|
||||||
/* 7X*/ DUP16(MMU.UNUSED_RAM),
|
/* 6X*/ DUP2(0x0007FFFF),
|
||||||
/* 8X*/ DUP16(NULL),
|
DUP2(0x0001FFFF),
|
||||||
/* 9X*/ DUP16(NULL),
|
DUP2(0x0003FFFF),
|
||||||
/* AX*/ DUP16(MMU.CART_RAM),
|
DUP2(0x0001FFFF),
|
||||||
/* BX*/ DUP16(MMU.UNUSED_RAM),
|
DUP8(0x000FFFFF),
|
||||||
/* CX*/ DUP16(MMU.UNUSED_RAM),
|
/* 7X*/ DUP16(0x000007FF),
|
||||||
/* DX*/ DUP16(MMU.UNUSED_RAM),
|
/* 8X*/ DUP16(ROM_MASK),
|
||||||
/* EX*/ DUP16(MMU.UNUSED_RAM),
|
/* 9X*/ DUP16(ROM_MASK),
|
||||||
/* FX*/ DUP16(MMU.UNUSED_RAM)
|
/* AX*/ DUP16(0x0000FFFF),
|
||||||
|
/* BX*/ DUP16(0x00000003),
|
||||||
|
/* CX*/ DUP16(0x00000003),
|
||||||
|
/* DX*/ DUP16(0x00000003),
|
||||||
|
/* EX*/ DUP16(0x00000003),
|
||||||
|
/* FX*/ DUP16(0x00007FFF)
|
||||||
|
},
|
||||||
|
//arm7
|
||||||
|
{
|
||||||
|
/* 0X*/ DUP16(0x00003FFF),
|
||||||
|
/* 1X*/ DUP16(0x00000003),
|
||||||
|
/* 2X*/ DUP16(0x003FFFFF),
|
||||||
|
/* 3X*/ DUP8(0x00007FFF),
|
||||||
|
DUP8(0x0000FFFF),
|
||||||
|
/* 4X*/ DUP8(0x00FFFFFF),
|
||||||
|
DUP8(0x0000FFFF),
|
||||||
|
/* 5X*/ DUP16(0x00000003),
|
||||||
|
/* 6X*/ DUP16(0x0003FFFF),
|
||||||
|
/* 7X*/ DUP16(0x00000003),
|
||||||
|
/* 8X*/ DUP16(ROM_MASK),
|
||||||
|
/* 9X*/ DUP16(ROM_MASK),
|
||||||
|
/* AX*/ DUP16(0x0000FFFF),
|
||||||
|
/* BX*/ DUP16(0x00000003),
|
||||||
|
/* CX*/ DUP16(0x00000003),
|
||||||
|
/* DX*/ DUP16(0x00000003),
|
||||||
|
/* EX*/ DUP16(0x00000003),
|
||||||
|
/* FX*/ DUP16(0x00000003)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 MMU_ARM7_MEM_MASK[256]={
|
|
||||||
/* 0X*/ DUP16(0x00003FFF),
|
TWaitState MMU_struct::MMU_WAIT16[2][16] = {
|
||||||
/* 1X*/ DUP16(0x00000003),
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1 }, //arm9
|
||||||
/* 2X*/ DUP16(0x003FFFFF),
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1 }, //arm7
|
||||||
/* 3X*/ DUP8(0x00007FFF),
|
|
||||||
DUP8(0x0000FFFF),
|
|
||||||
/* 4X*/ DUP8(0x00FFFFFF),
|
|
||||||
DUP8(0x0000FFFF),
|
|
||||||
/* 5X*/ DUP16(0x00000003),
|
|
||||||
/* 6X*/ DUP16(0x0003FFFF),
|
|
||||||
/* 7X*/ DUP16(0x00000003),
|
|
||||||
/* 8X*/ DUP16(ROM_MASK),
|
|
||||||
/* 9X*/ DUP16(ROM_MASK),
|
|
||||||
/* AX*/ DUP16(0x0000FFFF),
|
|
||||||
/* BX*/ DUP16(0x00000003),
|
|
||||||
/* CX*/ DUP16(0x00000003),
|
|
||||||
/* DX*/ DUP16(0x00000003),
|
|
||||||
/* EX*/ DUP16(0x00000003),
|
|
||||||
/* FX*/ DUP16(0x00000003)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 MMU_ARM9_WAIT16[16]={
|
TWaitState MMU_struct::MMU_WAIT32[2][16] = {
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1,
|
{ 1, 1, 1, 1, 1, 2, 2, 1, 8, 8, 5, 1, 1, 1, 1, 1 }, //arm9
|
||||||
|
{ 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 5, 1, 1, 1, 1, 1 }, //arm7
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 MMU_ARM9_WAIT32[16]={
|
|
||||||
1, 1, 1, 1, 1, 2, 2, 1, 8, 8, 5, 1, 1, 1, 1, 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
u32 MMU_ARM7_WAIT16[16]={
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
u32 MMU_ARM7_WAIT32[16]={
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 5, 1, 1, 1, 1, 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
u32 gxIRQ = 0;
|
u32 gxIRQ = 0;
|
||||||
|
|
||||||
|
@ -256,23 +258,14 @@ void MMU_Init(void) {
|
||||||
|
|
||||||
for(i = 0x80; i<0xA0; ++i)
|
for(i = 0x80; i<0xA0; ++i)
|
||||||
{
|
{
|
||||||
MMU_ARM9_MEM_MAP[i] = MMU.CART_ROM;
|
MMU_struct::MMU_MEM[0][i] = MMU.CART_ROM;
|
||||||
MMU_ARM7_MEM_MAP[i] = MMU.CART_ROM;
|
MMU_struct::MMU_MEM[1][i] = MMU.CART_ROM;
|
||||||
}
|
}
|
||||||
|
|
||||||
MMU.MMU_MEM[0] = MMU_ARM9_MEM_MAP;
|
|
||||||
MMU.MMU_MEM[1] = MMU_ARM7_MEM_MAP;
|
|
||||||
MMU.MMU_MASK[0]= MMU_ARM9_MEM_MASK;
|
|
||||||
MMU.MMU_MASK[1] = MMU_ARM7_MEM_MASK;
|
|
||||||
|
|
||||||
MMU.DTCMRegion = 0x027C0000;
|
MMU.DTCMRegion = 0x027C0000;
|
||||||
MMU.ITCMRegion = 0x00000000;
|
MMU.ITCMRegion = 0x00000000;
|
||||||
|
|
||||||
MMU.MMU_WAIT16[0] = MMU_ARM9_WAIT16;
|
|
||||||
MMU.MMU_WAIT16[1] = MMU_ARM7_WAIT16;
|
|
||||||
MMU.MMU_WAIT32[0] = MMU_ARM9_WAIT32;
|
|
||||||
MMU.MMU_WAIT32[1] = MMU_ARM7_WAIT32;
|
|
||||||
|
|
||||||
FIFOclear(&MMU.fifos[0]);
|
FIFOclear(&MMU.fifos[0]);
|
||||||
FIFOclear(&MMU.fifos[1]);
|
FIFOclear(&MMU.fifos[1]);
|
||||||
|
|
||||||
|
@ -422,10 +415,9 @@ u8 *MMU_RenderMapToLCD(u32 vram_addr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE BOOL MMU_LCDmap(u32 *addr)
|
static FORCEINLINE bool MMU_LCDmap(u32 &addr)
|
||||||
{
|
{
|
||||||
u32 vram_addr = (u32)*addr;
|
u32 vram_addr = addr;
|
||||||
|
|
||||||
if ((vram_addr >= 0x6000000) && (vram_addr <= 0x67FFFFF))
|
if ((vram_addr >= 0x6000000) && (vram_addr <= 0x67FFFFF))
|
||||||
{
|
{
|
||||||
vram_addr &= 0x0FFFFFF;
|
vram_addr &= 0x0FFFFFF;
|
||||||
|
@ -433,16 +425,16 @@ static INLINE BOOL MMU_LCDmap(u32 *addr)
|
||||||
vram_addr &= 0x01FFFFF;
|
vram_addr &= 0x01FFFFF;
|
||||||
u8 engine_offset = (vram_addr >> 14);
|
u8 engine_offset = (vram_addr >> 14);
|
||||||
u8 block = MMU.VRAM_MAP[engine][engine_offset];
|
u8 block = MMU.VRAM_MAP[engine][engine_offset];
|
||||||
if (block == 7) return TRUE;
|
if (block == 7) return true;
|
||||||
//INFO("VRAM %i: engine=%i (offset=%i), map address = 0x%X, MMU address = 0x%X\n", block, engine, engine_offset, vram_addr, *addr);
|
//INFO("VRAM %i: engine=%i (offset=%i), map address = 0x%X, MMU address = 0x%X\n", block, engine, engine_offset, vram_addr, *addr);
|
||||||
vram_addr -= MMU.LCD_VRAM_ADDR[block];
|
vram_addr -= MMU.LCD_VRAM_ADDR[block];
|
||||||
vram_addr += LCDdata[block][0];
|
vram_addr += LCDdata[block][0];
|
||||||
*addr = vram_addr;
|
addr = vram_addr;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt)
|
static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt)
|
||||||
{
|
{
|
||||||
if (!(VRAMBankCnt & 0x80)) return;
|
if (!(VRAMBankCnt & 0x80)) return;
|
||||||
if (!(VRAMBankCnt & 0x07)) return;
|
if (!(VRAMBankCnt & 0x07)) return;
|
||||||
|
@ -602,10 +594,10 @@ void MMU_setRom(u8 * rom, u32 mask)
|
||||||
|
|
||||||
for(i = 0x80; i<0xA0; ++i)
|
for(i = 0x80; i<0xA0; ++i)
|
||||||
{
|
{
|
||||||
MMU_ARM9_MEM_MAP[i] = rom;
|
MMU_struct::MMU_MEM[0][i] = rom;
|
||||||
MMU_ARM7_MEM_MAP[i] = rom;
|
MMU_struct::MMU_MEM[1][i] = rom;
|
||||||
MMU_ARM9_MEM_MASK[i] = mask;
|
MMU_struct::MMU_MASK[0][i] = mask;
|
||||||
MMU_ARM7_MEM_MASK[i] = mask;
|
MMU_struct::MMU_MASK[1][i] = mask;
|
||||||
}
|
}
|
||||||
rom_mask = mask;
|
rom_mask = mask;
|
||||||
}
|
}
|
||||||
|
@ -617,10 +609,10 @@ void MMU_unsetRom()
|
||||||
|
|
||||||
for(i = 0x80; i<0xA0; ++i)
|
for(i = 0x80; i<0xA0; ++i)
|
||||||
{
|
{
|
||||||
MMU_ARM9_MEM_MAP[i] = MMU.UNUSED_RAM;
|
MMU_struct::MMU_MEM[0][i] = MMU.UNUSED_RAM;
|
||||||
MMU_ARM7_MEM_MAP[i] = MMU.UNUSED_RAM;
|
MMU_struct::MMU_MEM[1][i] = MMU.UNUSED_RAM;
|
||||||
MMU_ARM9_MEM_MASK[i] = ROM_MASK;
|
MMU_struct::MMU_MASK[0][i] = ROM_MASK;
|
||||||
MMU_ARM7_MEM_MASK[i] = ROM_MASK;
|
MMU_struct::MMU_MASK[1][i] = ROM_MASK;
|
||||||
}
|
}
|
||||||
rom_mask = ROM_MASK;
|
rom_mask = ROM_MASK;
|
||||||
}
|
}
|
||||||
|
@ -659,7 +651,7 @@ u8 FASTCALL _MMU_read8(u32 adr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (MMU_LCDmap(&adr)) return (0);
|
if (MMU_LCDmap(adr)) return (0);
|
||||||
|
|
||||||
mmu_log_debug(adr, proc, "read08");
|
mmu_log_debug(adr, proc, "read08");
|
||||||
|
|
||||||
|
@ -693,7 +685,7 @@ u16 FASTCALL _MMU_read16(u32 adr)
|
||||||
|
|
||||||
adr &= 0x0FFFFFFF;
|
adr &= 0x0FFFFFFF;
|
||||||
|
|
||||||
if (MMU_LCDmap(&adr)) return (0);
|
if (MMU_LCDmap(adr)) return (0);
|
||||||
|
|
||||||
if(adr&0x04000000)
|
if(adr&0x04000000)
|
||||||
{
|
{
|
||||||
|
@ -766,7 +758,7 @@ u32 FASTCALL _MMU_read32(u32 adr)
|
||||||
return (unsigned long)cflash_read(adr);
|
return (unsigned long)cflash_read(adr);
|
||||||
adr &= 0x0FFFFFFF;
|
adr &= 0x0FFFFFFF;
|
||||||
|
|
||||||
if (MMU_LCDmap(&adr)) return (0);
|
if (MMU_LCDmap(adr)) return (0);
|
||||||
|
|
||||||
if((adr >> 24) == 4)
|
if((adr >> 24) == 4)
|
||||||
{
|
{
|
||||||
|
@ -950,7 +942,7 @@ void FASTCALL _MMU_write8(u32 adr, u8 val)
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MMU_LCDmap(&adr)) return;
|
if (MMU_LCDmap(adr)) return;
|
||||||
|
|
||||||
switch(adr)
|
switch(adr)
|
||||||
{
|
{
|
||||||
|
@ -1171,7 +1163,7 @@ void FASTCALL _MMU_write16(u32 adr, u16 val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MMU_LCDmap(&adr)) return;
|
if (MMU_LCDmap(adr)) return;
|
||||||
|
|
||||||
if((adr >> 24) == 4)
|
if((adr >> 24) == 4)
|
||||||
{
|
{
|
||||||
|
@ -1842,7 +1834,7 @@ void FASTCALL _MMU_write32(u32 adr, u32 val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MMU_LCDmap(&adr)) return;
|
if (MMU_LCDmap(adr)) return;
|
||||||
|
|
||||||
if ((adr & 0xFF800000) == 0x04800000) {
|
if ((adr & 0xFF800000) == 0x04800000) {
|
||||||
/* access to non regular hw registers */
|
/* access to non regular hw registers */
|
||||||
|
|
|
@ -42,7 +42,9 @@ extern char szRomBaseName[512];
|
||||||
//#define IPCFIFO 0
|
//#define IPCFIFO 0
|
||||||
//#define MAIN_MEMORY_DISP_FIFO 2
|
//#define MAIN_MEMORY_DISP_FIFO 2
|
||||||
|
|
||||||
typedef struct {
|
typedef const u32 TWaitState;
|
||||||
|
|
||||||
|
struct MMU_struct {
|
||||||
//ARM7 mem
|
//ARM7 mem
|
||||||
u8 ARM7_BIOS[0x4000];
|
u8 ARM7_BIOS[0x4000];
|
||||||
u8 ARM7_ERAM[0x10000];
|
u8 ARM7_ERAM[0x10000];
|
||||||
|
@ -69,16 +71,16 @@ typedef struct {
|
||||||
//(also since the emulator doesn't prevent unaligned accesses)
|
//(also since the emulator doesn't prevent unaligned accesses)
|
||||||
u8 MORE_UNUSED_RAM[4];
|
u8 MORE_UNUSED_RAM[4];
|
||||||
|
|
||||||
u8 * * MMU_MEM[2];
|
static u8 * MMU_MEM[2][256];
|
||||||
u32 * MMU_MASK[2];
|
static u32 MMU_MASK[2][256];
|
||||||
|
|
||||||
u8 ARM9_RW_MODE;
|
u8 ARM9_RW_MODE;
|
||||||
|
|
||||||
FIFO fifos[2]; // 0 - ARM9 FIFO
|
FIFO fifos[2]; // 0 - ARM9 FIFO
|
||||||
// 1 - ARM7 FIFO
|
// 1 - ARM7 FIFO
|
||||||
|
|
||||||
u32 * MMU_WAIT16[2];
|
static TWaitState MMU_WAIT16[2][16];
|
||||||
u32 * MMU_WAIT32[2];
|
static TWaitState MMU_WAIT32[2][16];
|
||||||
|
|
||||||
u32 DTCMRegion;
|
u32 DTCMRegion;
|
||||||
u32 ITCMRegion;
|
u32 ITCMRegion;
|
||||||
|
@ -105,7 +107,7 @@ typedef struct {
|
||||||
u32 CheckTimers;
|
u32 CheckTimers;
|
||||||
u32 CheckDMAs;
|
u32 CheckDMAs;
|
||||||
|
|
||||||
} MMU_struct;
|
};
|
||||||
|
|
||||||
extern MMU_struct MMU;
|
extern MMU_struct MMU;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "NDSSystem.h"
|
#include "NDSSystem.h"
|
||||||
#include "render3D.h"
|
#include "render3D.h"
|
||||||
|
@ -869,16 +870,26 @@ int NDS_LoadFirmware(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
|
#define INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
|
||||||
u32
|
|
||||||
NDS_exec(s32 nb, BOOL force)
|
|
||||||
|
template<bool FORCE>
|
||||||
|
u32 NDS_exec(s32 nb)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
nb += nds.cycles;//(nds.cycles>>26)<<26;
|
nb += nds.cycles;//(nds.cycles>>26)<<26;
|
||||||
|
|
||||||
|
//increase this to execute more instructions in each batch (reducing overhead)
|
||||||
|
//the value of 4 seems to optimize speed.. do lower values increase precision?
|
||||||
|
const int INSTRUCTIONS_PER_BATCH = 4;
|
||||||
|
|
||||||
|
//decreasing this should increase precision at the cost of speed
|
||||||
|
//the traditional value was somewhere between 100 and 400 depending on circumstances
|
||||||
|
const int CYCLES_TO_WAIT_FOR_IRQ = 400;
|
||||||
|
|
||||||
for(; (nb >= nds.cycles) && ((force)||(execute)); )
|
for(; (nb >= nds.cycles) && ((FORCE)||(execute)); )
|
||||||
{
|
{
|
||||||
for (j = 0; j < 4 && (!force) && (execute); j++)
|
for (j = 0; j < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); j++)
|
||||||
{
|
{
|
||||||
if(nds.ARM9Cycle<=nds.cycles)
|
if(nds.ARM9Cycle<=nds.cycles)
|
||||||
{
|
{
|
||||||
|
@ -895,18 +906,17 @@ NDS_exec(s32 nb, BOOL force)
|
||||||
LOG(logbuf);
|
LOG(logbuf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < 4 && (!force) && (execute); i++)
|
for (i = 0; i < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); i++)
|
||||||
{
|
{
|
||||||
if(NDS_ARM9.waitIRQ) {
|
if(NDS_ARM9.waitIRQ) {
|
||||||
nds.ARM9Cycle += 100;
|
nds.ARM9Cycle += CYCLES_TO_WAIT_FOR_IRQ;
|
||||||
nds.idleCycles += 100;
|
nds.idleCycles += CYCLES_TO_WAIT_FOR_IRQ;
|
||||||
|
break; //it is rather pointless to do this more than once
|
||||||
} else
|
} else
|
||||||
//nds.ARM9Cycle += NDS_ARM9.exec();
|
nds.ARM9Cycle += armcpu_exec<ARMCPU_ARM9>();
|
||||||
//nds.ARM9Cycle += armcpu_exec(&NDS_ARM9);
|
|
||||||
nds.ARM9Cycle += armcpu_exec<0>();
|
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DisassemblerTools_Refresh(0);
|
DisassemblerTools_Refresh(ARMCPU_ARM9);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,26 +943,27 @@ NDS_exec(s32 nb, BOOL force)
|
||||||
LOG(logbuf);
|
LOG(logbuf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (i = 0; i < 4 && (!force) && (execute); i++)
|
for (i = 0; i < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); i++)
|
||||||
{
|
{
|
||||||
if(NDS_ARM7.waitIRQ)
|
if(NDS_ARM7.waitIRQ)
|
||||||
nds.ARM7Cycle += 100;
|
{
|
||||||
|
nds.ARM7Cycle += CYCLES_TO_WAIT_FOR_IRQ;
|
||||||
|
break; //it is rather pointless to do this more than once
|
||||||
|
}
|
||||||
else
|
else
|
||||||
//nds.ARM7Cycle += (NDS_ARM7.exec()<<1);
|
nds.ARM7Cycle += (armcpu_exec<ARMCPU_ARM7>()<<1);
|
||||||
//nds.ARM7Cycle += (armcpu_exec(&NDS_ARM7)<<1);
|
|
||||||
nds.ARM7Cycle += (armcpu_exec<1>()<<1);
|
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DisassemblerTools_Refresh(1);
|
DisassemblerTools_Refresh(ARMCPU_ARM7);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nds.cycles = (nds.ARM9Cycle<nds.ARM7Cycle)?nds.ARM9Cycle : nds.ARM7Cycle;
|
nds.cycles = std::min(nds.ARM9Cycle,nds.ARM7Cycle);
|
||||||
|
|
||||||
//debug();
|
//debug();
|
||||||
|
|
||||||
if(nds.cycles>=nds.nextHBlank)
|
if(nds.cycles>=nds.nextHBlank)
|
||||||
{
|
{
|
||||||
if(!nds.lignerendu)
|
if(!nds.lignerendu)
|
||||||
{
|
{
|
||||||
|
@ -1041,8 +1052,8 @@ NDS_exec(s32 nb, BOOL force)
|
||||||
nds.lignerendu = FALSE;
|
nds.lignerendu = FALSE;
|
||||||
if(nds.VCount==192)
|
if(nds.VCount==192)
|
||||||
{
|
{
|
||||||
gfx3d_VBlankSignal();
|
|
||||||
//osdA->update(); //================================= this is don't correct, need swap engine
|
//osdA->update(); //================================= this is don't correct, need swap engine
|
||||||
|
gfx3d_VBlankSignal();
|
||||||
|
|
||||||
T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 1);
|
T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 1);
|
||||||
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1);
|
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1);
|
||||||
|
@ -1072,8 +1083,10 @@ NDS_exec(s32 nb, BOOL force)
|
||||||
if(MMU.DMAStartTime[1][3] == 1)
|
if(MMU.DMAStartTime[1][3] == 1)
|
||||||
MMU_doDMA(1, 3);
|
MMU_doDMA(1, 3);
|
||||||
}
|
}
|
||||||
else
|
else if(nds.VCount==214) {
|
||||||
if(nds.VCount==263)
|
gfx3d_VBlankEndSignal();
|
||||||
|
}
|
||||||
|
else if(nds.VCount==263)
|
||||||
{
|
{
|
||||||
//osd->update();
|
//osd->update();
|
||||||
//osdB->update(); //================================= this is don't correct, need swap engine
|
//osdB->update(); //================================= this is don't correct, need swap engine
|
||||||
|
@ -1086,7 +1099,7 @@ NDS_exec(s32 nb, BOOL force)
|
||||||
nds.cycles -= (560190<<1);
|
nds.cycles -= (560190<<1);
|
||||||
nds.ARM9Cycle -= (560190<<1);
|
nds.ARM9Cycle -= (560190<<1);
|
||||||
nds.ARM7Cycle -= (560190<<1);
|
nds.ARM7Cycle -= (560190<<1);
|
||||||
nb -= (560190<<1);
|
nb -= (560190<<1);
|
||||||
|
|
||||||
if (MMU.CheckTimers)
|
if (MMU.CheckTimers)
|
||||||
{
|
{
|
||||||
|
@ -1581,6 +1594,9 @@ NDS_exec(s32 nb, BOOL force)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nds.cycles;
|
return nds.cycles;
|
||||||
|
@ -1688,3 +1704,7 @@ void NDS_setPad(bool R,bool L,bool D,bool U,bool T,bool S,bool B,bool A,bool Y,b
|
||||||
|
|
||||||
// TODO: low power IRQ
|
// TODO: low power IRQ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//these templates needed to be instantiated manually
|
||||||
|
template u32 NDS_exec<FALSE>(s32 nb);
|
||||||
|
template u32 NDS_exec<TRUE>(s32 nb);
|
||||||
|
|
|
@ -201,8 +201,11 @@ int NDS_ImportSave(const char *filename);
|
||||||
int NDS_WriteBMP(const char *filename);
|
int NDS_WriteBMP(const char *filename);
|
||||||
int NDS_LoadFirmware(const char *filename);
|
int NDS_LoadFirmware(const char *filename);
|
||||||
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
|
int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings);
|
||||||
u32
|
|
||||||
NDS_exec(s32 nb, BOOL force);
|
template<bool FORCE>
|
||||||
|
u32 NDS_exec(s32 nb);
|
||||||
|
|
||||||
|
inline u32 NDS_exec(s32 nb) { return NDS_exec<false>(nb); }
|
||||||
|
|
||||||
static INLINE void NDS_ARM9HBlankInt(void)
|
static INLINE void NDS_ARM9HBlankInt(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -677,6 +677,7 @@ static void setTexture(unsigned int format, unsigned int texpal)
|
||||||
glLoadIdentity ();
|
glLoadIdentity ();
|
||||||
glScaled (texcache[i].invSizeX, texcache[i].invSizeY, 1.0f);
|
glScaled (texcache[i].invSizeX, texcache[i].invSizeY, 1.0f);
|
||||||
|
|
||||||
|
|
||||||
//INFO("Texture %03i - format=%08X; pal=%04X (mode %X, width %04i, height %04i)\n",i, texcache[i].frm, texcache[i].pal, texcache[i].mode, sizeX, sizeY);
|
//INFO("Texture %03i - format=%08X; pal=%04X (mode %X, width %04i, height %04i)\n",i, texcache[i].frm, texcache[i].pal, texcache[i].mode, sizeX, sizeY);
|
||||||
|
|
||||||
//============================================================================ Texture render
|
//============================================================================ Texture render
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,25 +30,29 @@
|
||||||
#define ARMCPU_ARM9 0
|
#define ARMCPU_ARM9 0
|
||||||
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
|
#define ARMPROC (PROCNUM?NDS_ARM7:NDS_ARM9)
|
||||||
|
|
||||||
#define CODE(i) (((i)>>25)&0X7)
|
#define CODE(i) (((i)>>25)&0x7)
|
||||||
#define OPCODE(i) (((i)>>21)&0xF)
|
#define OPCODE(i) (((i)>>21)&0xF)
|
||||||
#define SIGNEBIT(i) BIT_N(i,20)
|
#define SIGNEBIT(i) BIT_N(i,20)
|
||||||
|
|
||||||
#define INSTRUCTION_INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
|
#define INSTRUCTION_INDEX(i) ((((i)>>16)&0xFF0)|(((i)>>4)&0xF))
|
||||||
|
|
||||||
#define ROR(i, j) ((((u32)(i))>>(j)) | (((u32)(i))<<(32-(j))))
|
inline u32 ROR(u32 i, u32 j) { return ((((u32)(i))>>(j)) | (((u32)(i))<<(32-(j)))); }
|
||||||
|
|
||||||
#define UNSIGNED_OVERFLOW(a,b,c) ((BIT31(a)&BIT31(b)) | \
|
template<typename T>
|
||||||
((BIT31(a)|BIT31(b))&BIT31(~c)))
|
inline T UNSIGNED_OVERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(b)) |
|
||||||
|
((BIT31(a)|BIT31(b))&BIT31(~c))); }
|
||||||
|
|
||||||
#define UNSIGNED_UNDERFLOW(a,b,c) ((BIT31(~a)&BIT31(b)) | \
|
template<typename T>
|
||||||
((BIT31(~a)|BIT31(b))&BIT31(c)))
|
inline T UNSIGNED_UNDERFLOW(T a,T b,T c) { return ((BIT31(~a)&BIT31(b)) |
|
||||||
|
((BIT31(~a)|BIT31(b))&BIT31(c))); }
|
||||||
|
|
||||||
#define SIGNED_OVERFLOW(a,b,c) ((BIT31(a)&BIT31(b)&BIT31(~c))|\
|
template<typename T>
|
||||||
(BIT31(~a)&BIT31(~(b))&BIT31(c)))
|
inline T SIGNED_OVERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(b)&BIT31(~c))|
|
||||||
|
(BIT31(~a)&BIT31(~(b))&BIT31(c))); }
|
||||||
|
|
||||||
#define SIGNED_UNDERFLOW(a,b,c) ((BIT31(a)&BIT31(~(b))&BIT31(~c))|\
|
template<typename T>
|
||||||
(BIT31(~a)&BIT31(b)&BIT31(c)))
|
inline T SIGNED_UNDERFLOW(T a,T b,T c) { return ((BIT31(a)&BIT31(~(b))&BIT31(~c))|
|
||||||
|
(BIT31(~a)&BIT31(b)&BIT31(c))); }
|
||||||
|
|
||||||
#define EQ 0x0
|
#define EQ 0x0
|
||||||
#define NE 0x1
|
#define NE 0x1
|
||||||
|
@ -259,8 +263,4 @@ static INLINE void NDS_makeInt(u8 proc_ID,u32 num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//stores the currently executing arm cpu.
|
|
||||||
//we poke values in here instead of passing them around constantly.
|
|
||||||
extern armcpu_t *armcpu_curr;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,7 @@ void GetINIPath()
|
||||||
{
|
{
|
||||||
sprintf(IniName, "%s\\desmume.ini",szPath);
|
sprintf(IniName, "%s\\desmume.ini",szPath);
|
||||||
} else if (MAX_PATH> strlen(".\\desmume.ini")) {
|
} else if (MAX_PATH> strlen(".\\desmume.ini")) {
|
||||||
sprintf(IniName, ".\\desmume.ini",szPath);
|
sprintf(IniName, ".\\desmume.ini");
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
memset(IniName,0,MAX_PATH) ;
|
memset(IniName,0,MAX_PATH) ;
|
||||||
|
|
|
@ -37,10 +37,10 @@
|
||||||
GFX3D gfx3d;
|
GFX3D gfx3d;
|
||||||
|
|
||||||
//tables that are provided to anyone
|
//tables that are provided to anyone
|
||||||
u32 color_15bit_to_24bit[32768];
|
CACHE_ALIGN u32 color_15bit_to_24bit[32768];
|
||||||
|
|
||||||
//is this a crazy idea? this table spreads 5 bits evenly over 31 from exactly 0 to INT_MAX
|
//is this a crazy idea? this table spreads 5 bits evenly over 31 from exactly 0 to INT_MAX
|
||||||
const int material_5bit_to_31bit[] = {
|
CACHE_ALIGN const int material_5bit_to_31bit[] = {
|
||||||
0x00000000, 0x04210842, 0x08421084, 0x0C6318C6,
|
0x00000000, 0x04210842, 0x08421084, 0x0C6318C6,
|
||||||
0x10842108, 0x14A5294A, 0x18C6318C, 0x1CE739CE,
|
0x10842108, 0x14A5294A, 0x18C6318C, 0x1CE739CE,
|
||||||
0x21084210, 0x25294A52, 0x294A5294, 0x2D6B5AD6,
|
0x21084210, 0x25294A52, 0x294A5294, 0x2D6B5AD6,
|
||||||
|
@ -51,15 +51,14 @@ const int material_5bit_to_31bit[] = {
|
||||||
0x739CE739, 0x77BDEF7B, 0x7BDEF7BD, 0x7FFFFFFF
|
0x739CE739, 0x77BDEF7B, 0x7BDEF7BD, 0x7FFFFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 material_5bit_to_8bit[] = {
|
CACHE_ALIGN const u8 material_5bit_to_8bit[] = {
|
||||||
0x00, 0x08, 0x10, 0x18, 0x21, 0x29, 0x31, 0x39,
|
0x00, 0x08, 0x10, 0x18, 0x21, 0x29, 0x31, 0x39,
|
||||||
0x42, 0x4A, 0x52, 0x5A, 0x63, 0x6B, 0x73, 0x7B,
|
0x42, 0x4A, 0x52, 0x5A, 0x63, 0x6B, 0x73, 0x7B,
|
||||||
0x84, 0x8C, 0x94, 0x9C, 0xA5, 0xAD, 0xB5, 0xBD,
|
0x84, 0x8C, 0x94, 0x9C, 0xA5, 0xAD, 0xB5, 0xBD,
|
||||||
0xC6, 0xCE, 0xD6, 0xDE, 0xE7, 0xEF, 0xF7, 0xFF
|
0xC6, 0xCE, 0xD6, 0xDE, 0xE7, 0xEF, 0xF7, 0xFF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CACHE_ALIGN const u8 material_3bit_to_8bit[] = {
|
||||||
const u8 material_3bit_to_8bit[] = {
|
|
||||||
0x00, 0x24, 0x49, 0x6D, 0x92, 0xB6, 0xDB, 0xFF
|
0x00, 0x24, 0x49, 0x6D, 0x92, 0xB6, 0xDB, 0xFF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,28 +72,28 @@ static float normalTable[1024];
|
||||||
#define fix10_2float(v) (((float)((s32)(v))) / (float)(1<<9))
|
#define fix10_2float(v) (((float)((s32)(v))) / (float)(1<<9))
|
||||||
|
|
||||||
// Matrix stack handling
|
// Matrix stack handling
|
||||||
static ALIGN(16) MatrixStack mtxStack[4];
|
static CACHE_ALIGN MatrixStack mtxStack[4];
|
||||||
static ALIGN(16) float mtxCurrent [4][16];
|
static CACHE_ALIGN float mtxCurrent [4][16];
|
||||||
static ALIGN(16) float mtxTemporal[16];
|
static CACHE_ALIGN float mtxTemporal[16];
|
||||||
static u32 mode = 0;
|
static u32 mode = 0;
|
||||||
|
|
||||||
// Indexes for matrix loading/multiplication
|
// Indexes for matrix loading/multiplication
|
||||||
static u8 ML4x4ind = 0;
|
static int ML4x4ind = 0;
|
||||||
static u8 ML4x3_c = 0, ML4x3_l = 0;
|
static int ML4x3_c = 0, ML4x3_l = 0;
|
||||||
static u8 MM4x4ind = 0;
|
static int MM4x4ind = 0;
|
||||||
static u8 MM4x3_c = 0, MM4x3_l = 0;
|
static int MM4x3_c = 0, MM4x3_l = 0;
|
||||||
static u8 MM3x3_c = 0, MM3x3_l = 0;
|
static int MM3x3_c = 0, MM3x3_l = 0;
|
||||||
|
|
||||||
// Data for vertex submission
|
// Data for vertex submission
|
||||||
static ALIGN(16) float coord[4] = {0.0, 0.0, 0.0, 0.0};
|
static CACHE_ALIGN float coord[4] = {0.0, 0.0, 0.0, 0.0};
|
||||||
static char coordind = 0;
|
static char coordind = 0;
|
||||||
static u32 vtxFormat;
|
static u32 vtxFormat;
|
||||||
|
|
||||||
// Data for basic transforms
|
// Data for basic transforms
|
||||||
static ALIGN(16) float trans[4] = {0.0, 0.0, 0.0, 0.0};
|
static CACHE_ALIGN float trans[4] = {0.0, 0.0, 0.0, 0.0};
|
||||||
static u8 transind = 0;
|
static int transind = 0;
|
||||||
static ALIGN(16) float scale[4] = {0.0, 0.0, 0.0, 0.0};
|
static CACHE_ALIGN float scale[4] = {0.0, 0.0, 0.0, 0.0};
|
||||||
static u8 scaleind = 0;
|
static int scaleind = 0;
|
||||||
|
|
||||||
//various other registers
|
//various other registers
|
||||||
static int _t=0, _s=0;
|
static int _t=0, _s=0;
|
||||||
|
@ -107,7 +106,7 @@ static u32 clInd2 = 0;
|
||||||
static u32 polyAttr=0,textureFormat=0, texturePalette=0;
|
static u32 polyAttr=0,textureFormat=0, texturePalette=0;
|
||||||
|
|
||||||
//the current vertex color, 5bit values
|
//the current vertex color, 5bit values
|
||||||
static u8 colorRGB[4] = { 31,31,31,31 };
|
static int colorRGB[4] = { 31,31,31,31 };
|
||||||
|
|
||||||
u32 control = 0;
|
u32 control = 0;
|
||||||
|
|
||||||
|
@ -130,8 +129,8 @@ static u32 envMode=0;
|
||||||
static u32 lightMask=0;
|
static u32 lightMask=0;
|
||||||
//other things:
|
//other things:
|
||||||
static int texCoordinateTransform = 0;
|
static int texCoordinateTransform = 0;
|
||||||
static ALIGN(16) float cacheLightDirection[4][4];
|
static CACHE_ALIGN float cacheLightDirection[4][4];
|
||||||
static ALIGN(16) float cacheHalfVector[4][4];
|
static CACHE_ALIGN float cacheHalfVector[4][4];
|
||||||
//------------------
|
//------------------
|
||||||
|
|
||||||
#define RENDER_FRONT_SURFACE 0x80
|
#define RENDER_FRONT_SURFACE 0x80
|
||||||
|
@ -160,6 +159,7 @@ static void twiddleLists() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL flushPending = FALSE;
|
static BOOL flushPending = FALSE;
|
||||||
|
static BOOL drawPending = FALSE;
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
static void makeTables() {
|
static void makeTables() {
|
||||||
|
@ -1389,7 +1389,13 @@ void gfx3d_VBlankSignal()
|
||||||
//so, if we have a redraw pending, now is a safe time to do it
|
//so, if we have a redraw pending, now is a safe time to do it
|
||||||
if(!flushPending) return;
|
if(!flushPending) return;
|
||||||
flushPending = FALSE;
|
flushPending = FALSE;
|
||||||
|
drawPending = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gfx3d_VBlankEndSignal()
|
||||||
|
{
|
||||||
|
if(!drawPending) return;
|
||||||
|
drawPending = FALSE;
|
||||||
gpu3D->NDS_3D_Render();
|
gpu3D->NDS_3D_Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1507,6 +1513,7 @@ SFORMAT SF_GFX3D[]={
|
||||||
{ "GTST", 4, 1, &triStripToggle},
|
{ "GTST", 4, 1, &triStripToggle},
|
||||||
{ "GLTW", 4, 1, &listTwiddle},
|
{ "GLTW", 4, 1, &listTwiddle},
|
||||||
{ "GFLP", 4, 1, &flushPending},
|
{ "GFLP", 4, 1, &flushPending},
|
||||||
|
{ "GDRP", 4, 1, &drawPending},
|
||||||
{ "GSET", 4, 1, &gfx3d.enableTexturing},
|
{ "GSET", 4, 1, &gfx3d.enableTexturing},
|
||||||
{ "GSEA", 4, 1, &gfx3d.enableAlphaTest},
|
{ "GSEA", 4, 1, &gfx3d.enableAlphaTest},
|
||||||
{ "GSEB", 4, 1, &gfx3d.enableAlphaBlending},
|
{ "GSEB", 4, 1, &gfx3d.enableAlphaBlending},
|
||||||
|
|
|
@ -130,10 +130,10 @@ extern GFX3D gfx3d;
|
||||||
//produce a 32bpp color from a ds RGB15 plus an 8bit alpha, not using a table (but using other tables)
|
//produce a 32bpp color from a ds RGB15 plus an 8bit alpha, not using a table (but using other tables)
|
||||||
#define RGB15TO32_DIRECT(col,alpha8) ( ((alpha8)<<24) | (material_5bit_to_8bit[((col)>>10)&0x1F]<<16) | (material_5bit_to_8bit[((col)>>5)&0x1F]<<8) | material_5bit_to_8bit[(col)&0x1F] )
|
#define RGB15TO32_DIRECT(col,alpha8) ( ((alpha8)<<24) | (material_5bit_to_8bit[((col)>>10)&0x1F]<<16) | (material_5bit_to_8bit[((col)>>5)&0x1F]<<8) | material_5bit_to_8bit[(col)&0x1F] )
|
||||||
|
|
||||||
extern u32 color_15bit_to_24bit[32768];
|
extern CACHE_ALIGN u32 color_15bit_to_24bit[32768];
|
||||||
extern const int material_5bit_to_31bit[32];
|
extern CACHE_ALIGN const int material_5bit_to_31bit[32];
|
||||||
extern const u8 material_5bit_to_8bit[32];
|
extern CACHE_ALIGN const u8 material_5bit_to_8bit[32];
|
||||||
extern const u8 material_3bit_to_8bit[8];
|
extern CACHE_ALIGN const u8 material_3bit_to_8bit[8];
|
||||||
|
|
||||||
//GE commands:
|
//GE commands:
|
||||||
void gfx3d_glViewPort(unsigned long v);
|
void gfx3d_glViewPort(unsigned long v);
|
||||||
|
@ -186,6 +186,7 @@ void gfx3d_glGetVecRes(unsigned int index);
|
||||||
void gfx3d_glCallList(unsigned long v);
|
void gfx3d_glCallList(unsigned long v);
|
||||||
void gfx3d_glFlush(unsigned long v);
|
void gfx3d_glFlush(unsigned long v);
|
||||||
void gfx3d_VBlankSignal();
|
void gfx3d_VBlankSignal();
|
||||||
|
void gfx3d_VBlankEndSignal();
|
||||||
void gfx3d_Control(unsigned long v);
|
void gfx3d_Control(unsigned long v);
|
||||||
|
|
||||||
//other misc stuff
|
//other misc stuff
|
||||||
|
|
|
@ -65,7 +65,7 @@ TEMPLATE static u32 FASTCALL OP_UND_THUMB()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LSL_0()
|
TEMPLATE static u32 FASTCALL OP_LSL_0()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] = cpu->R[REG_NUM(i, 3)];
|
cpu->R[REG_NUM(i, 0)] = cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -75,7 +75,7 @@ TEMPLATE static u32 FASTCALL OP_LSL_0()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LSL()
|
TEMPLATE static u32 FASTCALL OP_LSL()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = (i>>6) & 0x1F;
|
u32 v = (i>>6) & 0x1F;
|
||||||
cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 3)], 32-v);
|
cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 3)], 32-v);
|
||||||
cpu->R[REG_NUM(i, 0)] = (cpu->R[REG_NUM(i, 3)] << v);
|
cpu->R[REG_NUM(i, 0)] = (cpu->R[REG_NUM(i, 3)] << v);
|
||||||
|
@ -87,7 +87,7 @@ TEMPLATE static u32 FASTCALL OP_LSL()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LSR_0()
|
TEMPLATE static u32 FASTCALL OP_LSR_0()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
// cpu->CPSR.bits.C = BIT31(cpu->R[REG_NUM(i, 0)]);
|
// cpu->CPSR.bits.C = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.C = BIT31(cpu->R[REG_NUM(i, 3)]);
|
cpu->CPSR.bits.C = BIT31(cpu->R[REG_NUM(i, 3)]);
|
||||||
cpu->R[REG_NUM(i, 0)] = 0;
|
cpu->R[REG_NUM(i, 0)] = 0;
|
||||||
|
@ -99,7 +99,7 @@ TEMPLATE static u32 FASTCALL OP_LSR_0()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LSR()
|
TEMPLATE static u32 FASTCALL OP_LSR()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = (i>>6) & 0x1F;
|
u32 v = (i>>6) & 0x1F;
|
||||||
cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 0)], v-1);
|
cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 0)], v-1);
|
||||||
cpu->R[REG_NUM(i, 0)] = (cpu->R[REG_NUM(i, 3)] >> v);
|
cpu->R[REG_NUM(i, 0)] = (cpu->R[REG_NUM(i, 3)] >> v);
|
||||||
|
@ -111,7 +111,7 @@ TEMPLATE static u32 FASTCALL OP_LSR()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ASR_0()
|
TEMPLATE static u32 FASTCALL OP_ASR_0()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->CPSR.bits.C = BIT31(cpu->R[REG_NUM(i, 3)]);
|
cpu->CPSR.bits.C = BIT31(cpu->R[REG_NUM(i, 3)]);
|
||||||
cpu->R[REG_NUM(i, 0)] = BIT31(cpu->R[REG_NUM(i, 3)])*0xFFFFFFFF;
|
cpu->R[REG_NUM(i, 0)] = BIT31(cpu->R[REG_NUM(i, 3)])*0xFFFFFFFF;
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
|
@ -122,7 +122,7 @@ TEMPLATE static u32 FASTCALL OP_ASR_0()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ASR()
|
TEMPLATE static u32 FASTCALL OP_ASR()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = (i>>6) & 0x1F;
|
u32 v = (i>>6) & 0x1F;
|
||||||
cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 3)], v-1);
|
cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 3)], v-1);
|
||||||
cpu->R[REG_NUM(i, 0)] = (((s32)cpu->R[REG_NUM(i, 3)]) >> v);
|
cpu->R[REG_NUM(i, 0)] = (((s32)cpu->R[REG_NUM(i, 3)]) >> v);
|
||||||
|
@ -134,7 +134,7 @@ TEMPLATE static u32 FASTCALL OP_ASR()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADD_REG()
|
TEMPLATE static u32 FASTCALL OP_ADD_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 3)];
|
u32 a = cpu->R[REG_NUM(i, 3)];
|
||||||
u32 b = cpu->R[REG_NUM(i, 6)];
|
u32 b = cpu->R[REG_NUM(i, 6)];
|
||||||
cpu->R[REG_NUM(i, 0)] = a + b;
|
cpu->R[REG_NUM(i, 0)] = a + b;
|
||||||
|
@ -148,7 +148,7 @@ TEMPLATE static u32 FASTCALL OP_ADD_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_SUB_REG()
|
TEMPLATE static u32 FASTCALL OP_SUB_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 3)];
|
u32 a = cpu->R[REG_NUM(i, 3)];
|
||||||
u32 b = cpu->R[REG_NUM(i, 6)];
|
u32 b = cpu->R[REG_NUM(i, 6)];
|
||||||
cpu->R[REG_NUM(i, 0)] = a - b;
|
cpu->R[REG_NUM(i, 0)] = a - b;
|
||||||
|
@ -162,7 +162,7 @@ TEMPLATE static u32 FASTCALL OP_SUB_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADD_IMM3()
|
TEMPLATE static u32 FASTCALL OP_ADD_IMM3()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 3)];
|
u32 a = cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->R[REG_NUM(i, 0)] = a + REG_NUM(i, 6);
|
cpu->R[REG_NUM(i, 0)] = a + REG_NUM(i, 6);
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
|
@ -175,7 +175,7 @@ TEMPLATE static u32 FASTCALL OP_ADD_IMM3()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_SUB_IMM3()
|
TEMPLATE static u32 FASTCALL OP_SUB_IMM3()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 3)];
|
u32 a = cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->R[REG_NUM(i, 0)] = a - REG_NUM(i, 6);
|
cpu->R[REG_NUM(i, 0)] = a - REG_NUM(i, 6);
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
|
@ -188,7 +188,7 @@ TEMPLATE static u32 FASTCALL OP_SUB_IMM3()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_MOV_IMM8()
|
TEMPLATE static u32 FASTCALL OP_MOV_IMM8()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 8)] = i & 0xFF;
|
cpu->R[REG_NUM(i, 8)] = i & 0xFF;
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 8)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 8)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 8)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 8)] == 0;
|
||||||
|
@ -198,7 +198,7 @@ TEMPLATE static u32 FASTCALL OP_MOV_IMM8()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_CMP_IMM8()
|
TEMPLATE static u32 FASTCALL OP_CMP_IMM8()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 tmp = cpu->R[REG_NUM(i, 8)] - (i & 0xFF);
|
u32 tmp = cpu->R[REG_NUM(i, 8)] - (i & 0xFF);
|
||||||
cpu->CPSR.bits.N = BIT31(tmp);
|
cpu->CPSR.bits.N = BIT31(tmp);
|
||||||
cpu->CPSR.bits.Z = tmp == 0;
|
cpu->CPSR.bits.Z = tmp == 0;
|
||||||
|
@ -210,7 +210,7 @@ TEMPLATE static u32 FASTCALL OP_CMP_IMM8()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADD_IMM8()
|
TEMPLATE static u32 FASTCALL OP_ADD_IMM8()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 tmp = cpu->R[REG_NUM(i, 8)] + (i & 0xFF);
|
u32 tmp = cpu->R[REG_NUM(i, 8)] + (i & 0xFF);
|
||||||
cpu->CPSR.bits.N = BIT31(tmp);
|
cpu->CPSR.bits.N = BIT31(tmp);
|
||||||
cpu->CPSR.bits.Z = tmp == 0;
|
cpu->CPSR.bits.Z = tmp == 0;
|
||||||
|
@ -223,7 +223,7 @@ TEMPLATE static u32 FASTCALL OP_ADD_IMM8()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_SUB_IMM8()
|
TEMPLATE static u32 FASTCALL OP_SUB_IMM8()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 tmp = cpu->R[REG_NUM(i, 8)] - (i & 0xFF);
|
u32 tmp = cpu->R[REG_NUM(i, 8)] - (i & 0xFF);
|
||||||
cpu->CPSR.bits.N = BIT31(tmp);
|
cpu->CPSR.bits.N = BIT31(tmp);
|
||||||
cpu->CPSR.bits.Z = tmp == 0;
|
cpu->CPSR.bits.Z = tmp == 0;
|
||||||
|
@ -236,7 +236,7 @@ TEMPLATE static u32 FASTCALL OP_SUB_IMM8()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_AND()
|
TEMPLATE static u32 FASTCALL OP_AND()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] &= cpu->R[REG_NUM(i, 3)];
|
cpu->R[REG_NUM(i, 0)] &= cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -246,7 +246,7 @@ TEMPLATE static u32 FASTCALL OP_AND()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_EOR()
|
TEMPLATE static u32 FASTCALL OP_EOR()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] ^= cpu->R[REG_NUM(i, 3)];
|
cpu->R[REG_NUM(i, 0)] ^= cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -256,7 +256,7 @@ TEMPLATE static u32 FASTCALL OP_EOR()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LSL_REG()
|
TEMPLATE static u32 FASTCALL OP_LSL_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
||||||
|
|
||||||
if(!v)
|
if(!v)
|
||||||
|
@ -286,7 +286,7 @@ TEMPLATE static u32 FASTCALL OP_LSL_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LSR_REG()
|
TEMPLATE static u32 FASTCALL OP_LSR_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
||||||
|
|
||||||
if(!v)
|
if(!v)
|
||||||
|
@ -316,7 +316,7 @@ TEMPLATE static u32 FASTCALL OP_LSR_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ASR_REG()
|
TEMPLATE static u32 FASTCALL OP_ASR_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
||||||
|
|
||||||
if(!v)
|
if(!v)
|
||||||
|
@ -344,7 +344,7 @@ TEMPLATE static u32 FASTCALL OP_ASR_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADC_REG()
|
TEMPLATE static u32 FASTCALL OP_ADC_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 0)];
|
u32 a = cpu->R[REG_NUM(i, 0)];
|
||||||
u32 b = cpu->R[REG_NUM(i, 3)];
|
u32 b = cpu->R[REG_NUM(i, 3)];
|
||||||
u32 tmp = b + cpu->CPSR.bits.C;
|
u32 tmp = b + cpu->CPSR.bits.C;
|
||||||
|
@ -363,7 +363,7 @@ TEMPLATE static u32 FASTCALL OP_ADC_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_SBC_REG()
|
TEMPLATE static u32 FASTCALL OP_SBC_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 0)];
|
u32 a = cpu->R[REG_NUM(i, 0)];
|
||||||
u32 b = cpu->R[REG_NUM(i, 3)];
|
u32 b = cpu->R[REG_NUM(i, 3)];
|
||||||
u32 tmp = a - (!cpu->CPSR.bits.C);
|
u32 tmp = a - (!cpu->CPSR.bits.C);
|
||||||
|
@ -373,15 +373,15 @@ TEMPLATE static u32 FASTCALL OP_SBC_REG()
|
||||||
cpu->CPSR.bits.N = BIT31(res);
|
cpu->CPSR.bits.N = BIT31(res);
|
||||||
cpu->CPSR.bits.Z = res == 0;
|
cpu->CPSR.bits.Z = res == 0;
|
||||||
|
|
||||||
cpu->CPSR.bits.C = (!UNSIGNED_UNDERFLOW(a, (cpu->CPSR.bits.C?0:0x80000000), tmp)) & (!UNSIGNED_OVERFLOW(tmp, b, res));
|
cpu->CPSR.bits.C = (!UNSIGNED_UNDERFLOW(a, (u32)(cpu->CPSR.bits.C?0:0x80000000), tmp)) & (!UNSIGNED_OVERFLOW(tmp, b, res));
|
||||||
cpu->CPSR.bits.V = SIGNED_UNDERFLOW(a, (cpu->CPSR.bits.C?0:0x80000000), tmp) | SIGNED_OVERFLOW(tmp, b, res);
|
cpu->CPSR.bits.V = SIGNED_UNDERFLOW(a, (u32)(cpu->CPSR.bits.C?0:0x80000000), tmp) | SIGNED_OVERFLOW(tmp, b, res);
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ROR_REG()
|
TEMPLATE static u32 FASTCALL OP_ROR_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
u32 v = cpu->R[REG_NUM(i, 3)]&0xFF;
|
||||||
|
|
||||||
if(v == 0)
|
if(v == 0)
|
||||||
|
@ -408,7 +408,7 @@ TEMPLATE static u32 FASTCALL OP_ROR_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_TST()
|
TEMPLATE static u32 FASTCALL OP_TST()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 tmp = cpu->R[REG_NUM(i, 0)] & cpu->R[REG_NUM(i, 3)];
|
u32 tmp = cpu->R[REG_NUM(i, 0)] & cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->CPSR.bits.N = BIT31(tmp);
|
cpu->CPSR.bits.N = BIT31(tmp);
|
||||||
cpu->CPSR.bits.Z = tmp == 0;
|
cpu->CPSR.bits.Z = tmp == 0;
|
||||||
|
@ -418,21 +418,21 @@ TEMPLATE static u32 FASTCALL OP_TST()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_NEG()
|
TEMPLATE static u32 FASTCALL OP_NEG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 a = cpu->R[REG_NUM(i, 3)];
|
u32 a = cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->R[REG_NUM(i, 0)] = -((signed int)a);
|
cpu->R[REG_NUM(i, 0)] = -((signed int)a);
|
||||||
|
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
cpu->CPSR.bits.C = !UNSIGNED_UNDERFLOW(0, a, cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.C = !UNSIGNED_UNDERFLOW((u32)0, a, cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.V = SIGNED_UNDERFLOW(0, a, cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.V = SIGNED_UNDERFLOW((u32)0, a, cpu->R[REG_NUM(i, 0)]);
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_CMP()
|
TEMPLATE static u32 FASTCALL OP_CMP()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 tmp = cpu->R[REG_NUM(i, 0)] -cpu->R[REG_NUM(i, 3)];
|
u32 tmp = cpu->R[REG_NUM(i, 0)] -cpu->R[REG_NUM(i, 3)];
|
||||||
|
|
||||||
cpu->CPSR.bits.N = BIT31(tmp);
|
cpu->CPSR.bits.N = BIT31(tmp);
|
||||||
|
@ -445,7 +445,7 @@ TEMPLATE static u32 FASTCALL OP_CMP()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_CMN()
|
TEMPLATE static u32 FASTCALL OP_CMN()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 tmp = cpu->R[REG_NUM(i, 0)] + cpu->R[REG_NUM(i, 3)];
|
u32 tmp = cpu->R[REG_NUM(i, 0)] + cpu->R[REG_NUM(i, 3)];
|
||||||
|
|
||||||
//execute = FALSE;
|
//execute = FALSE;
|
||||||
|
@ -460,7 +460,7 @@ TEMPLATE static u32 FASTCALL OP_CMN()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ORR()
|
TEMPLATE static u32 FASTCALL OP_ORR()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] |= cpu->R[REG_NUM(i, 3)];
|
cpu->R[REG_NUM(i, 0)] |= cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -470,7 +470,7 @@ TEMPLATE static u32 FASTCALL OP_ORR()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_MUL_REG()
|
TEMPLATE static u32 FASTCALL OP_MUL_REG()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] *= cpu->R[REG_NUM(i, 3)];
|
cpu->R[REG_NUM(i, 0)] *= cpu->R[REG_NUM(i, 3)];
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -480,7 +480,7 @@ TEMPLATE static u32 FASTCALL OP_MUL_REG()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_BIC()
|
TEMPLATE static u32 FASTCALL OP_BIC()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] &= (~cpu->R[REG_NUM(i, 3)]);
|
cpu->R[REG_NUM(i, 0)] &= (~cpu->R[REG_NUM(i, 3)]);
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -490,7 +490,7 @@ TEMPLATE static u32 FASTCALL OP_BIC()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_MVN()
|
TEMPLATE static u32 FASTCALL OP_MVN()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 0)] = (~cpu->R[REG_NUM(i, 3)]);
|
cpu->R[REG_NUM(i, 0)] = (~cpu->R[REG_NUM(i, 3)]);
|
||||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]);
|
||||||
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;
|
||||||
|
@ -500,7 +500,7 @@ TEMPLATE static u32 FASTCALL OP_MVN()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADD_SPE()
|
TEMPLATE static u32 FASTCALL OP_ADD_SPE()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 Rd = (i&7) | ((i>>4)&8);
|
u32 Rd = (i&7) | ((i>>4)&8);
|
||||||
cpu->R[Rd] += cpu->R[REG_POS(i, 3)];
|
cpu->R[Rd] += cpu->R[REG_POS(i, 3)];
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ TEMPLATE static u32 FASTCALL OP_ADD_SPE()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_CMP_SPE()
|
TEMPLATE static u32 FASTCALL OP_CMP_SPE()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 Rn = (i&7) | ((i>>4)&8);
|
u32 Rn = (i&7) | ((i>>4)&8);
|
||||||
u32 tmp = cpu->R[Rn] -cpu->R[REG_POS(i, 3)];
|
u32 tmp = cpu->R[Rn] -cpu->R[REG_POS(i, 3)];
|
||||||
|
|
||||||
|
@ -526,7 +526,7 @@ TEMPLATE static u32 FASTCALL OP_CMP_SPE()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_MOV_SPE()
|
TEMPLATE static u32 FASTCALL OP_MOV_SPE()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 Rd = (i&7) | ((i>>4)&8);
|
u32 Rd = (i&7) | ((i>>4)&8);
|
||||||
cpu->R[Rd] = cpu->R[REG_POS(i, 3)];
|
cpu->R[Rd] = cpu->R[REG_POS(i, 3)];
|
||||||
|
|
||||||
|
@ -565,48 +565,48 @@ TEMPLATE static u32 FASTCALL OP_LDR_PCREL()
|
||||||
|
|
||||||
cpu->R[REG_NUM(cpu->instruction, 8)] = READ32(cpu->mem_if->data, adr);
|
cpu->R[REG_NUM(cpu->instruction, 8)] = READ32(cpu->mem_if->data, adr);
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STR_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_STR_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 6)] + cpu->R[REG_NUM(i, 3)];
|
u32 adr = cpu->R[REG_NUM(i, 6)] + cpu->R[REG_NUM(i, 3)];
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 0)]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 0)]);
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STRH_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_STRH_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
||||||
WRITE16(cpu->mem_if->data, adr, ((u16)cpu->R[REG_NUM(i, 0)]));
|
WRITE16(cpu->mem_if->data, adr, ((u16)cpu->R[REG_NUM(i, 0)]));
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STRB_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_STRB_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
||||||
WRITE8(cpu->mem_if->data, adr, ((u8)cpu->R[REG_NUM(i, 0)]));
|
WRITE8(cpu->mem_if->data, adr, ((u8)cpu->R[REG_NUM(i, 0)]));
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDRSB_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDRSB_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
||||||
cpu->R[REG_NUM(i, 0)] = (s32)((s8)READ8(cpu->mem_if->data, adr));
|
cpu->R[REG_NUM(i, 0)] = (s32)((s8)READ8(cpu->mem_if->data, adr));
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDR_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDR_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = (cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]);
|
u32 adr = (cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)]);
|
||||||
u32 tempValue = READ32(cpu->mem_if->data, adr&0xFFFFFFFC);
|
u32 tempValue = READ32(cpu->mem_if->data, adr&0xFFFFFFFC);
|
||||||
|
|
||||||
|
@ -614,114 +614,114 @@ TEMPLATE static u32 FASTCALL OP_LDR_REG_OFF()
|
||||||
tempValue = (tempValue>>adr) | (tempValue<<(32-adr));
|
tempValue = (tempValue>>adr) | (tempValue<<(32-adr));
|
||||||
cpu->R[REG_NUM(i, 0)] = tempValue;
|
cpu->R[REG_NUM(i, 0)] = tempValue;
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDRH_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDRH_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
||||||
cpu->R[REG_NUM(i, 0)] = (u32)READ16(cpu->mem_if->data, adr);
|
cpu->R[REG_NUM(i, 0)] = (u32)READ16(cpu->mem_if->data, adr);
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDRB_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDRB_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
||||||
cpu->R[REG_NUM(i, 0)] = (u32)READ8(cpu->mem_if->data, adr);
|
cpu->R[REG_NUM(i, 0)] = (u32)READ8(cpu->mem_if->data, adr);
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDRSH_REG_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDRSH_REG_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
u32 adr = cpu->R[REG_NUM(i, 3)] + cpu->R[REG_NUM(i, 6)];
|
||||||
cpu->R[REG_NUM(i, 0)] = (s32)((s16)READ16(cpu->mem_if->data, adr));
|
cpu->R[REG_NUM(i, 0)] = (s32)((s16)READ16(cpu->mem_if->data, adr));
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STR_IMM_OFF()
|
TEMPLATE static u32 FASTCALL OP_STR_IMM_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C);
|
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C);
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 0)]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 0)]);
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDR_IMM_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDR_IMM_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C);
|
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>4)&0x7C);
|
||||||
u32 tempValue = READ32(cpu->mem_if->data, adr&0xFFFFFFFC);
|
u32 tempValue = READ32(cpu->mem_if->data, adr&0xFFFFFFFC);
|
||||||
adr = (adr&3)*8;
|
adr = (adr&3)*8;
|
||||||
tempValue = (tempValue>>adr) | (tempValue<<(32-adr));
|
tempValue = (tempValue>>adr) | (tempValue<<(32-adr));
|
||||||
cpu->R[REG_NUM(i, 0)] = tempValue;
|
cpu->R[REG_NUM(i, 0)] = tempValue;
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STRB_IMM_OFF()
|
TEMPLATE static u32 FASTCALL OP_STRB_IMM_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>6)&0x1F);
|
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>6)&0x1F);
|
||||||
WRITE8(cpu->mem_if->data, adr, (u8)cpu->R[REG_NUM(i, 0)]);
|
WRITE8(cpu->mem_if->data, adr, (u8)cpu->R[REG_NUM(i, 0)]);
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDRB_IMM_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDRB_IMM_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>6)&0x1F);
|
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>6)&0x1F);
|
||||||
cpu->R[REG_NUM(i, 0)] = READ8(cpu->mem_if->data, adr);
|
cpu->R[REG_NUM(i, 0)] = READ8(cpu->mem_if->data, adr);
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STRH_IMM_OFF()
|
TEMPLATE static u32 FASTCALL OP_STRH_IMM_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>5)&0x3E);
|
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>5)&0x3E);
|
||||||
WRITE16(cpu->mem_if->data, adr, (u16)cpu->R[REG_NUM(i, 0)]);
|
WRITE16(cpu->mem_if->data, adr, (u16)cpu->R[REG_NUM(i, 0)]);
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDRH_IMM_OFF()
|
TEMPLATE static u32 FASTCALL OP_LDRH_IMM_OFF()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>5)&0x3E);
|
u32 adr = cpu->R[REG_NUM(i, 3)] + ((i>>5)&0x3E);
|
||||||
cpu->R[REG_NUM(i, 0)] = READ16(cpu->mem_if->data, adr);
|
cpu->R[REG_NUM(i, 0)] = READ16(cpu->mem_if->data, adr);
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STR_SPREL()
|
TEMPLATE static u32 FASTCALL OP_STR_SPREL()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[13] + ((i&0xFF)<<2);
|
u32 adr = cpu->R[13] + ((i&0xFF)<<2);
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 8)]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[REG_NUM(i, 8)]);
|
||||||
|
|
||||||
return 2 + MMU.MMU_WAIT16[cpu->proc_ID][(adr>>24)&0xF];
|
return 2 + MMU.MMU_WAIT16[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDR_SPREL()
|
TEMPLATE static u32 FASTCALL OP_LDR_SPREL()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[13] + ((i&0xFF)<<2);
|
u32 adr = cpu->R[13] + ((i&0xFF)<<2);
|
||||||
cpu->R[REG_NUM(i, 8)] = READ32(cpu->mem_if->data, adr);
|
cpu->R[REG_NUM(i, 8)] = READ32(cpu->mem_if->data, adr);
|
||||||
|
|
||||||
return 3 + MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
return 3 + MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADD_2PC()
|
TEMPLATE static u32 FASTCALL OP_ADD_2PC()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 8)] = (cpu->R[15]&0xFFFFFFFC) + ((i&0xFF)<<2);
|
cpu->R[REG_NUM(i, 8)] = (cpu->R[15]&0xFFFFFFFC) + ((i&0xFF)<<2);
|
||||||
|
|
||||||
return 5;
|
return 5;
|
||||||
|
@ -729,7 +729,7 @@ TEMPLATE static u32 FASTCALL OP_ADD_2PC()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_ADD_2SP()
|
TEMPLATE static u32 FASTCALL OP_ADD_2SP()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[REG_NUM(i, 8)] = cpu->R[13] + ((i&0xFF)<<2);
|
cpu->R[REG_NUM(i, 8)] = cpu->R[13] + ((i&0xFF)<<2);
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -751,7 +751,7 @@ TEMPLATE static u32 FASTCALL OP_ADJUST_M_SP()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_PUSH()
|
TEMPLATE static u32 FASTCALL OP_PUSH()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[13] - 4;
|
u32 adr = cpu->R[13] - 4;
|
||||||
u32 c = 0, j;
|
u32 c = 0, j;
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ TEMPLATE static u32 FASTCALL OP_PUSH()
|
||||||
if(BIT_N(i, 7-j))
|
if(BIT_N(i, 7-j))
|
||||||
{
|
{
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[7-j]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[7-j]);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr -= 4;
|
adr -= 4;
|
||||||
}
|
}
|
||||||
cpu->R[13] = adr + 4;
|
cpu->R[13] = adr + 4;
|
||||||
|
@ -769,19 +769,19 @@ TEMPLATE static u32 FASTCALL OP_PUSH()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_PUSH_LR()
|
TEMPLATE static u32 FASTCALL OP_PUSH_LR()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[13] - 4;
|
u32 adr = cpu->R[13] - 4;
|
||||||
u32 c = 0, j;
|
u32 c = 0, j;
|
||||||
|
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[14]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[14]);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr -= 4;
|
adr -= 4;
|
||||||
|
|
||||||
for(j = 0; j<8; ++j)
|
for(j = 0; j<8; ++j)
|
||||||
if(BIT_N(i, 7-j))
|
if(BIT_N(i, 7-j))
|
||||||
{
|
{
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[7-j]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[7-j]);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr -= 4;
|
adr -= 4;
|
||||||
}
|
}
|
||||||
cpu->R[13] = adr + 4;
|
cpu->R[13] = adr + 4;
|
||||||
|
@ -791,7 +791,7 @@ TEMPLATE static u32 FASTCALL OP_PUSH_LR()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_POP()
|
TEMPLATE static u32 FASTCALL OP_POP()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[13];
|
u32 adr = cpu->R[13];
|
||||||
u32 c = 0, j;
|
u32 c = 0, j;
|
||||||
|
|
||||||
|
@ -799,7 +799,7 @@ TEMPLATE static u32 FASTCALL OP_POP()
|
||||||
if(BIT_N(i, j))
|
if(BIT_N(i, j))
|
||||||
{
|
{
|
||||||
cpu->R[j] = READ32(cpu->mem_if->data, adr);
|
cpu->R[j] = READ32(cpu->mem_if->data, adr);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr += 4;
|
adr += 4;
|
||||||
}
|
}
|
||||||
cpu->R[13] = adr;
|
cpu->R[13] = adr;
|
||||||
|
@ -809,7 +809,7 @@ TEMPLATE static u32 FASTCALL OP_POP()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_POP_PC()
|
TEMPLATE static u32 FASTCALL OP_POP_PC()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[13];
|
u32 adr = cpu->R[13];
|
||||||
u32 c = 0, j;
|
u32 c = 0, j;
|
||||||
u32 v;
|
u32 v;
|
||||||
|
@ -818,15 +818,15 @@ TEMPLATE static u32 FASTCALL OP_POP_PC()
|
||||||
if(BIT_N(i, j))
|
if(BIT_N(i, j))
|
||||||
{
|
{
|
||||||
cpu->R[j] = READ32(cpu->mem_if->data, adr);
|
cpu->R[j] = READ32(cpu->mem_if->data, adr);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr += 4;
|
adr += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = READ32(cpu->mem_if->data, adr);
|
v = READ32(cpu->mem_if->data, adr);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
cpu->R[15] = v & 0xFFFFFFFE;
|
cpu->R[15] = v & 0xFFFFFFFE;
|
||||||
cpu->next_instruction = v & 0xFFFFFFFE;
|
cpu->next_instruction = v & 0xFFFFFFFE;
|
||||||
if(cpu->proc_ID==0)
|
if(PROCNUM==0)
|
||||||
cpu->CPSR.bits.T = BIT0(v);
|
cpu->CPSR.bits.T = BIT0(v);
|
||||||
adr += 4;
|
adr += 4;
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ TEMPLATE static u32 FASTCALL OP_BKPT_THUMB()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_STMIA_THUMB()
|
TEMPLATE static u32 FASTCALL OP_STMIA_THUMB()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 8)];
|
u32 adr = cpu->R[REG_NUM(i, 8)];
|
||||||
u32 c = 0, j;
|
u32 c = 0, j;
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ TEMPLATE static u32 FASTCALL OP_STMIA_THUMB()
|
||||||
if(BIT_N(i, j))
|
if(BIT_N(i, j))
|
||||||
{
|
{
|
||||||
WRITE32(cpu->mem_if->data, adr, cpu->R[j]);
|
WRITE32(cpu->mem_if->data, adr, cpu->R[j]);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr += 4;
|
adr += 4;
|
||||||
}
|
}
|
||||||
cpu->R[REG_NUM(i, 8)] = adr;
|
cpu->R[REG_NUM(i, 8)] = adr;
|
||||||
|
@ -858,7 +858,7 @@ TEMPLATE static u32 FASTCALL OP_STMIA_THUMB()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_LDMIA_THUMB()
|
TEMPLATE static u32 FASTCALL OP_LDMIA_THUMB()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
u32 adr = cpu->R[REG_NUM(i, 8)];
|
u32 adr = cpu->R[REG_NUM(i, 8)];
|
||||||
u32 c = 0, j;
|
u32 c = 0, j;
|
||||||
|
|
||||||
|
@ -866,7 +866,7 @@ TEMPLATE static u32 FASTCALL OP_LDMIA_THUMB()
|
||||||
if(BIT_N(i, j))
|
if(BIT_N(i, j))
|
||||||
{
|
{
|
||||||
cpu->R[j] = READ32(cpu->mem_if->data, adr);
|
cpu->R[j] = READ32(cpu->mem_if->data, adr);
|
||||||
c += MMU.MMU_WAIT32[cpu->proc_ID][(adr>>24)&0xF];
|
c += MMU.MMU_WAIT32[PROCNUM][(adr>>24)&0xF];
|
||||||
adr += 4;
|
adr += 4;
|
||||||
}
|
}
|
||||||
cpu->R[REG_NUM(i, 8)] = adr;
|
cpu->R[REG_NUM(i, 8)] = adr;
|
||||||
|
@ -875,7 +875,7 @@ TEMPLATE static u32 FASTCALL OP_LDMIA_THUMB()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_B_COND()
|
TEMPLATE static u32 FASTCALL OP_B_COND()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
if(!TEST_COND((i>>8)&0xF, 0, cpu->CPSR))
|
if(!TEST_COND((i>>8)&0xF, 0, cpu->CPSR))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -886,7 +886,7 @@ TEMPLATE static u32 FASTCALL OP_B_COND()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_SWI_THUMB()
|
TEMPLATE static u32 FASTCALL OP_SWI_THUMB()
|
||||||
{
|
{
|
||||||
if (((cpu->intVector != 0) ^ (cpu->proc_ID == ARMCPU_ARM9)))
|
if (((cpu->intVector != 0) ^ (PROCNUM == ARMCPU_ARM9)))
|
||||||
{
|
{
|
||||||
/* we use an irq thats not in the irq tab, as
|
/* we use an irq thats not in the irq tab, as
|
||||||
it was replaced duie to a changed intVector */
|
it was replaced duie to a changed intVector */
|
||||||
|
@ -912,7 +912,7 @@ TEMPLATE static u32 FASTCALL OP_SWI_THUMB()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_B_UNCOND()
|
TEMPLATE static u32 FASTCALL OP_B_UNCOND()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[15] += (SIGNEEXT_IMM11(i)<<1);
|
cpu->R[15] += (SIGNEEXT_IMM11(i)<<1);
|
||||||
cpu->next_instruction = cpu->R[15];
|
cpu->next_instruction = cpu->R[15];
|
||||||
return 3;
|
return 3;
|
||||||
|
@ -920,7 +920,7 @@ TEMPLATE static u32 FASTCALL OP_B_UNCOND()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_BLX()
|
TEMPLATE static u32 FASTCALL OP_BLX()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[15] = (cpu->R[14] + ((i&0x7FF)<<1))&0xFFFFFFFC;
|
cpu->R[15] = (cpu->R[14] + ((i&0x7FF)<<1))&0xFFFFFFFC;
|
||||||
cpu->R[14] = cpu->next_instruction | 1;
|
cpu->R[14] = cpu->next_instruction | 1;
|
||||||
cpu->next_instruction = cpu->R[15];
|
cpu->next_instruction = cpu->R[15];
|
||||||
|
@ -930,14 +930,14 @@ TEMPLATE static u32 FASTCALL OP_BLX()
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_BL_10()
|
TEMPLATE static u32 FASTCALL OP_BL_10()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[14] = cpu->R[15] + (SIGNEEXT_IMM11(i)<<12);
|
cpu->R[14] = cpu->R[15] + (SIGNEEXT_IMM11(i)<<12);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMPLATE static u32 FASTCALL OP_BL_THUMB()
|
TEMPLATE static u32 FASTCALL OP_BL_THUMB()
|
||||||
{
|
{
|
||||||
u32 i = cpu->instruction;
|
const u32 &i = cpu->instruction;
|
||||||
cpu->R[15] = (cpu->R[14] + ((i&0x7FF)<<1));
|
cpu->R[15] = (cpu->R[14] + ((i&0x7FF)<<1));
|
||||||
cpu->R[14] = cpu->next_instruction | 1;
|
cpu->R[14] = cpu->next_instruction | 1;
|
||||||
cpu->next_instruction = cpu->R[15];
|
cpu->next_instruction = cpu->R[15];
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#define TYPES_HPP
|
#define TYPES_HPP
|
||||||
|
|
||||||
#define DESMUME_NAME "DeSmuME"
|
#define DESMUME_NAME "DeSmuME"
|
||||||
#define DESMUME_VERSION_STRING "0.8.0b2-interim"
|
#define DESMUME_VERSION_STRING "0.9-interim"
|
||||||
#define DESMUME_VERSION_NUMERIC 80002
|
#define DESMUME_VERSION_NUMERIC 90000
|
||||||
#define DESMUME_NAME_AND_VERSION DESMUME_NAME " " DESMUME_VERSION_STRING " " VERSION
|
#define DESMUME_NAME_AND_VERSION DESMUME_NAME " " DESMUME_VERSION_STRING " " VERSION
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -39,6 +39,8 @@
|
||||||
#define ALIGN(X)
|
#define ALIGN(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define CACHE_ALIGN ALIGN(32)
|
||||||
|
|
||||||
#ifndef FASTCALL
|
#ifndef FASTCALL
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#define FASTCALL __attribute__((fastcall))
|
#define FASTCALL __attribute__((fastcall))
|
||||||
|
@ -59,6 +61,14 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FORCEINLINE
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define FORCEINLINE __forceinline
|
||||||
|
#else
|
||||||
|
#define FORCEINLINE INLINE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__LP64__)
|
#if defined(__LP64__)
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
typedef unsigned short u16;
|
typedef unsigned short u16;
|
||||||
|
|
|
@ -107,6 +107,189 @@
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)\__bins"
|
||||||
|
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="MASM"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
InlineFunctionExpansion="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
EnableFiberSafeOptimizations="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
|
AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"
|
||||||
|
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\"Release\";WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG"
|
||||||
|
StringPooling="true"
|
||||||
|
ExceptionHandling="1"
|
||||||
|
BufferSecurityCheck="false"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
FloatingPointModel="2"
|
||||||
|
WarningLevel="1"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CallingConvention="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"
|
||||||
|
OutputFile="$(OutDir)\$(ProjectName).exe"
|
||||||
|
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
AdditionalManifestFiles="DeSmuME_x86.manifest"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release (SSE2)|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)\__bins"
|
||||||
|
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="MASM"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
EnableFiberSafeOptimizations="true"
|
||||||
|
WholeProgramOptimization="true"
|
||||||
|
AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"
|
||||||
|
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\"Release SSE2\";WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG"
|
||||||
|
StringPooling="true"
|
||||||
|
ExceptionHandling="1"
|
||||||
|
StructMemberAlignment="0"
|
||||||
|
BufferSecurityCheck="false"
|
||||||
|
EnableFunctionLevelLinking="false"
|
||||||
|
EnableEnhancedInstructionSet="2"
|
||||||
|
FloatingPointModel="2"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
WarningLevel="1"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CallingConvention="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"
|
||||||
|
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
|
||||||
|
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
GenerateMapFile="true"
|
||||||
|
EnableCOMDATFolding="0"
|
||||||
|
OptimizeForWindows98="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
AdditionalManifestFiles="DeSmuME_x86.manifest"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
OutputDirectory="$(SolutionDir)\__bins"
|
OutputDirectory="$(SolutionDir)\__bins"
|
||||||
|
@ -194,94 +377,6 @@
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)\__bins"
|
|
||||||
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="MASM"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
InlineFunctionExpansion="2"
|
|
||||||
EnableIntrinsicFunctions="true"
|
|
||||||
FavorSizeOrSpeed="1"
|
|
||||||
OmitFramePointers="true"
|
|
||||||
EnableFiberSafeOptimizations="true"
|
|
||||||
WholeProgramOptimization="true"
|
|
||||||
AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"
|
|
||||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\"Release\";WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
|
|
||||||
StringPooling="true"
|
|
||||||
ExceptionHandling="1"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableEnhancedInstructionSet="0"
|
|
||||||
FloatingPointModel="2"
|
|
||||||
WarningLevel="1"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
CallingConvention="1"
|
|
||||||
CompileAs="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"
|
|
||||||
OutputFile="$(OutDir)\$(ProjectName).exe"
|
|
||||||
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
AdditionalManifestFiles="DeSmuME_x86.manifest"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
OutputDirectory="$(SolutionDir)\__bins"
|
OutputDirectory="$(SolutionDir)\__bins"
|
||||||
|
@ -368,94 +463,6 @@
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
|
||||||
Name="Release (SSE2)|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)\__bins"
|
|
||||||
IntermediateDirectory="$(SolutionDir)\.VS2005\$(ConfigurationName)\$(PlatformName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
WholeProgramOptimization="1"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="MASM"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
InlineFunctionExpansion="2"
|
|
||||||
EnableIntrinsicFunctions="true"
|
|
||||||
FavorSizeOrSpeed="1"
|
|
||||||
OmitFramePointers="true"
|
|
||||||
EnableFiberSafeOptimizations="true"
|
|
||||||
WholeProgramOptimization="true"
|
|
||||||
AdditionalIncludeDirectories="..;.\zlib123;.\zziplib"
|
|
||||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\"Release SSE2\";WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
|
|
||||||
StringPooling="true"
|
|
||||||
ExceptionHandling="1"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableEnhancedInstructionSet="2"
|
|
||||||
FloatingPointModel="2"
|
|
||||||
WarningLevel="1"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
CallingConvention="1"
|
|
||||||
CompileAs="0"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib"
|
|
||||||
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
|
|
||||||
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
AdditionalManifestFiles="DeSmuME_x86.manifest"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release (SSE2)|x64"
|
Name="Release (SSE2)|x64"
|
||||||
OutputDirectory="$(SolutionDir)\__bins"
|
OutputDirectory="$(SolutionDir)\__bins"
|
||||||
|
@ -933,14 +940,6 @@
|
||||||
Name="MASM"
|
Name="MASM"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
ExcludedFromBuild="true"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="MASM"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
ExcludedFromBuild="true"
|
ExcludedFromBuild="true"
|
||||||
|
@ -953,7 +952,7 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|x64"
|
Name="Release (SSE2)|Win32"
|
||||||
ExcludedFromBuild="true"
|
ExcludedFromBuild="true"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
|
@ -964,7 +963,15 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release (SSE2)|Win32"
|
Name="Debug|x64"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="MASM"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|x64"
|
||||||
ExcludedFromBuild="true"
|
ExcludedFromBuild="true"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
|
@ -997,7 +1004,7 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug|x64"
|
Name="Release|Win32"
|
||||||
ExcludedFromBuild="true"
|
ExcludedFromBuild="true"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
|
@ -1005,7 +1012,7 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Debug|x64"
|
||||||
ExcludedFromBuild="true"
|
ExcludedFromBuild="true"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
|
@ -1133,6 +1140,10 @@
|
||||||
RelativePath="..\saves.h"
|
RelativePath="..\saves.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\shaders.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\softrender.cpp"
|
RelativePath="..\softrender.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -72,7 +72,7 @@ BOOL CALLBACK IoregView_Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
IORegView = new ioregview_struct[1];
|
IORegView = new ioregview_struct;
|
||||||
memset(IORegView, 0, sizeof(ioregview_struct));
|
memset(IORegView, 0, sizeof(ioregview_struct));
|
||||||
IORegView->autoup_secs = 5;
|
IORegView->autoup_secs = 5;
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||||
|
@ -138,5 +138,5 @@ BOOL CALLBACK IoregView_Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,11 +280,15 @@ LRESULT CALLBACK ViewDisasm_ARM7BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!DisView7 && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
|
@ -292,7 +296,7 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
SetWindowText(hwnd, "ARM7 Disassembler");
|
SetWindowText(hwnd, "ARM7 Disassembler");
|
||||||
SetDlgItemInt(hwnd, IDC_SETPNUM, 1, FALSE);
|
SetDlgItemInt(hwnd, IDC_SETPNUM, 1, FALSE);
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_DES), BM_SETCHECK, TRUE, 0);
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_DES), BM_SETCHECK, TRUE, 0);
|
||||||
DisView7 = new disview_struct[1];
|
DisView7 = new disview_struct;
|
||||||
memset(DisView7, 0, sizeof(disview_struct));
|
memset(DisView7, 0, sizeof(disview_struct));
|
||||||
DisView7->cpu = &NDS_ARM7;
|
DisView7->cpu = &NDS_ARM7;
|
||||||
DisView7->autoup_secs = 5;
|
DisView7->autoup_secs = 5;
|
||||||
|
@ -380,7 +384,7 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
{
|
{
|
||||||
int ndstep;
|
int ndstep;
|
||||||
ndstep = GetDlgItemInt(hwnd, IDC_SETPNUM, NULL, FALSE);
|
ndstep = GetDlgItemInt(hwnd, IDC_SETPNUM, NULL, FALSE);
|
||||||
NDS_exec(ndstep, TRUE);
|
NDS_exec<TRUE>(ndstep);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case IDC_GO :
|
case IDC_GO :
|
||||||
|
@ -459,7 +463,7 @@ BOOL CALLBACK ViewDisasm_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =================================================== ARM9
|
// =================================================== ARM9
|
||||||
|
@ -520,11 +524,15 @@ LRESULT CALLBACK ViewDisasm_ARM9BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!DisView9 && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
|
@ -532,7 +540,7 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
SetWindowText(hwnd, "ARM9 Disassembler");
|
SetWindowText(hwnd, "ARM9 Disassembler");
|
||||||
SetDlgItemInt(hwnd, IDC_SETPNUM, 1, FALSE);
|
SetDlgItemInt(hwnd, IDC_SETPNUM, 1, FALSE);
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_DES), BM_SETCHECK, TRUE, 0);
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_DES), BM_SETCHECK, TRUE, 0);
|
||||||
DisView9 = new disview_struct[1];
|
DisView9 = new disview_struct;
|
||||||
memset(DisView9, 0, sizeof(disview_struct));
|
memset(DisView9, 0, sizeof(disview_struct));
|
||||||
DisView9->cpu = &NDS_ARM9;
|
DisView9->cpu = &NDS_ARM9;
|
||||||
DisView9->autoup_secs = 5;
|
DisView9->autoup_secs = 5;
|
||||||
|
@ -620,7 +628,7 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
{
|
{
|
||||||
int ndstep;
|
int ndstep;
|
||||||
ndstep = GetDlgItemInt(hwnd, IDC_SETPNUM, NULL, FALSE);
|
ndstep = GetDlgItemInt(hwnd, IDC_SETPNUM, NULL, FALSE);
|
||||||
NDS_exec(ndstep, TRUE);
|
NDS_exec<TRUE>(ndstep);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case IDC_GO :
|
case IDC_GO :
|
||||||
|
@ -699,7 +707,7 @@ BOOL CALLBACK ViewDisasm_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblerTools_Refresh(u8 proc)
|
void DisassemblerTools_Refresh(u8 proc)
|
||||||
|
|
|
@ -42,7 +42,7 @@ void * FsReadFirst(const char * p, FsEntry * entry) {
|
||||||
strncpy(entry->cFileName, FindFileData.cFileName,256);
|
strncpy(entry->cFileName, FindFileData.cFileName,256);
|
||||||
entry->cFileName[255] = 0 ;
|
entry->cFileName[255] = 0 ;
|
||||||
strncpy(entry->cAlternateFileName, FindFileData.cAlternateFileName,14);
|
strncpy(entry->cAlternateFileName, FindFileData.cAlternateFileName,14);
|
||||||
entry->cAlternateFileName[14] = 0 ;
|
entry->cAlternateFileName[13] = 0 ;
|
||||||
entry->flags = 0;
|
entry->flags = 0;
|
||||||
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
entry->flags = FS_IS_DIR;
|
entry->flags = FS_IS_DIR;
|
||||||
|
@ -66,7 +66,7 @@ int FsReadNext(void * search, FsEntry * entry) {
|
||||||
strncpy(entry->cFileName, FindFileData.cFileName,256);
|
strncpy(entry->cFileName, FindFileData.cFileName,256);
|
||||||
entry->cFileName[255] = 0 ;
|
entry->cFileName[255] = 0 ;
|
||||||
strncpy(entry->cAlternateFileName, FindFileData.cAlternateFileName,14);
|
strncpy(entry->cAlternateFileName, FindFileData.cAlternateFileName,14);
|
||||||
entry->cAlternateFileName[14] = 0 ;
|
entry->cAlternateFileName[13] = 0 ;
|
||||||
entry->flags = 0;
|
entry->flags = 0;
|
||||||
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
entry->flags = FS_IS_DIR;
|
entry->flags = FS_IS_DIR;
|
||||||
|
|
|
@ -105,7 +105,7 @@ BOOL CALLBACK ViewLightsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
LightsView = new lightsview_struct[1];
|
LightsView = new lightsview_struct;
|
||||||
memset(LightsView, 0, sizeof(lightsview_struct));
|
memset(LightsView, 0, sizeof(lightsview_struct));
|
||||||
LightsView->autoup_secs = 5;
|
LightsView->autoup_secs = 5;
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||||
|
@ -180,5 +180,5 @@ BOOL CALLBACK ViewLightsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,7 +876,7 @@ DWORD WINAPI run()
|
||||||
while(execute)
|
while(execute)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&win_sync);
|
EnterCriticalSection(&win_sync);
|
||||||
cycles = NDS_exec((560190<<1)-cycles,FALSE);
|
cycles = NDS_exec((560190<<1)-cycles);
|
||||||
win_sound_samplecounter = 735;
|
win_sound_samplecounter = 735;
|
||||||
LeaveCriticalSection(&win_sync);
|
LeaveCriticalSection(&win_sync);
|
||||||
|
|
||||||
|
@ -1150,7 +1150,6 @@ static void ExitRunLoop()
|
||||||
execute = FALSE;
|
execute = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hThisInstance,
|
int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
LPSTR lpszArgument,
|
LPSTR lpszArgument,
|
||||||
|
@ -1158,7 +1157,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
||||||
{
|
{
|
||||||
InitializeCriticalSection(&win_sync);
|
InitializeCriticalSection(&win_sync);
|
||||||
|
|
||||||
#ifdef GDB_STUB
|
#ifdef GDB_STUB
|
||||||
gdbstub_handle_t arm9_gdb_stub;
|
gdbstub_handle_t arm9_gdb_stub;
|
||||||
gdbstub_handle_t arm7_gdb_stub;
|
gdbstub_handle_t arm7_gdb_stub;
|
||||||
|
@ -2032,14 +2031,14 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
tpaused=true;
|
tpaused=true;
|
||||||
NDS_Pause();
|
NDS_Pause();
|
||||||
}
|
}
|
||||||
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SOUNDSETTINGS), hwnd, (DLGPROC)SoundSettingsDlgProc);
|
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_SOUNDSETTINGS), hwnd, (DLGPROC)SoundSettingsDlgProc);
|
||||||
if (tpaused)
|
if (tpaused)
|
||||||
NDS_UnPause();
|
NDS_UnPause();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case IDM_GAME_INFO:
|
case IDM_GAME_INFO:
|
||||||
{
|
{
|
||||||
CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_GAME_INFO), hwnd, GinfoView_Proc);
|
CreateDialog(hAppInst, MAKEINTRESOURCE(IDD_GAME_INFO), hwnd, GinfoView_Proc);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,11 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_MODE), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_MODE), text);
|
||||||
|
|
||||||
if(!(bgcnt&(1<<7)))
|
if(!(bgcnt&(1<<7)))
|
||||||
sprintf(text, "normale 16");
|
sprintf(text, "normal 16");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!(dispcnt&(1<<30)))
|
if(!(dispcnt&(1<<30)))
|
||||||
sprintf(text, "normale 256");
|
sprintf(text, "normal 256");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(win->map)
|
switch(win->map)
|
||||||
|
@ -104,6 +104,12 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
sprintf(text, "%d", (int)(bgcnt&3));
|
sprintf(text, "%d", (int)(bgcnt&3));
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
||||||
|
|
||||||
|
|
||||||
|
if((dispcnt>>8>>win->map)&1)
|
||||||
|
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "true");
|
||||||
|
else
|
||||||
|
SetWindowText(GetDlgItem(hwnd, IDC_VISIBLE), "false");
|
||||||
|
|
||||||
sprintf(text, "0x%08X", (int)(0x6000000 + ((bgcnt>>2)&0xF)*0x4000 + win->lcd*0x200000 +((dispcnt>>24)&7)*0x10000));
|
sprintf(text, "0x%08X", (int)(0x6000000 + ((bgcnt>>2)&0xF)*0x4000 + win->lcd*0x200000 +((dispcnt>>24)&7)*0x10000));
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_CHAR), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_CHAR), text);
|
||||||
|
@ -217,11 +223,15 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!MapView && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
MapView = new mapview_struct[1];
|
MapView = new mapview_struct;
|
||||||
memset(MapView, 0, sizeof(MapView));
|
memset(MapView, 0, sizeof(MapView));
|
||||||
MapView->autoup_secs = 5;
|
MapView->autoup_secs = 5;
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||||
|
@ -332,5 +342,5 @@ BOOL CALLBACK ViewMapsProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||||
}//switch
|
}//switch
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ BOOL CALLBACK ViewMatricesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
MatrixView = new matrixview_struct[1];
|
MatrixView = new matrixview_struct;
|
||||||
memset(MatrixView, 0, sizeof(matrixview_struct));
|
memset(MatrixView, 0, sizeof(matrixview_struct));
|
||||||
MatrixView->autoup_secs = 5;
|
MatrixView->autoup_secs = 5;
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||||
|
@ -252,5 +252,5 @@ BOOL CALLBACK ViewMatricesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,19 +200,22 @@ LRESULT CALLBACK ViewMem_ARM7BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CALLBACK ViewMem_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewMem_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!MemView7 && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
SetWindowText(hwnd, "ARM7 memory viewer");
|
SetWindowText(hwnd, "ARM7 memory viewer");
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_8_BIT), BM_SETCHECK, TRUE, 0);
|
SendMessage(GetDlgItem(hwnd, IDC_8_BIT), BM_SETCHECK, TRUE, 0);
|
||||||
MemView7 = new memview_struct[1];
|
MemView7 = new memview_struct;
|
||||||
memset(MemView7, 0, sizeof(memview_struct));
|
memset(MemView7, 0, sizeof(memview_struct));
|
||||||
MemView7->cpu = 1;
|
MemView7->cpu = 1;
|
||||||
MemView7->autoup_secs = 5;
|
MemView7->autoup_secs = 5;
|
||||||
|
@ -324,7 +327,7 @@ bool CALLBACK ViewMem_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================== ARM9
|
//=================================================== ARM9
|
||||||
|
@ -385,12 +388,15 @@ LRESULT CALLBACK ViewMem_ARM9BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CALLBACK ViewMem_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewMem_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!MemView9 && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
|
@ -405,7 +411,7 @@ bool CALLBACK ViewMem_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
||||||
UDM_SETRANGE, 0, MAKELONG(99, 1));
|
UDM_SETRANGE, 0, MAKELONG(99, 1));
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||||
UDM_SETPOS32, 0, MemView9->autoup_secs);
|
UDM_SETPOS32, 0, MemView9->autoup_secs);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
{
|
{
|
||||||
|
@ -509,5 +515,5 @@ bool CALLBACK ViewMem_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM l
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
extern bool CALLBACK ViewMem_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
extern BOOL CALLBACK ViewMem_ARM7Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
extern LRESULT CALLBACK ViewMem_ARM7BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
extern LRESULT CALLBACK ViewMem_ARM7BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
extern bool CALLBACK ViewMem_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
extern BOOL CALLBACK ViewMem_ARM9Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
extern LRESULT CALLBACK ViewMem_ARM9BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
extern LRESULT CALLBACK ViewMem_ARM9BoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -206,11 +206,15 @@ LRESULT CALLBACK ViewOAMBoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||||
|
|
||||||
BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!OAMView && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
OAMView = new oamview_struct[1];
|
OAMView = new oamview_struct;
|
||||||
memset(OAMView, 0, sizeof(oamview_struct));
|
memset(OAMView, 0, sizeof(oamview_struct));
|
||||||
OAMView->oam = (OAM *)(ARM9Mem.ARM9_OAM);
|
OAMView->oam = (OAM *)(ARM9Mem.ARM9_OAM);
|
||||||
OAMView->gpu = MainScreen.gpu;
|
OAMView->gpu = MainScreen.gpu;
|
||||||
|
@ -332,5 +336,5 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,15 @@ LRESULT PalView_OnPaint(const u16 * adr, u16 num, HWND hwnd, WPARAM wParam, LPAR
|
||||||
|
|
||||||
BOOL CALLBACK ViewPalProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewPalProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!PalView && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
PalView = new palview_struct[1];
|
PalView = new palview_struct;
|
||||||
memset(PalView, 0, sizeof(palview_struct));
|
memset(PalView, 0, sizeof(palview_struct));
|
||||||
PalView->adr = (u16 *)ARM9Mem.ARM9_VMEM;
|
PalView->adr = (u16 *)ARM9Mem.ARM9_VMEM;
|
||||||
PalView->autoup_secs = 5;
|
PalView->autoup_secs = 5;
|
||||||
|
@ -287,5 +291,5 @@ BOOL CALLBACK ViewPalProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,7 @@
|
||||||
#define IDC_SCR 806
|
#define IDC_SCR 806
|
||||||
#define IDC_MSIZE 807
|
#define IDC_MSIZE 807
|
||||||
#define IDC_SCROLL 808
|
#define IDC_SCROLL 808
|
||||||
|
#define IDC_PRIO2 809
|
||||||
#define IDD_OAM 900
|
#define IDD_OAM 900
|
||||||
#define IDC_SCR_SELECT 901
|
#define IDC_SCR_SELECT 901
|
||||||
#define IDC_TILE 902
|
#define IDC_TILE 902
|
||||||
|
@ -208,6 +209,7 @@
|
||||||
#define ID_CANCEL 1016
|
#define ID_CANCEL 1016
|
||||||
#define IDSAVE 1017
|
#define IDSAVE 1017
|
||||||
#define IDC_AUTOUPDATE_ASM 1018
|
#define IDC_AUTOUPDATE_ASM 1018
|
||||||
|
#define IDC_VISIBLE 1019
|
||||||
#define IDM_FIRMSETTINGS 1100
|
#define IDM_FIRMSETTINGS 1100
|
||||||
#define IDD_FIRMSETTINGS 1101
|
#define IDD_FIRMSETTINGS 1101
|
||||||
#define IDC_EDIT1 1102
|
#define IDC_EDIT1 1102
|
||||||
|
@ -357,7 +359,7 @@
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 107
|
#define _APS_NEXT_RESOURCE_VALUE 107
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40038
|
#define _APS_NEXT_COMMAND_VALUE 40038
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1019
|
#define _APS_NEXT_CONTROL_VALUE 1020
|
||||||
#define _APS_NEXT_SYMED_VALUE 112
|
#define _APS_NEXT_SYMED_VALUE 112
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ END
|
||||||
|
|
||||||
IDD_TILE DIALOGEX 0, 0, 446, 180
|
IDD_TILE DIALOGEX 0, 0, 446, 180
|
||||||
STYLE DS_SETFONT | DS_CENTER | WS_VISIBLE | WS_CAPTION
|
STYLE DS_SETFONT | DS_CENTER | WS_VISIBLE | WS_CAPTION
|
||||||
CAPTION "TILE Fremvisning"
|
CAPTION "TILE VIEW"
|
||||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
COMBOBOX IDC_PAL_SELECT,4,13,90,14,CBS_DROPDOWN | WS_TABSTOP
|
COMBOBOX IDC_PAL_SELECT,4,13,90,14,CBS_DROPDOWN | WS_TABSTOP
|
||||||
|
@ -1068,22 +1068,23 @@ BEGIN
|
||||||
LTEXT "Mode :",IDC_STATIC,4,20,45,8
|
LTEXT "Mode :",IDC_STATIC,4,20,45,8
|
||||||
LTEXT "Palette :",IDC_STATIC,4,30,45,8
|
LTEXT "Palette :",IDC_STATIC,4,30,45,8
|
||||||
LTEXT "Prio :",IDC_STATIC,4,40,45,8
|
LTEXT "Prio :",IDC_STATIC,4,40,45,8
|
||||||
LTEXT "Char base :",IDC_STATIC,4,50,45,8
|
LTEXT "Char base :",IDC_STATIC,3,61,45,8
|
||||||
LTEXT "Screen base :",IDC_STATIC,4,60,45,8
|
LTEXT "Screen base :",IDC_STATIC,3,71,45,8
|
||||||
LTEXT "Size :",IDC_STATIC,4,70,45,8
|
LTEXT "Size :",IDC_STATIC,3,81,45,8
|
||||||
LTEXT "Scroll :",IDC_STATIC,4,80,45,8
|
LTEXT "Scroll :",IDC_STATIC,3,91,45,8
|
||||||
LTEXT "",IDC_MODE,48,20,85,8
|
LTEXT "",IDC_MODE,48,20,85,8
|
||||||
LTEXT "",IDC_PAL,48,30,85,8
|
LTEXT "",IDC_PAL,48,30,85,8
|
||||||
LTEXT "",IDC_PRIO,48,40,85,8
|
LTEXT "",IDC_PRIO,48,40,85,8
|
||||||
LTEXT "",IDC_CHAR,48,50,85,8
|
LTEXT "",IDC_VISIBLE,48,50,62,8
|
||||||
LTEXT "",IDC_SCR,48,60,85,8
|
LTEXT "",IDC_SCR,48,60,85,8
|
||||||
LTEXT "",IDC_MSIZE,48,70,85,8
|
LTEXT "",IDC_MSIZE,48,70,85,8
|
||||||
LTEXT "",IDC_SCROLL,48,80,85,8
|
LTEXT "",IDC_SCROLL,48,80,85,8
|
||||||
PUSHBUTTON "&Close",IDC_FERMER,4,300,50,14
|
PUSHBUTTON "&Close",IDC_FERMER,4,300,50,14
|
||||||
CONTROL "&Auto-update",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,92,54,14
|
CONTROL "&Auto-update",IDC_AUTO_UPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,102,54,14
|
||||||
EDITTEXT IDC_AUTO_UPDATE_SECS,59,93,12,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
|
EDITTEXT IDC_AUTO_UPDATE_SECS,59,103,12,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
|
||||||
CONTROL "",IDC_AUTO_UPDATE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,71,93,11,14
|
CONTROL "",IDC_AUTO_UPDATE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,71,103,11,14
|
||||||
LTEXT "secs",IDC_STATIC,83,96,16,8
|
LTEXT "secs",IDC_STATIC,83,106,16,8
|
||||||
|
LTEXT "Visible :",IDC_STATIC,4,50,38,8
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_OAM DIALOGEX 0, 0, 300, 200
|
IDD_OAM DIALOGEX 0, 0, 300, 200
|
||||||
|
|
|
@ -314,6 +314,10 @@ LRESULT CALLBACK MiniTileViewBoxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
BOOL CALLBACK ViewTilesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK ViewTilesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
//bail out early if the dialog isnt initialized
|
||||||
|
if(!TileView && message != WM_INITDIALOG)
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
|
@ -628,5 +632,5 @@ BOOL CALLBACK ViewTilesProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue