Skip to content

Commit

Permalink
Add missing opcode names to the disassembler.
Browse files Browse the repository at this point in the history
Also fix instruction coloring and naming in disassembler.

- For some reason, all LOAD_ instructions are called FIELD_ now. Weren't
  they called INDIRECT_ once? Well, anyway, not touching that, just
  making it consistent with itself.

- Match new instructions in color to existing ones doing the same.
  • Loading branch information
divVerent committed Nov 1, 2024
1 parent 5950e1b commit d95c435
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 33 deletions.
57 changes: 24 additions & 33 deletions prvm_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "progsvm.h"

// Should only contain the opcodes DP actually implements, so unknown opcodes
// are more readably marked as such in disassembly. Thus, best keep this in sync
// with the list in prvm_execprogram.h.
static const char *prvm_opnames[] =
{
"^5DONE",

"MUL_F",
"MUL_V",
"MUL_FV",
"MUL_VF",

"DIV",

"ADD_F",
"ADD_V",

"SUB_F",
"SUB_V",

Expand Down Expand Up @@ -79,16 +78,13 @@ static const char *prvm_opnames[] =
"^1STOREP_FNC",

"^5RETURN",

"^2NOT_F",
"^2NOT_V",
"^2NOT_S",
"^2NOT_ENT",
"^2NOT_FNC",

"^5IF",
"^5IFNOT",

"^3CALL0",
"^3CALL1",
"^3CALL2",
Expand All @@ -98,20 +94,14 @@ static const char *prvm_opnames[] =
"^3CALL6",
"^3CALL7",
"^3CALL8",

"^1STATE",

"^5GOTO",

"^2AND",
"^2OR",

"BITAND",
"BITOR",




NULL,
NULL,
NULL,
Expand Down Expand Up @@ -178,8 +168,8 @@ NULL,
NULL,
NULL,

"LOAD_I",
"STOREP_I",
"^6FIELD_I",
"^1STOREP_I",

NULL,
NULL,
Expand All @@ -199,29 +189,30 @@ NULL,

"DIV_VF",

NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,

"STORE_P",
"GLOBALADDRESS",
"ADD_PIW",
"LOADA_F",
"LOADA_V",
"LOADA_S",
"LOADA_ENT",
"LOADA_FLD",
"LOADA_FNC",
"LOADA_I",

NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"STORE_P",
"^6FIELD_P"

"LOADP_F",
"LOADP_V",
"LOADP_S",
"LOADP_ENT",
"LOADP_FLD",
"LOADP_FNC",
"LOADP_I",

"LE_I",
"GE_I",
Expand Down
1 change: 1 addition & 0 deletions prvm_execprogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ prvm_eval_t *src;
NULL,
NULL,
NULL,

&&handle_OP_GLOBALADDRESS,
&&handle_OP_ADD_PIW,
&&handle_OP_LOADA_F,
Expand Down

0 comments on commit d95c435

Please sign in to comment.