[gamecode] Improve hops instruction readability

This commit is contained in:
Bill Currie 2023-08-27 12:28:16 +09:00
parent 74b7e0a35b
commit 727b490a0c
2 changed files with 13 additions and 4 deletions

View file

@ -221,7 +221,7 @@ hops_formats = {
"opcode": "OP_HOPS", "opcode": "OP_HOPS",
"mnemonic": "hops", "mnemonic": "hops",
"opname": "hops", "opname": "hops",
"format": "%Ga<%Hb>, %gc", "format": "%Hb %Ga, %gc",
"widths": "-1, 0, 1", "widths": "-1, 0, 1",
"types": "ev_void, ev_short, ev_void", "types": "ev_void, ev_short, ev_void",
} }

View file

@ -1205,11 +1205,20 @@ extend_string (pr_debug_data_t *data, pr_uint_t ext)
static const char * static const char *
hop_string (pr_debug_data_t *data, pr_uint_t hop) hop_string (pr_debug_data_t *data, pr_uint_t hop)
{ {
progs_t *pr = data->pr;
prdeb_resources_t *res = pr->pr_debug_resources;
static const char *hop_string[] = { static const char *hop_string[] = {
"&", "|", "^", "+", "and", "or", "xor", "add",
"!&", "!|", "!^", "+", "nad", "nor", "xnor", "add",
}; };
return hop_string[hop & 7]; static const char *type_string[2][8] = {
{"I", "I", "I", "I", "I", "I", "I", "F"},
{"L", "L", "L", "L", "L", "L", "L", "D"},
};
return va (res->va, "%s.%s{%d}",
hop_string[hop & 7],
type_string[(hop >> 5) & 1][hop & 7],
((hop >> 3) & 3) + 1);
} }
static const char * static const char *