[NEW] Inclos un mode de pantalla en que s'actualitze al instant en compte de segons el retraç del crt, per a debuggar que se pinta

This commit is contained in:
2024-12-16 16:31:53 +01:00
parent f7a7b0692d
commit 83b6782078
5 changed files with 42 additions and 10 deletions

View File

@@ -56,6 +56,12 @@ namespace actions
return zxscreen::getFullscreen();
}
int fullrefresh(int value)
{
zxscreen::toggleFullRefresh();
return zxscreen::getFullRefresh();
}
int showAnalyzer(int value)
{
z80analyze::show();
@@ -95,6 +101,8 @@ int main(int argc, char *argv[])
ui::menu::addoption(menu, "DEC ZOOM", actions::decZoom);
ui::menu::addoption(menu, "INC ZOOM", actions::incZoom);
ui::menu::addbooloption(menu, "FULLSCREEN", zxscreen::getFullscreen(), actions::fullscreen);
ui::menu::addseparator(menu);
ui::menu::addbooloption(menu, "FULL REFRESH", zxscreen::getFullRefresh(), actions::fullrefresh);
menu = ui::menu::addsubmenu("EMULATION");
ui::menu::addbooloption(menu, "STOP ON INVALID OP", z80::getOption(Z80_OPTION_STOP_ON_INVALID), actions::decZoom);
@@ -146,7 +154,7 @@ int main(int argc, char *argv[])
z80debug::history::gototop();
const uint8_t dt = z80::step();
z80debug::refresh();
zxscreen::refresh(dt);
zxscreen::fullrefresh();
zxscreen::redraw();
z80analyze::refresh();
}

View File

@@ -1,4 +1,13 @@
0x5e38 STACK
0x9a01 DRW_ROOM
0x9f00 DRW_SCO_HERO
0x9f0f VAR_VIDES
0x9f8d DRW_SCO_INV
0xa00a DRW_SCO_LIVS
0xa01a DRW_SCO_NBAG
0xa022 DRW_SCO_NARW
0xa02a DRW_SCO_PNTS
0xc661 CLEAR_SCR
0xed5e MAINLOOP
0xf2b1 DRW_HERO
0xfed5 COUNT500

View File

@@ -369,6 +369,7 @@ namespace z80debug
is_debugging = true;
show();
/*refresh();*/
if ( zxscreen::getFullRefresh()) zxscreen::fullrefresh();
}
void cont() {
@@ -787,7 +788,7 @@ namespace z80debug
uint8_t dt = z80::step();
zx_tape::update(dt);
zx_ula::sound_update(dt);
zxscreen::refresh(dt);
zxscreen::fullrefresh();
z80analyze::refresh();
} else if (strcmp(cmd, "c")==0 || strcmp(cmd, "cont")==0) {
z80::step();

View File

@@ -20,6 +20,7 @@ namespace zxscreen
uint8_t zoom = 1;
bool fullscreen = false;
bool full_refresh = true;
int fullscreen_scale = 1;
SDL_Rect dest_rect;
@@ -194,7 +195,6 @@ namespace zxscreen
if (color_addr[t_screen] == 1) {
*(ptr_pixel++) = border_color;
*(ptr_pixel++) = border_color;
//pixels_draw+=2;
} else {
uint8_t color = memory[color_addr[t_screen]];
uint8_t c1 = color&0x7, c2 = (color>>3)&0x7;
@@ -210,20 +210,13 @@ namespace zxscreen
pixels_draw+=2;
}
t_screen++;
/*if (pixels_draw>352*296)
{
printf("PIXELS OVERFLOW: %i\n", pixels_draw);
}*/
if (t_screen>=69888) {
//printf("PIXELS DRAWN: %i\n", pixels_draw);
pixels_draw=0;
t_flash++;
if (t_flash==16) { t_flash=0; flash = !flash; }
t_screen=0;
ptr_pixel = zx_pixels;
redraw();
//while (SDL_GetTicks()-time < 20) {}
//time = SDL_GetTicks();
z80::interrupt();
}
}
@@ -232,9 +225,15 @@ namespace zxscreen
void fullrefresh()
{
t_screen = 0;
ptr_pixel = zx_pixels;
refresh(69888);
}
void debugrefresh(const uint32_t dt)
{
if (full_refresh) fullrefresh(); else refresh(dt);
}
void redraw(const bool present)
{
if (zx_tape::getplaying() && zx_tape::getOption(ZXTAPE_OPTION_FAST_LOAD)) return;
@@ -316,6 +315,17 @@ namespace zxscreen
return fullscreen;
}
void toggleFullRefresh()
{
full_refresh = !full_refresh;
}
const bool getFullRefresh()
{
return full_refresh;
}
SDL_Renderer *getrenderer()
{
return ren;

View File

@@ -8,6 +8,7 @@ namespace zxscreen
void focus();
void refresh(const uint32_t dt);
void fullrefresh();
void debugrefresh();
void redraw(const bool present=true);
void present();
void setTitle(const char* title);
@@ -17,5 +18,8 @@ namespace zxscreen
void toggleFullscreen();
const bool getFullscreen();
void toggleFullRefresh();
const bool getFullRefresh();
SDL_Renderer *getrenderer();
}