- Afegit el modo paused per a quan estiga el menú fora
This commit is contained in:
17
main.cpp
17
main.cpp
@@ -77,9 +77,22 @@ int main(int argc, char *argv[])
|
|||||||
if (e.type == SDL_TEXTINPUT) {
|
if (e.type == SDL_TEXTINPUT) {
|
||||||
z80debug::sendToConsole(e.text.text);
|
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 {
|
} else {
|
||||||
if (e.type == SDL_KEYDOWN) {
|
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();
|
zxscreen::decZoom();
|
||||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F2) {
|
} else if (e.key.keysym.scancode==SDL_SCANCODE_F2) {
|
||||||
zxscreen::incZoom();
|
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)) {
|
if (z80debug::isbreak(z80::getPC(), 9)) {
|
||||||
z80debug::stop();
|
z80debug::stop();
|
||||||
zxscreen::redraw();
|
zxscreen::redraw();
|
||||||
|
|||||||
30
z80debug.cpp
30
z80debug.cpp
@@ -15,6 +15,7 @@ namespace z80debug
|
|||||||
SDL_Renderer *ren = nullptr;
|
SDL_Renderer *ren = nullptr;
|
||||||
|
|
||||||
bool is_debugging=false;
|
bool is_debugging=false;
|
||||||
|
bool is_paused=false;
|
||||||
uint16_t mem_viewer_pos = 0;
|
uint16_t mem_viewer_pos = 0;
|
||||||
char console[256];
|
char console[256];
|
||||||
char console_error[256];
|
char console_error[256];
|
||||||
@@ -33,7 +34,7 @@ namespace z80debug
|
|||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
is_debugging = false;
|
is_debugging = is_paused = false;
|
||||||
for (int i=0; i<65536; ++i) breakpoints[i]=0;
|
for (int i=0; i<65536; ++i) breakpoints[i]=0;
|
||||||
//show();
|
//show();
|
||||||
}
|
}
|
||||||
@@ -55,9 +56,30 @@ namespace z80debug
|
|||||||
win = NULL;
|
win = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() { zx_ula::sound_disable(); is_debugging = true; breakpoints[z80::getPC()] &= ~8; show(); /*refresh();*/ }
|
void pause()
|
||||||
void cont() { is_debugging = false; hide();/*refresh()*/; zx_ula::sound_enable(); }
|
{
|
||||||
|
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 debugging() { return is_debugging; }
|
||||||
|
const bool paused() { return is_paused; }
|
||||||
|
|
||||||
|
|
||||||
uint16_t find_previous_opcode(uint16_t pc)
|
uint16_t find_previous_opcode(uint16_t pc)
|
||||||
@@ -432,7 +454,7 @@ namespace z80debug
|
|||||||
fread(memory+address, size, 1, f);
|
fread(memory+address, size, 1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
z80::setPC(address);
|
z80::setPC(address);
|
||||||
is_debugging = false;
|
is_debugging = is_paused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void savestate(const char *filename)
|
void savestate(const char *filename)
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ namespace z80debug
|
|||||||
void show();
|
void show();
|
||||||
void hide();
|
void hide();
|
||||||
|
|
||||||
|
void pause();
|
||||||
void stop();
|
void stop();
|
||||||
void cont();
|
void cont();
|
||||||
const bool debugging();
|
const bool debugging();
|
||||||
|
const bool paused();
|
||||||
void setmemmodified(const uint16_t addr);
|
void setmemmodified(const uint16_t addr);
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|||||||
Reference in New Issue
Block a user