- [FIX] ui module should only update renderer when it actually changes
- [NEW] Disassembly window now can scroll with cursors or mouse wheel - [NEW] Added valgrind script and supporting file
This commit is contained in:
75
z80debug.cpp
75
z80debug.cpp
@@ -30,6 +30,8 @@ namespace z80debug
|
||||
|
||||
uint8_t breakpoints[65536];
|
||||
|
||||
uint16_t cursor = 0;
|
||||
|
||||
char temp[256];
|
||||
const char *tohex(int value, int numdigits)
|
||||
{
|
||||
@@ -112,6 +114,26 @@ namespace z80debug
|
||||
*/
|
||||
}
|
||||
|
||||
void printDissasemblerLine(const uint16_t address, const int line)
|
||||
{
|
||||
uint8_t colors[4] = { COLOR_RED, COLOR_CYAN, COLOR_GRAY, COLOR_WHITE};
|
||||
if (is_debugging && (address == z80::getPC())) {
|
||||
for (int i=0; i<4;++i) colors[i]=COLOR_YELLOW;
|
||||
ui::printrect(0,line, 44,1, COLOR_BLUE);
|
||||
}
|
||||
|
||||
if (breakpoints[address]&9) ui::printtxt(0,line,"*", colors[0]);
|
||||
ui::printtxt(1,line,tohex(address,4), colors[1]);
|
||||
|
||||
if (z80::getMemTag(address)==MEMTAG_INST) {
|
||||
ui::printtxt(7,line, z80dis::getOpcode(address), colors[2]);
|
||||
ui::printtxt(19,line, z80dis::getAsm(address), colors[3]);
|
||||
} else {
|
||||
ui::printtxt(7,line, tohex(z80::getMem()[address],2), COLOR_GRAY);
|
||||
ui::printtxt(19,line, "?????????", COLOR_GRAY);
|
||||
}
|
||||
}
|
||||
|
||||
void refresh()
|
||||
{
|
||||
ui::setrenderer(ren);
|
||||
@@ -125,49 +147,24 @@ namespace z80debug
|
||||
ui::printtxt(3,0, "ASSEMBLER:", COLOR_WHITE);
|
||||
|
||||
ui::setoffset(1, 1);
|
||||
/*printtxt(1,0, "19C4:", COLOR_CYAN);
|
||||
printtxt(7,0, "10 EE", COLOR_GRAY);
|
||||
printtxt(19,0, "DJNZ 0x19B4", COLOR_WHITE);
|
||||
printrect(0,1, 44,1, COLOR_BLUE);
|
||||
printtxt(1,1, "19C6:", COLOR_YELLOW);
|
||||
printtxt(7,1, "01 3C 00", COLOR_YELLOW);
|
||||
printtxt(19,1, "LD BC,0x003C", COLOR_YELLOW);*/
|
||||
uint8_t colors[4] = { COLOR_RED, COLOR_CYAN, COLOR_GRAY, COLOR_WHITE};
|
||||
|
||||
uint16_t pc = z80::getPC();
|
||||
uint8_t *memory = z80::getMem();
|
||||
if (is_debugging) {
|
||||
for (int i=0; i<4;++i) colors[i]=COLOR_YELLOW;
|
||||
ui::printrect(0,8, 44,1, COLOR_BLUE);
|
||||
}
|
||||
if (breakpoints[pc]&9) ui::printtxt(0,8,"*", colors[0]);
|
||||
ui::printtxt(1,8,tohex(pc,4), colors[1]);
|
||||
ui::printtxt(7,8, z80dis::getOpcode(pc), colors[2]);
|
||||
ui::printtxt(19,8, z80dis::getAsm(pc), colors[3]);
|
||||
|
||||
uint16_t pc = cursor; //z80::getPC();
|
||||
uint16_t pos = pc;
|
||||
|
||||
printDissasemblerLine(pc, 8);
|
||||
|
||||
for (int i=9;i<18;++i) {
|
||||
pos += z80dis::getOpcodeSize(pos);
|
||||
if (breakpoints[pos]&9) ui::printtxt(0,i,"*", COLOR_RED);
|
||||
ui::printtxt(1,i,tohex(pos,4), COLOR_CYAN);
|
||||
ui::printtxt(7,i, z80dis::getOpcode(pos), COLOR_GRAY);
|
||||
ui::printtxt(19,i, z80dis::getAsm(pos), COLOR_WHITE);
|
||||
printDissasemblerLine(pos, i);
|
||||
}
|
||||
|
||||
pos = pc;
|
||||
for (int i=7;i>=0;--i) {
|
||||
pos = find_previous_opcode(pos);
|
||||
if (breakpoints[pos]&9) ui::printtxt(0,i,"*", COLOR_RED);
|
||||
ui::printtxt(1,i,tohex(pos,4), COLOR_CYAN);
|
||||
if (z80::getMemTag(pos)==MEMTAG_INST) {
|
||||
ui::printtxt(7,i, z80dis::getOpcode(pos), COLOR_GRAY);
|
||||
ui::printtxt(19,i, z80dis::getAsm(pos), COLOR_WHITE);
|
||||
} else {
|
||||
ui::printtxt(7,i, tohex(z80::getMem()[pos],2), COLOR_GRAY);
|
||||
ui::printtxt(19,i, "?????????", COLOR_GRAY);
|
||||
}
|
||||
printDissasemblerLine(pos, i);
|
||||
}
|
||||
//for (int i=0;i<20;++i) printtxt(1,i,tohex(pc,4), COLOR_CYAN);
|
||||
|
||||
ui::setoffset(0, 0);
|
||||
ui::box(46,0,25,8,COLOR_WHITE);
|
||||
@@ -513,6 +510,22 @@ namespace z80debug
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void setcursor(const uint16_t address)
|
||||
{
|
||||
cursor = address;
|
||||
}
|
||||
|
||||
void cursorfwd()
|
||||
{
|
||||
cursor += z80dis::getOpcodeSize(cursor);
|
||||
}
|
||||
|
||||
void cursorback()
|
||||
{
|
||||
cursor = find_previous_opcode(cursor);
|
||||
}
|
||||
|
||||
|
||||
namespace history
|
||||
{
|
||||
void store()
|
||||
|
||||
Reference in New Issue
Block a user