-[NEW] Next (step over) implemented

This commit is contained in:
2024-04-16 15:15:05 +02:00
parent 06c57256f1
commit 8f6534475a
3 changed files with 19 additions and 7 deletions

View File

@@ -72,6 +72,12 @@ int main(int argc, char *argv[])
if (t>=69888) { t=0; z80::interrupt(); }
z80debug::refresh();
zxscreen::refresh();
} else if (e.key.keysym.scancode==SDL_SCANCODE_F11) {
z80debug::next();
//t += z80::step();
fps=0;
fps_time = SDL_GetTicks();
zxscreen::refresh();
} else if (e.key.keysym.scancode==SDL_SCANCODE_F5) {
z80::step();
z80debug::cont();
@@ -97,7 +103,7 @@ int main(int argc, char *argv[])
}
}
if (!z80debug::debugging()) {
if (z80debug::isbreak(z80::getPC())) {
if (z80debug::isbreak(z80::getPC(), 9)) {
z80debug::stop();
zxscreen::refresh();
} else {

View File

@@ -82,8 +82,8 @@ namespace z80debug
z80debug::refresh();
}
void stop() { is_debugging = true; refresh(); }
void cont() { is_debugging = false; refresh(); }
void stop() { is_debugging = true; breakpoints[z80::getPC()] &= ~8; refresh(); }
void cont() { is_debugging = false; refresh();}
const bool debugging() { return is_debugging; }
void box(int x, int y, int w, int h, uint8_t color)
@@ -158,7 +158,7 @@ namespace z80debug
for (int i=0; i<4;++i) colors[i]=COLOR_YELLOW;
printrect(0,8, 44,1, COLOR_BLUE);
}
if (breakpoints[pc]&1) printtxt(0,8,"*", colors[0]);
if (breakpoints[pc]&9) printtxt(0,8,"*", colors[0]);
printtxt(1,8,tohex(pc,4), colors[1]);
printtxt(7,8, z80dis::getOpcode(pc), colors[2]);
printtxt(19,8, z80dis::getAsm(pc), colors[3]);
@@ -166,7 +166,7 @@ namespace z80debug
uint16_t pos = pc;
for (int i=9;i<18;++i) {
pos += z80dis::getOpcodeSize(pos);
if (breakpoints[pos]&1) printtxt(0,i,"*", COLOR_RED);
if (breakpoints[pos]&9) printtxt(0,i,"*", COLOR_RED);
printtxt(1,i,tohex(pos,4), COLOR_CYAN);
printtxt(7,i, z80dis::getOpcode(pos), COLOR_GRAY);
printtxt(19,i, z80dis::getAsm(pos), COLOR_WHITE);
@@ -175,7 +175,7 @@ namespace z80debug
pos = pc;
for (int i=7;i>=0;--i) {
pos = find_previous_opcode(pos);
if (breakpoints[pos]&1) printtxt(0,i,"*", COLOR_RED);
if (breakpoints[pos]&9) printtxt(0,i,"*", COLOR_RED);
printtxt(1,i,tohex(pos,4), COLOR_CYAN);
printtxt(7,i, z80dis::getOpcode(pos), COLOR_GRAY);
printtxt(19,i, z80dis::getAsm(pos), COLOR_WHITE);
@@ -247,7 +247,7 @@ namespace z80debug
int line=0;
for (int i=0; i<65536; ++i) {
if (breakpoints[i]) {
if (breakpoints[i]&7) {
printtxt(2,line, tohex(i,4), COLOR_WHITE);
printtxt(7,line, breakpoints[i]&1?"x":"-", COLOR_GRAY);
printtxt(8,line, breakpoints[i]&2?"r":"-", COLOR_GRAY);
@@ -414,4 +414,9 @@ namespace z80debug
return (breakpoints[address]&type);
}
void next()
{
breakpoints[z80::getPC()+z80dis::getOpcodeSize(z80::getPC())] |= 8;
cont();
}
}

View File

@@ -15,4 +15,5 @@ namespace z80debug
void executeConsole();
const bool isbreak(const uint16_t address, const uint8_t type=1);
void next();
}