From 80a8d3b0cd370c3cb33380d7d7231759c5f9c301 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Fri, 6 Dec 2024 09:38:53 +0100 Subject: [PATCH] =?UTF-8?q?-=20[NEW]=20Ara=20es=20veuen=20tamb=C3=A9=20els?= =?UTF-8?q?=20registres=20I=20i=20R=20en=20el=20debugger=20-=20[FIX]=20Arr?= =?UTF-8?q?eglada=20la=20gesti=C3=B3=20de=20les=20interrupcions=20en=20mod?= =?UTF-8?q?e=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- z80.cpp | 6 +++++- z80.h | 4 ++++ z80debug.cpp | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/z80.cpp b/z80.cpp index 2ea7548..5374891 100644 --- a/z80.cpp +++ b/z80.cpp @@ -662,7 +662,8 @@ namespace z80 if (im==1) { rPC = 0x38; } else if (im==2) { - rPC = (rI<<8) | 0xFF; + const uint8_t address = (rI<<8) | 0xFE; + rPC = READ_MEM_16(address); } } @@ -2729,6 +2730,9 @@ namespace z80 uint16_t getPC() { return rPC; } + uint8_t getI() { return rI; } + uint8_t getR() { return rR; } + void setPC(const uint16_t addr) { rPC = addr; } uint8_t getMemTag(const uint16_t addr) { return memtag[addr]; }; diff --git a/z80.h b/z80.h index 7544d38..957efa4 100644 --- a/z80.h +++ b/z80.h @@ -28,6 +28,10 @@ namespace z80 uint16_t getSP(); uint16_t getPC(); + uint8_t getI(); + uint8_t getR(); + + void setPC(const uint16_t addr); uint8_t getMemTag(const uint16_t addr); } \ No newline at end of file diff --git a/z80debug.cpp b/z80debug.cpp index 03890fa..4910f11 100644 --- a/z80debug.cpp +++ b/z80debug.cpp @@ -15,6 +15,7 @@ namespace z80debug } uint16_t oAF, oBC, oDE, oHL, oAF2, oBC2, oDE2, oHL2, oIX, oIY, oSP, oPC; + uint8_t oI, oR; bool mem_modified[65536]; @@ -179,6 +180,7 @@ namespace z80debug ui::printtxt(0,2, "DE DE' SP ", COLOR_WHITE); ui::printtxt(0,3, "HL HL' PC ", COLOR_WHITE); ui::printtxt(0,4, "(BC) (DE) (HL) ", COLOR_WHITE); + ui::printtxt(0,5, " I R ", COLOR_WHITE); ui::printtxt(3,0, tohex(z80::getAF(), 4), oAF != z80::getAF() ? COLOR_RED : COLOR_GRAY); ui::printtxt(11,0, tohex(z80::getAF(true), 4), oAF2 != z80::getAF(true) ? COLOR_RED : COLOR_GRAY); @@ -192,7 +194,10 @@ namespace z80debug ui::printtxt(3,3, tohex(z80::getHL(), 4), oHL != z80::getHL() ? COLOR_RED : COLOR_GRAY); ui::printtxt(11,3, tohex(z80::getHL(true), 4), oHL2 != z80::getHL(true) ? COLOR_RED : COLOR_GRAY); ui::printtxt(19,3, tohex(z80::getPC(), 4), oPC != z80::getPC() ? COLOR_RED : COLOR_GRAY); - + + ui::printtxt(16,5, tohex(z80::getI(), 2), oI != z80::getI() ? COLOR_RED : COLOR_GRAY); + ui::printtxt(21,5, tohex(z80::getR(), 2), oR != z80::getR() ? COLOR_RED : COLOR_GRAY); + ui::printtxt(5,4, tohex(memory[z80::getBC()], 2), COLOR_GRAY); ui::printtxt(13,4, tohex(memory[z80::getDE()], 2), COLOR_GRAY); ui::printtxt(21,4, tohex(memory[z80::getHL()], 2), COLOR_GRAY); @@ -280,6 +285,7 @@ namespace z80debug oAF = z80::getAF(); oBC = z80::getBC(); oDE = z80::getDE(); oHL = z80::getHL(); oAF2 = z80::getAF(true); oBC2 = z80::getBC(true); oDE2 = z80::getDE(true); oHL2 = z80::getHL(true); oIX = z80::getIX(); oIY = z80::getIY(); oSP = z80::getSP(); oPC = z80::getPC(); + oI = z80::getI(); oR = z80::getR(); } void sendToConsole(const char* text)