diff --git a/Contrib/at67/PucMon.gt1 b/Contrib/at67/PucMon.gt1 new file mode 100644 index 000000000..07341ba11 Binary files /dev/null and b/Contrib/at67/PucMon.gt1 differ diff --git a/Contrib/at67/RUNPUCMON.sh b/Contrib/at67/RUNPUCMON.sh new file mode 100755 index 000000000..1bfbf8a96 --- /dev/null +++ b/Contrib/at67/RUNPUCMON.sh @@ -0,0 +1 @@ +./gtemuAT67 PucMon.gt1 2> logpucmon2.txt diff --git a/Contrib/at67/cpu.cpp b/Contrib/at67/cpu.cpp index 1092157cf..199bee79a 100644 --- a/Contrib/at67/cpu.cpp +++ b/Contrib/at67/cpu.cpp @@ -53,6 +53,8 @@ namespace Cpu std::vector _RAM; uint8_t _ROM[ROM_SIZE][2]; + uint64_t _ROMexecutionCount[ROM_SIZE]; + uint64_t _IRexecutionCount[256]; std::vector _romFiles; RomType _romType = ROMERR; std::map _romTypeMap = {{"ROMV1", ROMv1}, {"ROMV2", ROMv2}, {"ROMV3", ROMv3}, {"ROMV4", ROMv4}, {"ROMV5A", ROMv5a}, {"DEVROM", DEVROM}}; @@ -85,7 +87,7 @@ namespace Cpu } -//#define COLLECT_INST_STATS +#define COLLECT_INST_STATS #if defined(COLLECT_INST_STATS) struct InstCount { @@ -104,6 +106,7 @@ namespace Cpu return (a._count > b._count); }); + fprintf(stderr, "\n**ORIGINAL STATS\n"); for(int i=0; i<_instCounts.size(); i++) { float percent = float(_instCounts[i]._count)/float(_totalCount)*100.0f; @@ -116,6 +119,21 @@ namespace Cpu fprintf(stderr, "Total instructions:%lld\n", _totalCount); fprintf(stderr, "Total percentage:%f\n", _totalPercent); + + //-- + + fprintf(stderr, "\n**NATIVE INSTRUCTIONS\n"); + for(int i=0; i<256; i++) + { + fprintf(stderr, "%02x %09lld\n", i, _IRexecutionCount[i]); + } + + fprintf(stderr, "\n**ROM ADDRESSES\n"); + for(int i=0; i, only works in windowed mode -Height = 480 ; Desktop or , only works in windowed mode -ScaleX = 1.5 ; , only works in windowed mode -ScaleY = 1.5 ; , only works in windowed mode -PosX = 40 ; , only works in windowed mode -PosY = 40 ; , only works in windowed mode +[Monitor] ; case sensitive +Fullscreen = 0 ; windowed = 0, fullscreen = 1 +Resizable = 1 ; disable/enable resizable, only works in windowed mode +Borderless = 0 ; disable/enable borderless, only works in windowed mode and overrides Resizable +VSync = 0 ; disable/enable VSync, (not normally of value to enable) +FixedSize = 0 ; disable/enable monitor independant size, ignores everything except Width and Height +Filter = 0 ; 0=Nearest, 1=Linear, 2=Best +Width = 640 ; Desktop or , only works in windowed mode +Height = 480 ; Desktop or , only works in windowed mode +ScaleX = 1 ; , only works in windowed mode +ScaleY = 1 ; , only works in windowed mode +PosX = 40 ; , only works in windowed mode +PosY = 40 ; , only works in windowed mode diff --git a/Contrib/at67/image.cpp b/Contrib/at67/image.cpp index 985a2fb09..b5aa21675 100644 --- a/Contrib/at67/image.cpp +++ b/Contrib/at67/image.cpp @@ -10,6 +10,7 @@ #ifndef STAND_ALONE #include "editor.h" +#include "loader.h" #include "graphics.h" #include "menu.h" #include "terminal.h" @@ -806,6 +807,10 @@ namespace Image // Quit else if(keyCode == Editor::getEmulatorScanCode("Quit") && keyMod == Editor::getEmulatorKeyMod("Quit")) { + + //TEMP! + Loader::saveInstructionStatisticsFiles("memory_statistics_log.txt", "instruction_statistics_log.txt"); + Cpu::shutdown(); exit(0); } @@ -821,6 +826,11 @@ namespace Image _firstTimeRender = true; Terminal::switchToTerminal(); } + // Statistics logs + else if(keyCode == Editor::getEmulatorScanCode("DumpStatisctics") && keyMod == Editor::getEmulatorKeyMod("DumpStatistics")) + { + Loader::saveInstructionStatisticsFiles("memory_statistics_log.txt", "instruction_statistics_log.txt"); + } } void handleKeyUp(SDL_Keycode keyCode, Uint16 keyMod) diff --git a/Contrib/at67/input_config.ini b/Contrib/at67/input_config.ini index cd6bfe04b..f1232471a 100644 --- a/Contrib/at67/input_config.ini +++ b/Contrib/at67/input_config.ini @@ -5,20 +5,21 @@ ; Left Mouse Button to compile/execute current file in Browser on Emulator ; Right Mouse Button to compile/execute current file in Browser on Hardware -[Emulator] ; case sensitive -MemoryMode = CTRL+M ; toggles between RAM, ROM0 and ROM1 -MemorySize = CTRL+Z ; toggles between 32K RAM and 64K RAM -Browse = CTRL+B ; file browser -RomType = CTRL+R ; ROM browser -HexMonitor = CTRL+X ; hex monitor -Disassembler = CTRL+D ; disassembler, (vCPU or Native based on MemoryMode) -Terminal = CTRL+T ; basic serial terminal for talking to hardware -ImageEditor = CTRL+I ; basic image editor for editing graphic images -AudioEditor = CTRL+A ; basic audio editor for editing sample waveforms -ScanlineMode = CTRL+S ; toggles scanline modes, Normal, VideoB and VideoBC -Reset = CTRL+F1 ; emulator reset -Help = CTRL+H ; toggles help screen on and off -Quit = CTRL+Q ; instant quit +[Emulator] ; case sensitive +MemoryMode = CTRL+M ; toggles between RAM, ROM0 and ROM1 +MemorySize = CTRL+Z ; toggles between 32K RAM and 64K RAM +Browse = CTRL+B ; file browser +RomType = CTRL+R ; ROM browser +HexMonitor = CTRL+X ; hex monitor +Disassembler = CTRL+D ; disassembler, (vCPU or Native based on MemoryMode) +Terminal = CTRL+T ; basic serial terminal for talking to hardware +ImageEditor = CTRL+I ; basic image editor for editing graphic images +AudioEditor = CTRL+A ; basic audio editor for editing sample waveforms +ScanlineMode = CTRL+S ; toggles scanline modes, Normal, VideoB and VideoBC +Reset = CTRL+F1 ; emulator reset +Help = CTRL+H ; toggles help screen on and off +Quit = CTRL+Q ; instant quit +DumpStatistics = CTRL+N ; write statistics about instruction execution (addresses and instruction counts) [Keyboard] ; case sensitive Mode = CTRL+K ; toggles between, Giga, PS2, HwGiga and HwPS2 @@ -27,9 +28,9 @@ Right = D ; right input for emulator/hardware depending on Mode Up = W ; up input for emulator/hardware depending on Mode Down = S ; down input for emulator/hardware depending on Mode Start = SPACE ; start input for emulator/hardware depending on Mode -Select = Z ; select input for emulator/hardware depending on Mode -A = . ; A input for emulator/hardware depending on Mode -B = / ; B input for emulator/hardware depending on Mode +Select = I ; select input for emulator/hardware depending on Mode +A = O ; A input for emulator/hardware depending on Mode +B = P ; B input for emulator/hardware depending on Mode [Hardware] ; case sensitive Reset = CTRL+F2 ; resets hardware @@ -39,4 +40,4 @@ Debug = CTRL+F6 ; toggles debugging mode, can be used to pause RunToBrk = CTRL+F7 ; run to breakpoint, does nada if no breakpoints exist StepPC = CTRL+F8 ; single steps debugger based on vPC or native PC StepWatch = CTRL+F9 ; single steps debugger based on a watched variable - ; by default is videoY which changes once per scanline \ No newline at end of file + ; by default is videoY which changes once per scanline diff --git a/Contrib/at67/loader.cpp b/Contrib/at67/loader.cpp index 3ecd0fa6c..e6a95788c 100644 --- a/Contrib/at67/loader.cpp +++ b/Contrib/at67/loader.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +using namespace std; #ifdef _WIN32 #include @@ -335,6 +337,41 @@ namespace Loader return totalSize; } + bool saveInstructionStatisticsFiles(std::string const& filenameMemory, std::string const& filenameInstr) + { + std::ofstream outfileMemory(filenameMemory, std::ios::out); + if(!outfileMemory.is_open()) + { + fprintf(stderr, "Loader::saveInstructionStatisticsFiles() : failed to open '%s'\n", filenameMemory.c_str()); + return false; + } + std::ofstream outfileInstr(filenameInstr, std::ios::out); + if(!outfileInstr.is_open()) + { + fprintf(stderr, "Loader::saveInstructionStatisticsFiles() : failed to open '%s'\n", filenameInstr.c_str()); + return false; + } + + // temp to debug... + ofstream ofs("/tmp/gigatrontmplogfile.txt"); + clog.rdbuf(ofs.rdbuf()); + + clog << "\n**ROM ADDRESSES**\n"; + for(int i=0; i