- Ja es pot tancar la finestra amb el botó de tancar finestra normal
- Ara la finestra de debug nomes es mostra mentre s'està debugant - [NEW] "peek address" i "poke address value" des de la consola, per a modificar o consultar la memòria
This commit is contained in:
6
main.cpp
6
main.cpp
@@ -23,7 +23,7 @@ int main(int argc, char *argv[])
|
|||||||
z80::connect_port(0xfe, zx_ula::port_in, zx_ula::port_out);
|
z80::connect_port(0xfe, zx_ula::port_in, zx_ula::port_out);
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_EVERYTHING);
|
SDL_Init(SDL_INIT_EVERYTHING);
|
||||||
z80debug::show();
|
z80debug::init();
|
||||||
zxscreen::init();
|
zxscreen::init();
|
||||||
|
|
||||||
zx_ula::sound_init();
|
zx_ula::sound_init();
|
||||||
@@ -43,6 +43,10 @@ int main(int argc, char *argv[])
|
|||||||
while (SDL_PollEvent(&e))
|
while (SDL_PollEvent(&e))
|
||||||
{
|
{
|
||||||
if (e.type == SDL_QUIT) { should_exit=true; break; }
|
if (e.type == SDL_QUIT) { should_exit=true; break; }
|
||||||
|
if ((e.type==SDL_WINDOWEVENT) && (e.window.event==SDL_WINDOWEVENT_CLOSE)) {
|
||||||
|
should_exit=true; break;
|
||||||
|
}
|
||||||
|
|
||||||
if (z80debug::debugging()) {
|
if (z80debug::debugging()) {
|
||||||
if ((e.type==SDL_WINDOWEVENT) && ((e.window.event==SDL_WINDOWEVENT_SHOWN) || (e.window.event==SDL_WINDOWEVENT_EXPOSED))) {
|
if ((e.type==SDL_WINDOWEVENT) && ((e.window.event==SDL_WINDOWEVENT_SHOWN) || (e.window.event==SDL_WINDOWEVENT_EXPOSED))) {
|
||||||
z80debug::refresh();
|
z80debug::refresh();
|
||||||
|
|||||||
38
z80debug.cpp
38
z80debug.cpp
@@ -73,22 +73,36 @@ namespace z80debug
|
|||||||
|
|
||||||
void processCommand();
|
void processCommand();
|
||||||
|
|
||||||
void show()
|
void init()
|
||||||
{
|
{
|
||||||
is_debugging = false;
|
is_debugging = false;
|
||||||
|
for (int i=0; i<65536; ++i) breakpoints[i]=0;
|
||||||
|
//show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void show()
|
||||||
|
{
|
||||||
if (win) return;
|
if (win) return;
|
||||||
win = SDL_CreateWindow("Z80 Debugger", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 71*CHR_W, 34*CHR_H, SDL_WINDOW_RESIZABLE);
|
win = SDL_CreateWindow("Z80 Debugger", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 71*CHR_W, 34*CHR_H, SDL_WINDOW_RESIZABLE);
|
||||||
ren = SDL_CreateRenderer(win, -1, 0);
|
ren = SDL_CreateRenderer(win, -1, 0);
|
||||||
tex = SDL_CreateTextureFromSurface(ren, SDL_LoadBMP("font.bmp"));
|
tex = SDL_CreateTextureFromSurface(ren, SDL_LoadBMP("font.bmp"));
|
||||||
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
for (int i=0; i<65536; ++i) breakpoints[i]=0;
|
|
||||||
|
|
||||||
z80debug::refresh();
|
z80debug::refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() { zx_ula::sound_disable(); is_debugging = true; breakpoints[z80::getPC()] &= ~8; refresh(); }
|
void hide()
|
||||||
void cont() { is_debugging = false; refresh(); zx_ula::sound_enable(); }
|
{
|
||||||
|
if (tex) SDL_DestroyTexture(tex);
|
||||||
|
if (ren) SDL_DestroyRenderer(ren);
|
||||||
|
if (win) SDL_DestroyWindow(win);
|
||||||
|
tex = NULL;
|
||||||
|
ren = NULL;
|
||||||
|
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(); }
|
||||||
const bool debugging() { return is_debugging; }
|
const bool debugging() { return is_debugging; }
|
||||||
|
|
||||||
void box(int x, int y, int w, int h, uint8_t color)
|
void box(int x, int y, int w, int h, uint8_t color)
|
||||||
@@ -446,7 +460,19 @@ namespace z80debug
|
|||||||
} else if (strcmp(cmd, "play")==0) {
|
} else if (strcmp(cmd, "play")==0) {
|
||||||
zx_tape::play();
|
zx_tape::play();
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(cmd, "poke")==0) {
|
||||||
|
getcmd();
|
||||||
|
int address = getnum(cmd);
|
||||||
|
getcmd();
|
||||||
|
int value = getnum(cmd);
|
||||||
|
uint8_t *mem = z80::getMem();
|
||||||
|
mem[address] = value;
|
||||||
|
} else if (strcmp(cmd, "peek")==0) {
|
||||||
|
getcmd();
|
||||||
|
int address = getnum(cmd);
|
||||||
|
uint8_t *mem = z80::getMem();
|
||||||
|
int value = mem[address];
|
||||||
|
SDL_itoa(value, console_error, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
namespace z80debug
|
namespace z80debug
|
||||||
{
|
{
|
||||||
|
void init();
|
||||||
void show();
|
void show();
|
||||||
|
void hide();
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
void cont();
|
void cont();
|
||||||
|
|||||||
Reference in New Issue
Block a user