- [NEW] F12 to StepOut() on debugger (break on RET, RETI or RETN)

- [FIX] Fixed visualizacion of some IX and IY opcodes
- [NEW] Scroll on memory viewer with mouse wheel
- [NEW] While debugging, on each step the screen refreshes, so screen redraw can be seen while happening
- [NEW] Search for sequences of bytes. Example: "search AB1140" to search for the sequece $AB $11 $40. "search next" to continue searching.
This commit is contained in:
2024-12-14 20:46:46 +01:00
parent 14d047cbb9
commit 0a758bbb33
7 changed files with 124 additions and 8 deletions

View File

@@ -69,6 +69,10 @@ namespace z80debug
int num_breakpoint_lines=0;
bool sync_mem_with_cursor = false;
uint8_t search_sequence[32];
int search_sequence_len=0;
uint16_t search_pos=0;
char temp[256];
const char *tohex(int value, int numdigits)
{
@@ -105,6 +109,14 @@ namespace z80debug
z80debug::cursorfwd();
z80debug::refresh();
}
} else if (e->wheel.mouseX<midx*CHR_W && e->wheel.mouseY>=mem_y*CHR_H && e->wheel.mouseY<con_y*CHR_H) {
if (e->wheel.y>0) {
mem_viewer_pos+=0x10;
z80debug::refresh();
} else if (e->wheel.y<0) {
mem_viewer_pos-=0x10;
z80debug::refresh();
}
}
}
if (e->type == SDL_KEYDOWN) {
@@ -294,6 +306,7 @@ namespace z80debug
//history::gototop();
zxscreen::setTitle(" (stopped)");
pause();
z80::resetStackedCalls();
is_debugging = true;
show();
/*refresh();*/
@@ -692,7 +705,10 @@ namespace z80debug
getcmd();
if (strcmp(cmd, "s")==0 || strcmp(cmd, "step")==0) {
z80::step();
uint8_t dt = z80::step();
zx_tape::update(dt);
zx_ula::sound_update(dt);
zxscreen::refresh(dt);
z80analyze::refresh();
} else if (strcmp(cmd, "c")==0 || strcmp(cmd, "cont")==0) {
z80::step();
@@ -860,6 +876,13 @@ namespace z80debug
getcmd();
int value = getnum(cmd);
z80::setMemTag(value, MEMTAG_IGNORE);
} else if (strcmp(cmd, "search")==0) {
getcmd();
if (strcmp(cmd, "next")==0) {
search();
} else {
search(cmd);
}
}
}
@@ -876,6 +899,14 @@ namespace z80debug
return t;
}
uint32_t stepout()
{
z80::setOption(Z80_OPTION_BREAK_ON_RET, true);
const uint32_t t = z80::step();
cont();
return t;
}
void setmemmodified(const uint16_t addr)
{
mem_modified[addr] = true;
@@ -988,6 +1019,41 @@ namespace z80debug
}
}
uint8_t hexchartonum(char chr)
{
int num = chr-48;
if (num<0) return 0;
if (num>9) {
num-=7;
if (num>15) {
num-=32;
if (num<10 || num>15) return 0;
}
}
return uint8_t(num);
}
void search(const char *seq)
{
if (seq) {
search_pos = 0;
search_sequence_len=0;
while (*seq!=0) search_sequence[search_sequence_len++] = (hexchartonum(*(seq++))<<4) + hexchartonum(*(seq++));
}
int num_found=0;
uint8_t *memory = z80::getMem();
while (search_pos<65536) {
if (search_sequence[num_found] == memory[search_pos]) {
num_found++; search_pos++;
if (num_found==search_sequence_len) {
mem_viewer_pos=search_pos-search_sequence_len;
return;
}
} else {
num_found=0; search_pos++;
}
}
sendToConsole("Sequence not found.");
}
namespace history