- [NEW] En el debugger, en el visor de memòria, tambe es veu cada byte del color del seu tag
- [NEW] En el debugger, en el visor de breakpoints, se marca uno si estem en eixe breakpoint - [NEW] Opció per a sincronitzar el cursor del visor de memòria amb el cursor del desensamblador - [NEW] Click on breakpoint to goto its address - [FIX] IX, IX bit, IY i IY bit opcodes with displacement wher shown wrong on the disassembler - [NEW] Symbols module shows a symbol highlighted if the cursor is on its address - [NEW] Click on a symbol to move the cursor to its address
This commit is contained in:
@@ -1,2 +1 @@
|
||||
0xf72d MAINLOOP
|
||||
0xf864 CHK_KEYB
|
||||
0xfed5 COUNT500
|
||||
|
||||
67
z80debug.cpp
67
z80debug.cpp
@@ -65,6 +65,9 @@ namespace z80debug
|
||||
uint8_t use[7][256];
|
||||
|
||||
uint16_t line_address[256];
|
||||
uint16_t line_breakpoint_address[256];
|
||||
int num_breakpoint_lines=0;
|
||||
bool sync_mem_with_cursor = false;
|
||||
|
||||
char temp[256];
|
||||
const char *tohex(int value, int numdigits)
|
||||
@@ -185,6 +188,9 @@ namespace z80debug
|
||||
}
|
||||
}
|
||||
if (e->type == SDL_MOUSEBUTTONDOWN) {
|
||||
const int chrx = e->button.x/CHR_W;
|
||||
const int chry = e->button.y/CHR_H;
|
||||
//printf("%ix%i\n", chrx, chry);
|
||||
if ( (e->button.x<midx*CHR_W) && (e->button.y<(mem_y-1)*CHR_H) && (e->button.y>CHR_H) ) {
|
||||
const uint16_t address = ((e->button.y)/CHR_H)-1;
|
||||
if (breakpoints[line_address[address]]==0)
|
||||
@@ -193,6 +199,26 @@ namespace z80debug
|
||||
breakpoints[line_address[address]]=0;
|
||||
refresh();
|
||||
}
|
||||
if (chrx>=midx+12 && chry>=9 && chry<sym_y-1) {
|
||||
const int breakpoint_selected = chry-9;
|
||||
if (num_breakpoint_lines>breakpoint_selected) {
|
||||
cursor = line_breakpoint_address[breakpoint_selected];
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if (chrx>=10 && chrx<=12 && chry==mem_y) {
|
||||
sync_mem_with_cursor = ! sync_mem_with_cursor;
|
||||
refresh();
|
||||
}
|
||||
|
||||
if (chrx>=midx+2 && chry>=sym_y+1) {
|
||||
const int line = chry-(sym_y+1);
|
||||
if (line<z80dis::getNumSymbols()) {
|
||||
cursor = z80dis::getSymbolAddress(line);
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if (!resizing && resizing_type != RESIZING_NONE) {
|
||||
resizing = true;
|
||||
@@ -361,6 +387,7 @@ namespace z80debug
|
||||
uint8_t *memory = z80::getMem();
|
||||
|
||||
uint16_t pc = cursor; //z80::getPC();
|
||||
if (sync_mem_with_cursor) mem_viewer_pos = cursor;
|
||||
uint16_t pos = pc;
|
||||
int num_lines = mem_y-2;
|
||||
line_address[(num_lines/2)-1] = pos;
|
||||
@@ -430,7 +457,8 @@ namespace z80debug
|
||||
|
||||
// STACK
|
||||
// ******************************************
|
||||
|
||||
// TODO: Save if stack element was introduced by a call, push or data
|
||||
// TODO: Click goes to address
|
||||
ui::setoffset(0, 0);
|
||||
ui::box(midx,8,11,sym_y-8,COLOR_WHITE);
|
||||
ui::printrect(midx+2,8, 8,1, COLOR_DARK);
|
||||
@@ -459,12 +487,20 @@ namespace z80debug
|
||||
ui::setoffset(midx+12, 9);
|
||||
|
||||
int line=0;
|
||||
num_breakpoint_lines=0;
|
||||
for (int i=0; i<65536; ++i) {
|
||||
if (breakpoints[i]&7) {
|
||||
ui::printtxt(2,line, tohex(i,4), COLOR_WHITE);
|
||||
ui::printtxt(7,line, breakpoints[i]&1?"x":"-", COLOR_GRAY);
|
||||
ui::printtxt(8,line, breakpoints[i]&2?"r":"-", COLOR_GRAY);
|
||||
ui::printtxt(9,line, breakpoints[i]&4?"w":"-", COLOR_GRAY);
|
||||
line_breakpoint_address[line] = i;
|
||||
num_breakpoint_lines++;
|
||||
uint8_t colors[2] = {COLOR_WHITE, COLOR_GRAY};
|
||||
if (i==cursor) {
|
||||
ui::printrect(1,line,10,1,COLOR_BLUE);
|
||||
colors[0]=colors[1]=COLOR_YELLOW;
|
||||
}
|
||||
ui::printtxt(2,line, tohex(i,4), colors[0]);
|
||||
ui::printtxt(7,line, breakpoints[i]&1?"x":"-", colors[1]);
|
||||
ui::printtxt(8,line, breakpoints[i]&2?"r":"-", colors[1]);
|
||||
ui::printtxt(9,line, breakpoints[i]&4?"w":"-", colors[1]);
|
||||
line++;
|
||||
if (line>9) break;
|
||||
}
|
||||
@@ -476,15 +512,23 @@ namespace z80debug
|
||||
|
||||
ui::setoffset(0, 0);
|
||||
ui::box(0,mem_y,midx,mem_h,COLOR_WHITE);
|
||||
ui::printrect(2,mem_y, 9,1, COLOR_DARK);
|
||||
ui::printrect(2,mem_y, 11,1, COLOR_DARK);
|
||||
ui::printtxt(3,mem_y, "MEMORY:", COLOR_WHITE);
|
||||
|
||||
ui::printvoidrect(10,mem_y,3,1,COLOR_WHITE);
|
||||
if (sync_mem_with_cursor) ui::printchar(11,mem_y,'X',COLOR_WHITE);
|
||||
|
||||
ui::setoffset(1, mem_y+1);
|
||||
|
||||
uint16_t mem_viewer_cursor = mem_viewer_pos;
|
||||
for (int i=0; i<mem_h-2; ++i) {
|
||||
ui::printtxt(1,i, tohex(mem_viewer_cursor, 4), COLOR_CYAN);
|
||||
for (int j=0; j<16; ++j) {
|
||||
|
||||
const uint8_t tag = z80::getMemTag(mem_viewer_cursor);
|
||||
const uint32_t color = tag==MEMTAG_NONE ? COLOR_GRAY : tag==MEMTAG_DATA ? COLOR_BLUE : tag==MEMTAG_MIXED ? COLOR_MAGENTA : COLOR_GREEN;
|
||||
ui::printrect(6+j*3,i,2,1,color);
|
||||
ui::printrect(54+j,i,1,1,color);
|
||||
ui::printtxt(6+j*3, i, tohex(memory[mem_viewer_cursor],2), mem_modified[mem_viewer_cursor] ? COLOR_RED : COLOR_WHITE);
|
||||
ui::printchar(54+j, i, memory[mem_viewer_cursor], mem_modified[mem_viewer_cursor] ? COLOR_BROWN : COLOR_GRAY);
|
||||
mem_viewer_cursor++;
|
||||
@@ -526,11 +570,18 @@ namespace z80debug
|
||||
ui::setoffset(midx+1, sym_y+1);
|
||||
const int num_symbols = z80dis::getNumSymbols();
|
||||
for (int i=0;i<num_symbols;++i) {
|
||||
uint8_t colors[2] = {COLOR_GRAY, COLOR_WHITE};
|
||||
const uint16_t address = z80dis::getSymbolAddress(i);
|
||||
ui::printtxt(1, i, tohex(address,4), COLOR_GRAY);
|
||||
ui::printtxt(6, i, z80dis::getSymbol(address), COLOR_WHITE);
|
||||
if (address==cursor) {
|
||||
ui::printrect(0,line,23,1,COLOR_BLUE);
|
||||
colors[0]=colors[1]=COLOR_YELLOW;
|
||||
}
|
||||
|
||||
ui::printtxt(1, i, tohex(address,4), colors[0]);
|
||||
ui::printtxt(6, i, z80dis::getSymbol(address), colors[1]);
|
||||
}
|
||||
|
||||
|
||||
if (!is_debugging) {
|
||||
SDL_SetRenderDrawBlendMode(ren, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(ren, 0, 0, 0, 128);
|
||||
|
||||
11
z80dis.cpp
11
z80dis.cpp
@@ -173,12 +173,11 @@ namespace z80dis
|
||||
opcode_size+=1;
|
||||
|
||||
strcpy(base, buffer);
|
||||
if (opcode_size>4) {
|
||||
opcode_size=4;
|
||||
sprintf(buffer, base, (int8_t)*(memory+2));
|
||||
} else {
|
||||
sprintf(buffer, base, (int8_t)*(memory+1));
|
||||
}
|
||||
if (opcode_size>4) opcode_size=4;
|
||||
sprintf(buffer, base, (int8_t)*(memory+3));
|
||||
//} else {
|
||||
// sprintf(buffer, base, (int8_t)*(memory+1));
|
||||
//}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
||||
Reference in New Issue
Block a user