Skeleto de la operandlegilo preta
This commit is contained in:
parent
ba5b67cd47
commit
494b59bcd2
1 changed files with 24 additions and 2 deletions
|
@ -112,7 +112,7 @@ int disassemble8080(buffer* b, int pc, cJSON* json) {
|
|||
|
||||
|
||||
printf("\n");
|
||||
return opbytes;
|
||||
return opbytes+1;
|
||||
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,28 @@ int disassemble8080(buffer* b, int pc, cJSON* json) {
|
|||
|
||||
printf("Mnemnoic: %s\t", mnemonic);
|
||||
|
||||
// Extract and print operands
|
||||
int operand_count = 0;
|
||||
cJSON *operands = cJSON_GetObjectItem(command, "operands");
|
||||
|
||||
if (operands != NULL && cJSON_IsArray(operands)) {
|
||||
|
||||
operand_count = cJSON_GetArraySize(operands);
|
||||
printf("Number of operands: %d\n", operand_count);
|
||||
for (int i = 0; i < operand_count; i++) {
|
||||
cJSON *operand = cJSON_GetArrayItem(operands, i);
|
||||
cJSON *name = cJSON_GetObjectItem(operand, "name");
|
||||
cJSON *bytes = cJSON_GetObjectItem(operand, "bytes");
|
||||
if (name != NULL && cJSON_IsString(name)) {
|
||||
printf("Operand %d: %s", i + 1, name->valuestring);
|
||||
}
|
||||
if (bytes != NULL && cJSON_IsNumber(bytes)) {
|
||||
printf(", Bytes: %d", bytes->valueint);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("\n");
|
||||
return opbytes;
|
||||
|
@ -162,7 +184,7 @@ void print_keys(cJSON *json) {
|
|||
|
||||
|
||||
int main (int argc, char** argv) {
|
||||
int pc = 0x150; //Program Counter
|
||||
int pc = 0x150; //Program Counter, note GB roms typically start at 0x100
|
||||
|
||||
buffer* buff = read_file(argv);
|
||||
if (buff == NULL) {
|
||||
|
|
Loading…
Reference in a new issue