- [NEW] La finestra de debug es pot redimensionar i el contingut s'ajusta
- [NEW] Es poden redimensionar les seccions de la finestra de debug - [NEW] Afegit visor de simbols al debugger
This commit is contained in:
+38
@@ -2,12 +2,15 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "z80.h"
|
||||
#include <vector>
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
namespace z80dis
|
||||
{
|
||||
char buffer[256];
|
||||
int opcode_size = 0;
|
||||
char symbols[65536][15];
|
||||
std::vector<uint16_t> used_symbols;
|
||||
|
||||
// $%04x
|
||||
// $%02x
|
||||
@@ -39,6 +42,7 @@ namespace z80dis
|
||||
|
||||
void loadSymbols()
|
||||
{
|
||||
used_symbols.clear();
|
||||
for (int i=0; i<65536; ++i) symbols[i][0] = 0;
|
||||
FILE *f = fopen("symbols.txt", "r");
|
||||
while (true) {
|
||||
@@ -47,6 +51,17 @@ namespace z80dis
|
||||
const int result = fscanf(f, "%x %s", &address, tmp);
|
||||
if (result != 2) break;
|
||||
strcpy(symbols[address], tmp);
|
||||
used_symbols.push_back(address);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void saveSymbols()
|
||||
{
|
||||
FILE *f = fopen("symbols.txt", "w");
|
||||
for (auto sym_addr : used_symbols)
|
||||
{
|
||||
fprintf(f, "0x%x %s\n", sym_addr, symbols[sym_addr]);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
@@ -202,4 +217,27 @@ namespace z80dis
|
||||
return symbols[pos];
|
||||
}
|
||||
|
||||
bool comp(uint16_t a, uint16_t b) {
|
||||
return a <= b;
|
||||
}
|
||||
|
||||
void setSymbol(const uint16_t pos, const char *sym)
|
||||
{
|
||||
strcpy(symbols[pos], sym);
|
||||
used_symbols.push_back(pos);
|
||||
sort(used_symbols.begin(), used_symbols.end(), comp);
|
||||
saveSymbols();
|
||||
}
|
||||
|
||||
const int getNumSymbols()
|
||||
{
|
||||
return used_symbols.size();
|
||||
}
|
||||
|
||||
const uint16_t getSymbolAddress(const int pos)
|
||||
{
|
||||
return used_symbols[pos];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user