diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index a9816ad5..651de0ae 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -895,38 +895,38 @@ Bit32u GetHexValue(char* str, char*& hex) Bit32u regval = 0; hex = str; while (*hex==' ') hex++; - if (strstr(hex,"EAX")==hex) { hex+=3; regval = reg_eax; }; - if (strstr(hex,"EBX")==hex) { hex+=3; regval = reg_ebx; }; - if (strstr(hex,"ECX")==hex) { hex+=3; regval = reg_ecx; }; - if (strstr(hex,"EDX")==hex) { hex+=3; regval = reg_edx; }; - if (strstr(hex,"ESI")==hex) { hex+=3; regval = reg_esi; }; - if (strstr(hex,"EDI")==hex) { hex+=3; regval = reg_edi; }; - if (strstr(hex,"EBP")==hex) { hex+=3; regval = reg_ebp; }; - if (strstr(hex,"ESP")==hex) { hex+=3; regval = reg_esp; }; - if (strstr(hex,"EIP")==hex) { hex+=3; regval = reg_eip; }; - if (strstr(hex,"AX")==hex) { hex+=2; regval = reg_ax; }; - if (strstr(hex,"BX")==hex) { hex+=2; regval = reg_bx; }; - if (strstr(hex,"CX")==hex) { hex+=2; regval = reg_cx; }; - if (strstr(hex,"DX")==hex) { hex+=2; regval = reg_dx; }; - if (strstr(hex,"SI")==hex) { hex+=2; regval = reg_si; }; - if (strstr(hex,"DI")==hex) { hex+=2; regval = reg_di; }; - if (strstr(hex,"BP")==hex) { hex+=2; regval = reg_bp; }; - if (strstr(hex,"SP")==hex) { hex+=2; regval = reg_sp; }; - if (strstr(hex,"IP")==hex) { hex+=2; regval = reg_ip; }; - if (strstr(hex,"CS")==hex) { hex+=2; regval = SegValue(cs); }; - if (strstr(hex,"DS")==hex) { hex+=2; regval = SegValue(ds); }; - if (strstr(hex,"ES")==hex) { hex+=2; regval = SegValue(es); }; - if (strstr(hex,"FS")==hex) { hex+=2; regval = SegValue(fs); }; - if (strstr(hex,"GS")==hex) { hex+=2; regval = SegValue(gs); }; + if (strstr(hex,"EAX")==hex) { hex+=3; regval = reg_eax; } else + if (strstr(hex,"EBX")==hex) { hex+=3; regval = reg_ebx; } else + if (strstr(hex,"ECX")==hex) { hex+=3; regval = reg_ecx; } else + if (strstr(hex,"EDX")==hex) { hex+=3; regval = reg_edx; } else + if (strstr(hex,"ESI")==hex) { hex+=3; regval = reg_esi; } else + if (strstr(hex,"EDI")==hex) { hex+=3; regval = reg_edi; } else + if (strstr(hex,"EBP")==hex) { hex+=3; regval = reg_ebp; } else + if (strstr(hex,"ESP")==hex) { hex+=3; regval = reg_esp; } else + if (strstr(hex,"EIP")==hex) { hex+=3; regval = reg_eip; } else + if (strstr(hex,"AX")==hex) { hex+=2; regval = reg_ax; } else + if (strstr(hex,"BX")==hex) { hex+=2; regval = reg_bx; } else + if (strstr(hex,"CX")==hex) { hex+=2; regval = reg_cx; } else + if (strstr(hex,"DX")==hex) { hex+=2; regval = reg_dx; } else + if (strstr(hex,"SI")==hex) { hex+=2; regval = reg_si; } else + if (strstr(hex,"DI")==hex) { hex+=2; regval = reg_di; } else + if (strstr(hex,"BP")==hex) { hex+=2; regval = reg_bp; } else + if (strstr(hex,"SP")==hex) { hex+=2; regval = reg_sp; } else + if (strstr(hex,"IP")==hex) { hex+=2; regval = reg_ip; } else + if (strstr(hex,"CS")==hex) { hex+=2; regval = SegValue(cs); } else + if (strstr(hex,"DS")==hex) { hex+=2; regval = SegValue(ds); } else + if (strstr(hex,"ES")==hex) { hex+=2; regval = SegValue(es); } else + if (strstr(hex,"FS")==hex) { hex+=2; regval = SegValue(fs); } else + if (strstr(hex,"GS")==hex) { hex+=2; regval = SegValue(gs); } else if (strstr(hex,"SS")==hex) { hex+=2; regval = SegValue(ss); }; while (*hex) { if ((*hex>='0') && (*hex<='9')) value = (value<<4)+*hex-'0'; else if ((*hex>='A') && (*hex<='F')) value = (value<<4)+*hex-'A'+10; else { - if(*hex == '+') {hex++;return regval + value + GetHexValue(hex,hex); }; - if(*hex == '-') {hex++;return regval + value - GetHexValue(hex,hex); }; - break; // No valid char + if (*hex == '+') {hex++;return regval + value + GetHexValue(hex,hex); } else + if (*hex == '-') {hex++;return regval + value - GetHexValue(hex,hex); } + else break; // No valid char } hex++; }; @@ -1534,8 +1534,23 @@ char* AnalyzeInstruction(char* inst, bool saveSelector) { Bit32u DEBUG_CheckKeys(void) { Bits ret=0; + bool numberrun = false; int key=getch(); - if (key>0) { + + if (key >='1' && key <='5' && strlen(codeViewData.inputStr) == 0) { + const Bit32s v[] ={5,500,1000,5000,10000}; + CPU_Cycles= v[key - '1']; + + ret = (*cpudecoder)(); + SetCodeWinStart(); + CBreakpoint::ignoreOnce = 0; + + /* Setup variables so we end up at the proper ret processing */ + numberrun = true; + key = -1; + } + + if (key>0 || numberrun) { #if defined(WIN32) && defined(__PDCURSES__) switch (key) { case PADENTER: key=0x0A; break; @@ -2481,6 +2496,7 @@ bool DEBUG_HeavyIsBreakpoint(void) { cpuLogCounter--; } if (cpuLogCounter<=0) { + cpuLogFile.flush(); cpuLogFile.close(); DEBUG_ShowMsg("DEBUG: cpu log LOGCPU.TXT created\n"); cpuLog = false;