- [NEW] Ara es veuen també els registres I i R en el debugger

- [FIX] Arreglada la gestió de les interrupcions en mode 2
This commit is contained in:
2024-12-06 09:38:53 +01:00
parent c0f9fa9933
commit 80a8d3b0cd
3 changed files with 16 additions and 2 deletions

View File

@@ -662,7 +662,8 @@ namespace z80
if (im==1) { if (im==1) {
rPC = 0x38; rPC = 0x38;
} else if (im==2) { } 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; } uint16_t getPC() { return rPC; }
uint8_t getI() { return rI; }
uint8_t getR() { return rR; }
void setPC(const uint16_t addr) { rPC = addr; } void setPC(const uint16_t addr) { rPC = addr; }
uint8_t getMemTag(const uint16_t addr) { return memtag[addr]; }; uint8_t getMemTag(const uint16_t addr) { return memtag[addr]; };

4
z80.h
View File

@@ -28,6 +28,10 @@ namespace z80
uint16_t getSP(); uint16_t getSP();
uint16_t getPC(); uint16_t getPC();
uint8_t getI();
uint8_t getR();
void setPC(const uint16_t addr); void setPC(const uint16_t addr);
uint8_t getMemTag(const uint16_t addr); uint8_t getMemTag(const uint16_t addr);
} }

View File

@@ -15,6 +15,7 @@ namespace z80debug
} }
uint16_t oAF, oBC, oDE, oHL, oAF2, oBC2, oDE2, oHL2, oIX, oIY, oSP, oPC; uint16_t oAF, oBC, oDE, oHL, oAF2, oBC2, oDE2, oHL2, oIX, oIY, oSP, oPC;
uint8_t oI, oR;
bool mem_modified[65536]; bool mem_modified[65536];
@@ -179,6 +180,7 @@ namespace z80debug
ui::printtxt(0,2, "DE DE' SP ", COLOR_WHITE); ui::printtxt(0,2, "DE DE' SP ", COLOR_WHITE);
ui::printtxt(0,3, "HL HL' PC ", COLOR_WHITE); ui::printtxt(0,3, "HL HL' PC ", COLOR_WHITE);
ui::printtxt(0,4, "(BC) (DE) (HL) ", 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(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); 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(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(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(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(5,4, tohex(memory[z80::getBC()], 2), COLOR_GRAY);
ui::printtxt(13,4, tohex(memory[z80::getDE()], 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); 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(); 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); 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(); oIX = z80::getIX(); oIY = z80::getIY(); oSP = z80::getSP(); oPC = z80::getPC();
oI = z80::getI(); oR = z80::getR();
} }
void sendToConsole(const char* text) void sendToConsole(const char* text)