- [NEW] Gestió dels events de cada finestra per separat
- [NEW] Symbols per a etiquetar adreces - [NEW] Mapa de memòria "tocada" - [NEW] En el mapa de memòria al passar el ratolí mostra l'adreça - [NEW] En el mapa de memòria es mostra en roig la posició del contador de programa - [NEW] Reemplaç en els opcodes de adreces conegudes per la seua etiqueta
This commit is contained in:
113
main.cpp
113
main.cpp
@@ -11,6 +11,7 @@
|
||||
#include "ui.h"
|
||||
#include "ui_menu.h"
|
||||
#include "z80analyze.h"
|
||||
#include "ui_window.h"
|
||||
|
||||
uint8_t memory[65536];
|
||||
uint32_t time = 0;
|
||||
@@ -68,6 +69,7 @@ int main(int argc, char *argv[])
|
||||
fread(memory, 1024, 16, f);
|
||||
fclose(f);
|
||||
|
||||
z80dis::loadSymbols();
|
||||
z80::reset(memory);
|
||||
z80::connect_port(0xfe, zx_ula::port_in, zx_ula::port_out);
|
||||
|
||||
@@ -114,108 +116,20 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
while (SDL_PollEvent(&e))
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
if (e.type == SDL_QUIT) { should_exit=true; break; }
|
||||
if (e.type == SDL_MOUSEBUTTONUP) result = ui::window::sendEvent(e.button.windowID, &e);
|
||||
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_MOUSEBUTTONUP && e.button.button==1) ui::setClicked(true);
|
||||
if ((e.type==SDL_WINDOWEVENT) && (e.window.event==SDL_WINDOWEVENT_CLOSE)) {
|
||||
should_exit=true; break;
|
||||
}
|
||||
|
||||
if (z80debug::debugging()) {
|
||||
if ((e.type==SDL_WINDOWEVENT) && ((e.window.event==SDL_WINDOWEVENT_SHOWN) || (e.window.event==SDL_WINDOWEVENT_EXPOSED))) {
|
||||
z80debug::refresh();
|
||||
zxscreen::redraw();
|
||||
}
|
||||
if (e.type == SDL_MOUSEWHEEL) {
|
||||
if (e.wheel.mouseX<46*CHR_W && e.wheel.mouseY<20*CHR_H) {
|
||||
if (e.wheel.y>0) {
|
||||
z80debug::cursorback();
|
||||
z80debug::refresh();
|
||||
} else if (e.wheel.y<0) {
|
||||
z80debug::cursorfwd();
|
||||
z80debug::refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e.type == SDL_KEYDOWN) {
|
||||
if (e.key.keysym.scancode==SDL_SCANCODE_ESCAPE) {
|
||||
should_exit=true; break;
|
||||
} 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();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F11) {
|
||||
z80debug::history::gototop();
|
||||
const uint8_t dt = z80debug::next();
|
||||
zxscreen::refresh(dt);
|
||||
zxscreen::redraw();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F1) {
|
||||
z80debug::history::gototop();
|
||||
z80debug::refresh();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F2) {
|
||||
z80debug::history::goback();
|
||||
z80debug::refresh();
|
||||
} 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();
|
||||
z80debug::refresh();
|
||||
zxscreen::refresh(dt);*/
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_UP) {
|
||||
z80debug::cursorback();
|
||||
z80debug::refresh();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_DOWN) {
|
||||
z80debug::cursorfwd();
|
||||
z80debug::refresh();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_RETURN) {
|
||||
z80debug::executeConsole();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_BACKSPACE) {
|
||||
z80debug::DeleteCharConsole();
|
||||
}
|
||||
}
|
||||
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_ESCAPE) {
|
||||
z80debug::pause();
|
||||
ui::setrenderer(zxscreen::getrenderer());
|
||||
zxscreen::redraw();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F1) {
|
||||
zxscreen::decZoom();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F2) {
|
||||
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) {
|
||||
zx_tape::play();
|
||||
} else if (e.key.keysym.scancode==SDL_SCANCODE_F11) {
|
||||
zx_tape::rewind();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
should_exit = true; break;
|
||||
}
|
||||
|
||||
if (!z80debug::debugging() && !z80debug::paused()) {
|
||||
@@ -261,6 +175,7 @@ int main(int argc, char *argv[])
|
||||
while (SDL_GetTicks()<time+100) {}
|
||||
t_states -= 350000;
|
||||
time = SDL_GetTicks();
|
||||
z80analyze::refresh();
|
||||
}
|
||||
}
|
||||
} else if (!z80debug::debugging() && z80debug::paused()) {
|
||||
|
||||
Reference in New Issue
Block a user