From 6f45044a9a1823f84f1e83832f7b7e3eab37a4c2 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 18 Dec 2024 13:22:56 +0100 Subject: [PATCH] =?UTF-8?q?-=20[CHG]=20En=20proves:=20fer=20un=20IN=20a=20?= =?UTF-8?q?un=20port=20no=20usat=20ara=20torna=200x00=20en=20compte=20de?= =?UTF-8?q?=200xFF.=20Probablement=20hi=20haur=C3=A0=20que=20revertir-ho.?= =?UTF-8?q?=20-=20[NEW]=20Amb=20F9=20es=20pot=20ficar=20o=20llevar=20un=20?= =?UTF-8?q?breakpoint=20en=20l'adre=C3=A7a=20on=20estiga=20el=20cursor=20d?= =?UTF-8?q?el=20desensamblador.=20-=20[NEW]=20Nou=20comando=20de=20la=20co?= =?UTF-8?q?nsola=20"show=20analyzer"=20-=20[FIX]=20Quan=20es=20fa=20un=20f?= =?UTF-8?q?ull=20refresh=20mentres=20se=20debugga=20no=20ha=20de=20causar?= =?UTF-8?q?=20interrupcions.=20A=20m=C3=A9s,=20ara=20mantenim=20els=20t=5F?= =?UTF-8?q?states=20i=20el=20punter=20a=20pantalla.=20-=20[FIX]=20La=20ins?= =?UTF-8?q?trucci=C3=B3=20CPIR=20llegia=20mal=20la=20mem=C3=B2ria=20apunta?= =?UTF-8?q?da=20per=20HL=20al=20considerar=20si=20hi=20havia=20coincidenci?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- z80.cpp | 12 +++++++----- z80debug.cpp | 21 ++++++++++++++++----- zx_screen.cpp | 10 +++++++--- zx_screen.h | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/z80.cpp b/z80.cpp index 3b02d9e..cd524b3 100644 --- a/z80.cpp +++ b/z80.cpp @@ -930,10 +930,11 @@ namespace z80 } } - void CPI() + uint8_t CPI() { bool keep_fC = (rF & fC); - CP(READ_MEM_8(rHL)); + const uint8_t hlmem = READ_MEM_8(rHL); + CP(hlmem); rHL++; rBC--; t+=2; @@ -941,12 +942,13 @@ namespace z80 if (keep_fC) SET_FLAGS(fC); if (rBC!=0) SET_FLAGS(fP); //if (READ_MEM_8(rHL)==rA) SET_FLAGS(fZ); + return hlmem; } void CPIR() { - CPI(); - if (rBC!=0 && READ_MEM_8(rHL)!=rA) + const uint8_t hlmem = CPI(); + if (rBC!=0 && hlmem!=rA) { rPC-=2; t+=2; @@ -996,7 +998,7 @@ namespace z80 } return val; } else - return 0xff; + return 0xFF; } void OUT(uint8_t val, int port = 0x10000) diff --git a/z80debug.cpp b/z80debug.cpp index 22eeba5..35bc93f 100644 --- a/z80debug.cpp +++ b/z80debug.cpp @@ -147,11 +147,13 @@ namespace z80debug z80debug::history::goforward(); z80debug::refresh(); z80analyze::refresh(); - /*} 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_F9) { + const uint16_t address = cursor; + if (breakpoints[line_address[address]]==0) + breakpoints[line_address[address]]=1; + else + breakpoints[line_address[address]]=0; + refresh(); } else if (e->key.keysym.scancode==SDL_SCANCODE_UP) { if (console_history_nav != console_history_pos+1 && console_history[console_history_nav-1][0]!=0) console_history_nav--; //z80debug::cursorback(); @@ -965,6 +967,15 @@ namespace z80debug } else { search(cmd); } + } else if (strcmp(cmd, "show")==0) { + getcmd(); + if (strcmp(cmd, "analyzer")==0) { + z80analyze::show(); + } else { + sendToConsoleLog("Unrecognized window. Usage: Show [analyzer]"); + } + } else { + sendToConsoleLog("Unrecognized command."); } } diff --git a/zx_screen.cpp b/zx_screen.cpp index a73e547..58bc8a0 100644 --- a/zx_screen.cpp +++ b/zx_screen.cpp @@ -186,7 +186,7 @@ namespace zxscreen } } - void refresh(const uint32_t dt) + void refresh(const uint32_t dt, const bool full) { const uint8_t* memory = z80::getMem(); const uint8_t border_color = zx_ula::get_border_color(); @@ -220,16 +220,20 @@ namespace zxscreen t_screen=0; ptr_pixel = zx_pixels; redraw(); - z80::interrupt(); + if (!full) z80::interrupt(); } } } void fullrefresh() { + uint32_t tmp = t_screen; t_screen = 0; + uint8_t * tmp_ptr = ptr_pixel; ptr_pixel = zx_pixels; - refresh(69888); + refresh(69888, true); + ptr_pixel = tmp_ptr; + t_screen = tmp; } void debugrefresh(const uint32_t dt) diff --git a/zx_screen.h b/zx_screen.h index 792efac..269a701 100644 --- a/zx_screen.h +++ b/zx_screen.h @@ -6,7 +6,7 @@ namespace zxscreen void init(); void reinit(); void focus(); - void refresh(const uint32_t dt); + void refresh(const uint32_t dt, const bool full=false); void fullrefresh(); void debugrefresh(); void redraw(const bool present=true);