- [NEW] Ara es poden afegir i llevar simbols des de la consola
This commit is contained in:
28
z80debug.cpp
28
z80debug.cpp
@@ -712,6 +712,34 @@ namespace z80debug
|
|||||||
else { sendToConsoleLog("Syntax error: invalid register"); return; }
|
else { sendToConsoleLog("Syntax error: invalid register"); return; }
|
||||||
} else if (strcmp(cmd, "g")==0 || strcmp(cmd, "goto")==0) {
|
} else if (strcmp(cmd, "g")==0 || strcmp(cmd, "goto")==0) {
|
||||||
getcmd();
|
getcmd();
|
||||||
|
int address = getnum(cmd);
|
||||||
|
if (address<0 || address>=65536) { sendToConsoleLog("Illegal address"); return; }
|
||||||
|
if (z80::getMemTag(address)!=MEMTAG_INST) address = find_previous_opcode(address);
|
||||||
|
z80debug::setcursor(address);
|
||||||
|
} else if (strcmp(cmd, "sym")==0 || strcmp(cmd, "symbol")==0) {
|
||||||
|
getcmd();
|
||||||
|
if (strcmp(cmd, "add")==0) {
|
||||||
|
getcmd();
|
||||||
|
char tmp[12]; strcpy(tmp, cmd);
|
||||||
|
getcmd();
|
||||||
|
if (cmd[0]==0) {
|
||||||
|
z80dis::setSymbol(z80::getPC(), tmp);
|
||||||
|
} else {
|
||||||
|
int value = getnum(cmd);
|
||||||
|
z80dis::setSymbol(value, tmp);
|
||||||
|
}
|
||||||
|
sendToConsoleLog("Symbol added");
|
||||||
|
} else if (strcmp(cmd, "del")==0) {
|
||||||
|
getcmd();
|
||||||
|
if (cmd[0]==0) {
|
||||||
|
z80dis::setSymbol(z80::getPC(), NULL);
|
||||||
|
} else {
|
||||||
|
int value = getnum(cmd);
|
||||||
|
z80dis::setSymbol(value, NULL);
|
||||||
|
}
|
||||||
|
sendToConsoleLog("Symbol removed");
|
||||||
|
}
|
||||||
|
|
||||||
int address = getnum(cmd);
|
int address = getnum(cmd);
|
||||||
if (address<0 || address>=65536) { sendToConsoleLog("Illegal address"); return; }
|
if (address<0 || address>=65536) { sendToConsoleLog("Illegal address"); return; }
|
||||||
if (z80::getMemTag(address)!=MEMTAG_INST) address = find_previous_opcode(address);
|
if (z80::getMemTag(address)!=MEMTAG_INST) address = find_previous_opcode(address);
|
||||||
|
|||||||
14
z80dis.cpp
14
z80dis.cpp
@@ -217,15 +217,15 @@ namespace z80dis
|
|||||||
return symbols[pos];
|
return symbols[pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool comp(uint16_t a, uint16_t b) {
|
|
||||||
return a <= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSymbol(const uint16_t pos, const char *sym)
|
void setSymbol(const uint16_t pos, const char *sym)
|
||||||
{
|
{
|
||||||
strcpy(symbols[pos], sym);
|
if (sym) {
|
||||||
used_symbols.push_back(pos);
|
strcpy(symbols[pos], sym);
|
||||||
sort(used_symbols.begin(), used_symbols.end(), comp);
|
} else {
|
||||||
|
symbols[pos][0] = 0;
|
||||||
|
}
|
||||||
|
used_symbols.clear();
|
||||||
|
for (int i=0; i<65536; ++i) if (symbols[i][0]!=0) used_symbols.push_back(i);
|
||||||
saveSymbols();
|
saveSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user