- [NEW] Les accións de execució (stop, cont, step, next) funcionen desde qualsevol finestra

- [FIX] Tancara la finestra de debug no fa que la execució continue
- [NEW] El foco va a la finestra que mes convé
- [FIX] El breakpoints i el Next mostren la instrucció que toca
This commit is contained in:
2024-12-10 16:28:50 +01:00
parent f462afe56c
commit f08fbf9e8b
5 changed files with 69 additions and 36 deletions

View File

@@ -123,8 +123,45 @@ int main(int argc, char *argv[])
if (e.type == SDL_MOUSEMOTION) result = ui::window::sendEvent(e.motion.windowID, &e);
if (e.type == SDL_WINDOWEVENT) result = ui::window::sendEvent(e.window.windowID, &e);
if (e.type == SDL_MOUSEWHEEL) result = ui::window::sendEvent(e.wheel.windowID, &e);
if (e.type == SDL_KEYDOWN) result = ui::window::sendEvent(e.key.windowID, &e);
if (e.type == SDL_TEXTINPUT) result = ui::window::sendEvent(e.text.windowID, &e);
if (e.type == SDL_KEYDOWN) {
if (e.key.keysym.scancode==SDL_SCANCODE_F5) {
if (z80debug::debugging()) {
z80debug::history::gototop();
const uint8_t dt = z80::step();
z80debug::cont();
zxscreen::refresh(dt);
}
} else if (e.key.keysym.scancode==SDL_SCANCODE_F8) {
if (!z80debug::debugging()) {
z80debug::stop();
zxscreen::redraw();
} else {
z80debug::show();
}
} else if (e.key.keysym.scancode==SDL_SCANCODE_F10) {
if (z80debug::debugging()) {
z80debug::show();
z80debug::history::gototop();
const uint8_t dt = z80::step();
z80debug::refresh();
zxscreen::refresh(dt);
zxscreen::redraw();
z80analyze::refresh();
}
} else if (e.key.keysym.scancode==SDL_SCANCODE_F11) {
if (z80debug::debugging()) {
z80debug::show();
z80debug::history::gototop();
const uint8_t dt = z80debug::next();
z80debug::refresh();
zxscreen::refresh(dt);
zxscreen::redraw();
z80analyze::refresh();
}
}
result = ui::window::sendEvent(e.key.windowID, &e);
}
if (e.type == SDL_MOUSEBUTTONUP && e.button.button==1) ui::setClicked(true);

View File

@@ -54,10 +54,8 @@ namespace z80debug
z80debug::refresh();
zxscreen::redraw();
} else if (e->window.event == SDL_WINDOWEVENT_CLOSE) {
z80debug::history::gototop();
const uint8_t dt = z80::step();
z80debug::cont();
zxscreen::refresh(dt);
hide();
zxscreen::focus();
}
}
if (e->type == SDL_MOUSEWHEEL) {
@@ -74,20 +72,6 @@ namespace z80debug
if (e->type == SDL_KEYDOWN) {
if (e->key.keysym.scancode==SDL_SCANCODE_ESCAPE) {
return false;
} else if (e->key.keysym.scancode==SDL_SCANCODE_F10) {
z80debug::history::gototop();
const uint8_t dt = z80::step();
z80debug::refresh();
zxscreen::refresh(dt);
zxscreen::redraw();
z80analyze::refresh();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F11) {
z80debug::history::gototop();
const uint8_t dt = z80debug::next();
z80debug::refresh();
zxscreen::refresh(dt);
zxscreen::redraw();
z80analyze::refresh();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F1) {
z80debug::history::gototop();
z80debug::refresh();
@@ -97,11 +81,6 @@ namespace z80debug
} else if (e->key.keysym.scancode==SDL_SCANCODE_F3) {
z80debug::history::goforward();
z80debug::refresh();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F5) {
z80debug::history::gototop();
const uint8_t dt = z80::step();
z80debug::cont();
zxscreen::refresh(dt);
/*} else if (e->key.keysym.scancode==SDL_SCANCODE_F6) {
z80debug::history::gototop();
const uint8_t dt = z80::step();
@@ -137,13 +116,21 @@ namespace z80debug
void show()
{
if (win) return;
win = SDL_CreateWindow("Z80 Debugger", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 83*CHR_W, 34*CHR_H, SDL_WINDOW_RESIZABLE);
ren = SDL_CreateRenderer(win, -1, 0);
ui::window::registerWindow(SDL_GetWindowID(win), eventHandler);
tex = ui::createtexture(ren);
if (!win) {
win = SDL_CreateWindow("Z80 Debugger", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 83*CHR_W, 34*CHR_H, SDL_WINDOW_RESIZABLE);
ren = SDL_CreateRenderer(win, -1, 0);
ui::window::registerWindow(SDL_GetWindowID(win), eventHandler);
tex = ui::createtexture(ren);
}
focus();
}
z80debug::refresh();
void focus()
{
if (win) {
SDL_RaiseWindow(win);
z80debug::refresh();
}
}
void hide()
@@ -176,6 +163,7 @@ namespace z80debug
is_debugging = is_paused = false;
//hide();
refresh();
zxscreen::focus();
zx_ula::sound_enable();
}

View File

@@ -5,6 +5,7 @@ namespace z80debug
{
void init();
void show();
void focus();
void hide();
void pause();

View File

@@ -115,12 +115,9 @@ namespace zxscreen
zxscreen::incZoom();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F3) {
zxscreen::toggleFullscreen();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F8) {
z80debug::stop();
zxscreen::redraw();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F12) {
} else if (e->key.keysym.scancode==SDL_SCANCODE_F6) {
zx_tape::play();
} else if (e->key.keysym.scancode==SDL_SCANCODE_F11) {
} else if (e->key.keysym.scancode==SDL_SCANCODE_F7) {
zx_tape::rewind();
}
}
@@ -163,7 +160,7 @@ namespace zxscreen
dest_rect.h = 296 * zoom;
}
redraw();
focus();
}
void init()
@@ -172,6 +169,15 @@ namespace zxscreen
reinit();
}
void focus()
{
if (win)
{
SDL_RaiseWindow(win);
redraw();
}
}
void refresh(const uint32_t dt)
{
const uint8_t* memory = z80::getMem();

View File

@@ -5,6 +5,7 @@ namespace zxscreen
{
void init();
void reinit();
void focus();
void refresh(const uint32_t dt);
void fullrefresh();
void redraw(const bool present=true);