- [FIX] Al fer break on interrupt de vegades se passava de instruccions
- [NEW] el analitzador pot mostrar les instruccions repetides des de l'ultim estat - [NEW] gestió de opcodes usats
This commit is contained in:
75
z80debug.cpp
75
z80debug.cpp
@@ -62,6 +62,8 @@ namespace z80debug
|
||||
|
||||
uint16_t cursor = 0;
|
||||
|
||||
uint8_t use[7][256];
|
||||
|
||||
char temp[256];
|
||||
const char *tohex(int value, int numdigits)
|
||||
{
|
||||
@@ -106,12 +108,15 @@ namespace z80debug
|
||||
} else if (e->key.keysym.scancode==SDL_SCANCODE_F1) {
|
||||
z80debug::history::gototop();
|
||||
z80debug::refresh();
|
||||
z80analyze::refresh();
|
||||
} else if (e->key.keysym.scancode==SDL_SCANCODE_F2) {
|
||||
z80debug::history::goback();
|
||||
z80debug::refresh();
|
||||
z80analyze::refresh();
|
||||
} else if (e->key.keysym.scancode==SDL_SCANCODE_F3) {
|
||||
z80debug::history::goforward();
|
||||
z80debug::refresh();
|
||||
z80analyze::refresh();
|
||||
/*} else if (e->key.keysym.scancode==SDL_SCANCODE_F6) {
|
||||
z80debug::history::gototop();
|
||||
const uint8_t dt = z80::step();
|
||||
@@ -217,6 +222,7 @@ namespace z80debug
|
||||
tex = ui::createtexture(ren);
|
||||
}
|
||||
focus();
|
||||
z80analyze::refresh();
|
||||
}
|
||||
|
||||
void focus()
|
||||
@@ -611,9 +617,11 @@ namespace z80debug
|
||||
|
||||
if (strcmp(cmd, "s")==0 || strcmp(cmd, "step")==0) {
|
||||
z80::step();
|
||||
z80analyze::refresh();
|
||||
} else if (strcmp(cmd, "c")==0 || strcmp(cmd, "cont")==0) {
|
||||
z80::step();
|
||||
z80debug::cont();
|
||||
z80analyze::refresh();
|
||||
} else if (strcmp(cmd, "r")==0 || strcmp(cmd, "reset")==0) {
|
||||
uint8_t *mem = z80::getMem();
|
||||
for (int i=0x4000; i<=0xffff; ++i) mem[i]=0;
|
||||
@@ -621,6 +629,7 @@ namespace z80debug
|
||||
z80::connect_port(0xfe, zx_ula::port_in, zx_ula::port_out);
|
||||
//for (int i=0; i<65536; ++i) breakpoints[i]=0;
|
||||
z80debug::refresh();
|
||||
z80analyze::refresh();
|
||||
} else if (strcmp(cmd, "b")==0 || strcmp(cmd, "break")==0) {
|
||||
getcmd();
|
||||
if (cmd[0] == 0) { breakpoints[z80::getPC()]=1; return; }
|
||||
@@ -682,6 +691,7 @@ namespace z80debug
|
||||
//strcpy(address, cmd);
|
||||
//loadngo(filename, address);
|
||||
loadstate(filename);
|
||||
z80analyze::refresh();
|
||||
} else if (strcmp(cmd, "t")==0 || strcmp(cmd, "tape")==0) {
|
||||
getcmd();
|
||||
if (strcmp(cmd, "load")==0) {
|
||||
@@ -759,6 +769,17 @@ namespace z80debug
|
||||
sendToConsoleLog("Keyup sent for key: ");
|
||||
sendMoreToConsoleLog(cmd);
|
||||
}
|
||||
} else if (strcmp(cmd, "opcodes")==0) {
|
||||
getcmd();
|
||||
if (strcmp(cmd, "clear")==0 || strcmp(cmd, "reset")==0) {
|
||||
clearUsedOpcodes();
|
||||
} else if (strcmp(cmd, "mark")==0) {
|
||||
markUsedOpcodes();
|
||||
} else if (strcmp(cmd, "count")==0) {
|
||||
printf("Num opcodes used: %i\n", getNumOpcodesUsed());
|
||||
} else if (strcmp(cmd, "print")==0) {
|
||||
printOpcodesUsed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,6 +852,60 @@ namespace z80debug
|
||||
cursor = find_previous_opcode(cursor);
|
||||
}
|
||||
|
||||
void useOpcode(const uint8_t opcode, const uint8_t base)
|
||||
{
|
||||
if (use[base][opcode]<255) use[base][opcode]++;
|
||||
}
|
||||
|
||||
void clearUsedOpcodes()
|
||||
{
|
||||
for (int i=0; i<7; ++i) {
|
||||
for (int j=0; j<256; ++j) {
|
||||
use[i][j]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void markUsedOpcodes()
|
||||
{
|
||||
for (int i=0; i<7; ++i) {
|
||||
for (int j=0; j<256; ++j) {
|
||||
if (use[i][j]==1) use[i][j]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int getNumOpcodesUsed()
|
||||
{
|
||||
int count = 0;
|
||||
for (int i=0; i<7; ++i) {
|
||||
for (int j=0; j<256; ++j) {
|
||||
if (use[i][j]==1) count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void printOpcodesUsed()
|
||||
{
|
||||
for (int i=0; i<7; ++i) {
|
||||
for (int j=0; j<256; ++j) {
|
||||
if (use[i][j]==1) {
|
||||
switch (i) {
|
||||
case 1: printf("ED "); break;
|
||||
case 2: printf("CB "); break;
|
||||
case 3: printf("DD "); break;
|
||||
case 4: printf("DD CB "); break;
|
||||
case 5: printf("FD "); break;
|
||||
case 6: printf("FD CB "); break;
|
||||
}
|
||||
printf("%2X\n",j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace history
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user