- Finestra del depurador amb SDL

This commit is contained in:
2024-04-11 17:37:10 +02:00
parent 9a65ef3915
commit dbff53cc2f
8 changed files with 287 additions and 78 deletions

View File

@@ -69,36 +69,58 @@ namespace z80dis
}
}
const char *getAsm(const uint8_t *memory, const bool include_opcode)
const char *getAsm(const uint8_t *memory)
{
opcode_size = 0;
buffer[0]=0;
char txt[20];
const char *base = getBase(memory);
if (strstr(base, "4x")) {
opcode_size+=2;
printOpcode(memory);
const uint16_t word = *(uint16_t*)(memory+1);
sprintf(txt, base, word);
sprintf(buffer, base, word);
} else if (strstr(base, "2x")) {
opcode_size+=1;
printOpcode(memory);
sprintf(txt, base, *(memory+1));
sprintf(buffer, base, *(memory+1));
} else if (strstr(base, "hhd")) {
opcode_size+=1;
printOpcode(memory);
if (opcode_size>4) {
opcode_size=4;
sprintf(txt, base, (int8_t)*(memory+2));
sprintf(buffer, base, (int8_t)*(memory+2));
} else {
sprintf(txt, base, (int8_t)*(memory+1));
sprintf(buffer, base, (int8_t)*(memory+1));
}
} else {
printOpcode(memory);
sprintf(txt, base);
sprintf(buffer, base);
}
strcat(buffer, txt);
return buffer;
}
const char *getOpcode(const uint8_t *memory)
{
opcode_size = 0;
buffer[0]=0;
const char *base = getBase(memory);
if (strstr(base, "4x")) {
opcode_size+=2;
} else if (strstr(base, "2x") || strstr(base, "hhd")) {
opcode_size+=1;
}
printOpcode(memory);
return buffer;
}
const int getOpcodeSize(const uint8_t *memory)
{
opcode_size = 0;
const char *base = getBase(memory);
if (strstr(base, "4x")) {
opcode_size+=2;
} else if (strstr(base, "2x") || strstr(base, "hhd")) {
opcode_size+=1;
}
return opcode_size;
}
}