- Afegit el modo paused per a quan estiga el menú fora

This commit is contained in:
2024-12-03 13:41:17 +01:00
parent c84b8c7a6a
commit eee5753a7f
3 changed files with 43 additions and 6 deletions

View File

@@ -77,9 +77,22 @@ int main(int argc, char *argv[])
if (e.type == SDL_TEXTINPUT) {
z80debug::sendToConsole(e.text.text);
}
} else if (z80debug::paused()) {
if (e.type == SDL_KEYDOWN) {
if (e.key.keysym.scancode==SDL_SCANCODE_ESCAPE) {
const uint8_t dt = z80::step();
z80debug::cont();
zxscreen::refresh(dt);
}
}
} else {
if (e.type == SDL_KEYDOWN) {
if (e.key.keysym.scancode==SDL_SCANCODE_F1) {
if (e.key.keysym.scancode==SDL_SCANCODE_ESCAPE) {
z80debug::pause();
zxscreen::redraw();
} else if (e.key.keysym.scancode==SDL_SCANCODE_F1) {
zxscreen::decZoom();
} else if (e.key.keysym.scancode==SDL_SCANCODE_F2) {
zxscreen::incZoom();
@@ -98,7 +111,7 @@ int main(int argc, char *argv[])
}
}
if (!z80debug::debugging()) {
if (!z80debug::debugging() && !z80debug::paused()) {
if (z80debug::isbreak(z80::getPC(), 9)) {
z80debug::stop();
zxscreen::redraw();

View File

@@ -15,6 +15,7 @@ namespace z80debug
SDL_Renderer *ren = nullptr;
bool is_debugging=false;
bool is_paused=false;
uint16_t mem_viewer_pos = 0;
char console[256];
char console_error[256];
@@ -33,7 +34,7 @@ namespace z80debug
void init()
{
is_debugging = false;
is_debugging = is_paused = false;
for (int i=0; i<65536; ++i) breakpoints[i]=0;
//show();
}
@@ -55,9 +56,30 @@ namespace z80debug
win = NULL;
}
void stop() { zx_ula::sound_disable(); is_debugging = true; breakpoints[z80::getPC()] &= ~8; show(); /*refresh();*/ }
void cont() { is_debugging = false; hide();/*refresh()*/; zx_ula::sound_enable(); }
void pause()
{
zx_ula::sound_disable();
is_paused = true;
breakpoints[z80::getPC()] &= ~8;
}
void stop()
{
pause();
is_debugging = true;
show();
/*refresh();*/
}
void cont() {
is_debugging = is_paused = false;
hide();
/*refresh();*/
zx_ula::sound_enable();
}
const bool debugging() { return is_debugging; }
const bool paused() { return is_paused; }
uint16_t find_previous_opcode(uint16_t pc)
@@ -432,7 +454,7 @@ namespace z80debug
fread(memory+address, size, 1, f);
fclose(f);
z80::setPC(address);
is_debugging = false;
is_debugging = is_paused = false;
}
void savestate(const char *filename)

View File

@@ -7,9 +7,11 @@ namespace z80debug
void show();
void hide();
void pause();
void stop();
void cont();
const bool debugging();
const bool paused();
void setmemmodified(const uint16_t addr);
void refresh();