diff --git a/desmume/src/ARM9.h b/desmume/src/ARM9.h index be45f6a33..1208358ef 100644 --- a/desmume/src/ARM9.h +++ b/desmume/src/ARM9.h @@ -7,7 +7,7 @@ struct ALIGN(16) ARM9_struct { //ARM9 mem u8 ARM9_ITCM[0x8000]; u8 ARM9_DTCM[0x4000]; - u8 MAIN_MEM[0x400000]; + u8 MAIN_MEM[0x800000]; //this has been expanded to 8MB to support debug consoles u8 ARM9_REG[0x1000000]; u8 ARM9_BIOS[0x8000]; u8 ARM9_VMEM[0x800]; diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 80e54c02f..5632d5840 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -369,23 +369,23 @@ u32 DMADst[2][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}}; void MMU_clearMem() { - memset(ARM9Mem.ARM9_ABG, 0, 0x080000); - memset(ARM9Mem.ARM9_AOBJ, 0, 0x040000); - memset(ARM9Mem.ARM9_BBG, 0, 0x020000); - memset(ARM9Mem.ARM9_BOBJ, 0, 0x020000); + memset(ARM9Mem.ARM9_ABG, 0, sizeof(ARM9Mem.ARM9_ABG)); + memset(ARM9Mem.ARM9_AOBJ, 0, sizeof(ARM9Mem.ARM9_AOBJ)); + memset(ARM9Mem.ARM9_BBG, 0, sizeof(ARM9Mem.ARM9_BBG)); + memset(ARM9Mem.ARM9_BOBJ, 0, sizeof(ARM9Mem.ARM9_BOBJ)); - memset(ARM9Mem.ARM9_DTCM, 0, 0x4000); - memset(ARM9Mem.ARM9_ITCM, 0, 0x8000); - memset(ARM9Mem.ARM9_LCD, 0, 0x0A4000); - memset(ARM9Mem.ARM9_OAM, 0, 0x0800); - memset(ARM9Mem.ARM9_REG, 0, 0x01000000); - memset(ARM9Mem.ARM9_VMEM, 0, 0x0800); + memset(ARM9Mem.ARM9_DTCM, 0, sizeof(ARM9Mem.ARM9_DTCM)); + memset(ARM9Mem.ARM9_ITCM, 0, sizeof(ARM9Mem.ARM9_ITCM)); + memset(ARM9Mem.ARM9_LCD, 0, sizeof(ARM9Mem.ARM9_LCD)); + memset(ARM9Mem.ARM9_OAM, 0, sizeof(ARM9Mem.ARM9_OAM)); + memset(ARM9Mem.ARM9_REG, 0, sizeof(ARM9Mem.ARM9_REG)); + memset(ARM9Mem.ARM9_VMEM, 0, sizeof(ARM9Mem.ARM9_VMEM)); memset(ARM9Mem.MAIN_MEM, 0, sizeof(ARM9Mem.MAIN_MEM)); - memset(ARM9Mem.blank_memory, 0, 0x020000); + memset(ARM9Mem.blank_memory, 0, sizeof(ARM9Mem.blank_memory)); - memset(MMU.ARM7_ERAM, 0, 0x010000); - memset(MMU.ARM7_REG, 0, 0x010000); + memset(MMU.ARM7_ERAM, 0, sizeof(MMU.ARM7_ERAM)); + memset(MMU.ARM7_REG, 0, sizeof(MMU.ARM7_REG)); IPC_FIFOinit(ARMCPU_ARM9); IPC_FIFOinit(ARMCPU_ARM7); diff --git a/desmume/src/MMU.h b/desmume/src/MMU.h index a248677a7..9a3f35d22 100644 --- a/desmume/src/MMU.h +++ b/desmume/src/MMU.h @@ -204,6 +204,12 @@ u8 FASTCALL _MMU_ARM7_read08(u32 adr); u16 FASTCALL _MMU_ARM7_read16(u32 adr); u32 FASTCALL _MMU_ARM7_read32(u32 adr); +//in debug builds we have twice as much memory +#ifdef DEVELOPER +#define _MMU_MAIN_MEM_MASK 0x7FFFFF +#else +#define _MMU_MAIN_MEM_MASK 0x3FFFFF +#endif FORCEINLINE u8 _MMU_read08(const int PROCNUM, u32 addr) { if(PROCNUM==ARMCPU_ARM9) @@ -214,7 +220,7 @@ FORCEINLINE u8 _MMU_read08(const int PROCNUM, u32 addr) { } if ( (addr & 0x0F000000) == 0x02000000) - return T1ReadByte( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF); + return T1ReadByte( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK); if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read08(addr); else return _MMU_ARM7_read08(addr); @@ -229,7 +235,7 @@ FORCEINLINE u16 _MMU_read16(const int PROCNUM, u32 addr) { } if ( (addr & 0x0F000000) == 0x02000000) - return T1ReadWord( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF); + return T1ReadWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK); if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read16(addr); else return _MMU_ARM7_read16(addr); @@ -244,7 +250,7 @@ FORCEINLINE u32 _MMU_read32(int PROCNUM, u32 addr) { } if ( (addr & 0x0F000000) == 0x02000000) - return T1ReadLong( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF); + return T1ReadLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK); if(PROCNUM==ARMCPU_ARM9) return _MMU_ARM9_read32(addr); else return _MMU_ARM7_read32(addr); @@ -259,7 +265,7 @@ FORCEINLINE void _MMU_write08(const int PROCNUM, u32 addr, u8 val) { } if ( (addr & 0x0F000000) == 0x02000000) { - T1WriteByte( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val); + T1WriteByte( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val); return; } @@ -276,7 +282,7 @@ FORCEINLINE void _MMU_write16(const int PROCNUM, u32 addr, u16 val) { } if ( (addr & 0x0F000000) == 0x02000000) { - T1WriteWord( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val); + T1WriteWord( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val); return; } @@ -293,7 +299,7 @@ FORCEINLINE void _MMU_write32(const int PROCNUM, u32 addr, u32 val) { } if ( (addr & 0x0F000000) == 0x02000000) { - T1WriteLong( ARM9Mem.MAIN_MEM, addr & 0x3FFFFF, val); + T1WriteLong( ARM9Mem.MAIN_MEM, addr & _MMU_MAIN_MEM_MASK, val); return; } diff --git a/desmume/src/bios.cpp b/desmume/src/bios.cpp index 86fd9869e..ba78e588b 100644 --- a/desmume/src/bios.cpp +++ b/desmume/src/bios.cpp @@ -1032,6 +1032,17 @@ TEMPLATE static u32 getCRC16() return 1; } +TEMPLATE static u32 isDebugger() +{ + //gbatek has additional specifications which are not emulated here +#ifdef DEVELOPER + cpu->R[0] = 1; +#else + cpu->R[0] = 0; +#endif + return 1; +} + TEMPLATE static u32 SoundBias() { u32 current = SPU_ReadLong(0x4000504); @@ -1066,7 +1077,7 @@ u32 (* ARM9_swi_tab[32])()={ fastCopy, // 0x0C bios_sqrt, // 0x0D getCRC16, // 0x0E - bios_nop, // 0x0F + isDebugger, // 0x0F BitUnPack, // 0x10 LZ77UnCompWram, // 0x11 LZ77UnCompVram, // 0x12 @@ -1101,7 +1112,7 @@ u32 (* ARM7_swi_tab[32])()={ fastCopy, // 0x0C bios_sqrt, // 0x0D getCRC16, // 0x0E - bios_nop, // 0x0F + isDebugger, // 0x0F BitUnPack, // 0x10 LZ77UnCompWram, // 0x11 LZ77UnCompVram, // 0x12 diff --git a/desmume/src/debug.h b/desmume/src/debug.h index da6082105..b77804fd7 100644 --- a/desmume/src/debug.h +++ b/desmume/src/debug.h @@ -52,7 +52,7 @@ public: static void log(unsigned int channel, const char * file, unsigned int line, void (*callback)(const Logger& logger, const char * message)); }; -#if defined(DEBUG) || defined(GPUDEBUG) || defined(DIVDEBUG) || defined(SQRTDEBUG) || defined(DMADEBUG) || defined(WANTPROGINFO) +#if defined(DEBUG) || defined(GPUDEBUG) || defined(DIVDEBUG) || defined(SQRTDEBUG) || defined(DMADEBUG) || defined(DEVELOPER) #define LOGC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__) #else #define LOGC(...) @@ -101,7 +101,7 @@ public: #endif -#ifdef WANTPROGINFO +#ifdef DEVELOPER #define PROGINFO(...) LOGC(7, __VA_ARGS__) #else #define PROGINFO(...) diff --git a/desmume/src/saves.cpp b/desmume/src/saves.cpp index 0d0ba9669..21a04e879 100644 --- a/desmume/src/saves.cpp +++ b/desmume/src/saves.cpp @@ -131,7 +131,11 @@ SFORMAT SF_ARM9[]={ SFORMAT SF_MEM[]={ { "ITCM", 1, 0x8000, ARM9Mem.ARM9_ITCM}, { "DTCM", 1, 0x4000, ARM9Mem.ARM9_DTCM}, - { "WRAM", 1, sizeof(ARM9Mem.MAIN_MEM), ARM9Mem.MAIN_MEM}, + { "WRAM", 1, 0x400000, ARM9Mem.MAIN_MEM}, +#ifdef DEVELOPER + //expanded memory is only saved and loaded if this is a debug console + { "WRAX", 1, 0x400000, ARM9Mem.MAIN_MEM+0x400000}, +#endif //NOTE - this is not as large as the allocated memory. //the memory is overlarge due to the way our memory map system is setup diff --git a/desmume/src/types.h b/desmume/src/types.h index 1028e7fe2..877d90334 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -20,6 +20,11 @@ #ifndef TYPES_HPP #define TYPES_HPP +//-------------- +//configuration +//#define DEVELOPER +//-------------- + #define DESMUME_NAME "DeSmuME" #ifdef _WIN64 @@ -38,6 +43,12 @@ #define DESMUME_CPUEXT_STRING "" #endif +#ifdef DEVELOPER +#define DESMUME_FEATURE_STRING " dev+" +#else +#define DESMUME_FEATURE_STRING "" +#endif + #ifdef DEBUG #define DESMUME_SUBVERSION_STRING " debug" #else @@ -50,13 +61,22 @@ #ifdef __INTEL_COMPILER #define DESMUME_COMPILER " (Intel) " +#define DESMUME_COMPILER_DETAIL " (Intel) " +#elif _MSC_VER +#define DESMUME_COMPILER "" +#define DESMUME_COMPILER_DETAIL " msvc " _Py_STRINGIZE(_MSC_VER) +#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X)) +#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X +#define _Py_STRINGIZE2(X) #X +//re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5 #else // TODO: make for others compilers #define DESMUME_COMPILER "" +#define DESMUME_COMPILER_DETAIL "" #endif #define DESMUME_VERSION_NUMERIC 90200 -#define DESMUME_VERSION_STRING " " "0.9.2" DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_SUBVERSION_STRING DESMUME_COMPILER +#define DESMUME_VERSION_STRING " " "0.9.2" DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_SUBVERSION_STRING DESMUME_COMPILER #define DESMUME_NAME_AND_VERSION " " DESMUME_NAME DESMUME_VERSION_STRING #ifdef _WIN32 diff --git a/desmume/src/windows/AboutBox.cpp b/desmume/src/windows/AboutBox.cpp index 7f43b47fe..567b9c7f6 100644 --- a/desmume/src/windows/AboutBox.cpp +++ b/desmume/src/windows/AboutBox.cpp @@ -66,7 +66,7 @@ BOOL CALLBACK AboutBox_Proc (HWND dialog, UINT message,WPARAM wparam,LPARAM lpar { char buf[2048]; memset(buf, 0, sizeof(buf)); - wsprintf(buf, "version %s", DESMUME_VERSION_STRING); + wsprintf(buf, "version %s", DESMUME_VERSION_STRING DESMUME_COMPILER_DETAIL); SetDlgItemText(dialog, IDC_TXT_VERSION, buf); memset(buf, 0, sizeof(buf));