- [NEW] zxscreen

- [NEW] F8 para execució
- [NEW] F5 continua execució
- [NEW] ULA synch interrupt
- [NEW] Break on read/write
- [FIX] INC8 and DEC8 did wrong flags calculations
- [FIX] INCMEM8 and DECMEM8 did no flags calculation at all
- [NEW] Flags visualization
- [DEL] run command replaced by cont command
- [NEW] reset command
- [NEW] Breakpoint delete command
This commit is contained in:
2024-04-13 15:30:07 +02:00
parent eb4f2be4a4
commit 0d78733d06
7 changed files with 173 additions and 21 deletions

View File

@@ -72,7 +72,7 @@ namespace z80debug
{
is_debugging = true;
if (win) return;
win = SDL_CreateWindow("Z80 Debugger", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 71*CHR_W, 34*CHR_H, SDL_WINDOW_SHOWN);
win = SDL_CreateWindow("Z80 Debugger", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 71*CHR_W, 34*CHR_H, SDL_WINDOW_RESIZABLE);
ren = SDL_CreateRenderer(win, -1, 0);
tex = SDL_CreateTextureFromSurface(ren, SDL_LoadBMP("font.bmp"));
SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND);
@@ -189,7 +189,7 @@ namespace z80debug
printtxt(0,1, "BC BC' IY ", COLOR_WHITE);
printtxt(0,2, "DE DE' SP ", COLOR_WHITE);
printtxt(0,3, "HL HL' PC ", COLOR_WHITE);
printtxt(0,5, "(BC) (DE) (HL) ", COLOR_WHITE);
printtxt(0,4, "(BC) (DE) (HL) ", COLOR_WHITE);
printtxt(3,0, tohex(z80::getAF(), 4), COLOR_GRAY);
printtxt(11,0, tohex(z80::getAF(true), 4), COLOR_GRAY);
@@ -204,9 +204,19 @@ namespace z80debug
printtxt(11,3, tohex(z80::getHL(true), 4), COLOR_GRAY);
printtxt(19,3, tohex(z80::getPC(), 4), COLOR_GRAY);
printtxt(5,5, tohex(memory[z80::getBC()], 2), COLOR_GRAY);
printtxt(13,5, tohex(memory[z80::getDE()], 2), COLOR_GRAY);
printtxt(21,5, tohex(memory[z80::getHL()], 2), COLOR_GRAY);
printtxt(5,4, tohex(memory[z80::getBC()], 2), COLOR_GRAY);
printtxt(13,4, tohex(memory[z80::getDE()], 2), COLOR_GRAY);
printtxt(21,4, tohex(memory[z80::getHL()], 2), COLOR_GRAY);
const uint8_t flags = (z80::getAF() & 0xFF);
printtxt(0,5,"S", flags&0x80?COLOR_WHITE:COLOR_GRAY);
printtxt(1,5,"Z", flags&0x40?COLOR_WHITE:COLOR_GRAY);
printtxt(2,5,"X", flags&0x20?COLOR_WHITE:COLOR_GRAY);
printtxt(3,5,"H", flags&0x10?COLOR_WHITE:COLOR_GRAY);
printtxt(4,5,"Y", flags&0x08?COLOR_WHITE:COLOR_GRAY);
printtxt(5,5,"P", flags&0x04?COLOR_WHITE:COLOR_GRAY);
printtxt(6,5,"N", flags&0x02?COLOR_WHITE:COLOR_GRAY);
printtxt(7,5,"C", flags&0x01?COLOR_WHITE:COLOR_GRAY);
offset_x = offset_y = 0;
box(46,8,11,12,COLOR_WHITE);
@@ -341,15 +351,19 @@ namespace z80debug
if (strcmp(cmd, "s")==0 || strcmp(cmd, "step")==0) {
z80::step();
} else if (strcmp(cmd, "r")==0 || strcmp(cmd, "run")==0 || strcmp(cmd, "c")==0 || strcmp(cmd, "cont")==0) {
} else if (strcmp(cmd, "c")==0 || strcmp(cmd, "cont")==0) {
z80::step();
z80debug::cont();
} else if (strcmp(cmd, "r")==0 || strcmp(cmd, "reset")==0) {
z80::reset(z80::getMem());
for (int i=0; i<65536; ++i) breakpoints[i]=0;
z80debug::refresh();
} else if (strcmp(cmd, "b")==0 || strcmp(cmd, "break")==0) {
getcmd();
int address = getnum(cmd);
if (address<0 || address>65536) { strcpy(console_error, "Illegal break address"); return; }
getcmd();
uint8_t break_type = 0;
uint8_t break_type = 1;
if (cmd[0]!=0) {
if (strcmp(cmd, "x")==0 || strcmp(cmd, "exec")==0) {
break_type = 1;
@@ -361,8 +375,27 @@ namespace z80debug
strcpy(console_error, "Illegal break type");
return;
}
breakpoints[address] |= break_type;
}
breakpoints[address] |= break_type;
} else if (strcmp(cmd, "d")==0 || strcmp(cmd, "delete")==0) {
getcmd();
int address = getnum(cmd);
if (address<0 || address>65536) { strcpy(console_error, "Illegal address"); return; }
getcmd();
uint8_t break_type = 7;
if (cmd[0]!=0) {
if (strcmp(cmd, "x")==0 || strcmp(cmd, "exec")==0) {
break_type = 1;
} else if (strcmp(cmd, "r")==0 || strcmp(cmd, "read")==0) {
break_type = 2;
} else if (strcmp(cmd, "w")==0 || strcmp(cmd, "write")==0) {
break_type = 4;
} else {
strcpy(console_error, "Illegal break type");
return;
}
}
breakpoints[address] &= ~break_type;
} else if (strcmp(cmd, "m")==0 || strcmp(cmd, "mem")==0) {
getcmd();
int address = getnum(cmd);
@@ -371,9 +404,9 @@ namespace z80debug
}
}
const bool isbreak(const uint16_t address)
const bool isbreak(const uint16_t address, const uint8_t type)
{
return (breakpoints[address]&1);
return (breakpoints[address]&type);
}
}