mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
[gamecode] Add memset instructions
This commit is contained in:
parent
d418be31e6
commit
6ca85d770d
3 changed files with 35 additions and 1 deletions
|
@ -395,6 +395,9 @@ typedef enum {
|
|||
OP_MOD_I,
|
||||
OP_MOD_F,
|
||||
OP_MOD_D,
|
||||
|
||||
OP_MEMSET,
|
||||
OP_MEMSETI,
|
||||
} pr_opcode_e;
|
||||
#define OP_BREAK 0x8000
|
||||
|
||||
|
|
|
@ -404,6 +404,14 @@ check_stack_pointer (progs_t *pr, pointer_t stack, int size)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
pr_memset (pr_type_t *dst, int val, int count)
|
||||
{
|
||||
while (count-- > 0) {
|
||||
(*dst++).integer_var = val;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PR_ExecuteProgram
|
||||
|
||||
|
@ -1608,7 +1616,20 @@ op_call:
|
|||
pr->pr_globals + OPA.integer_var,
|
||||
st->b * 4);
|
||||
break;
|
||||
|
||||
case OP_MEMSET:
|
||||
if (pr_boundscheck->int_val) {
|
||||
PR_BoundsCheckSize (pr, OPC.pointer_var, OPB.uinteger_var);
|
||||
}
|
||||
pr_memset (pr->pr_globals + OPC.pointer_var, OPA.integer_var,
|
||||
OPB.integer_var);
|
||||
break;
|
||||
case OP_MEMSETI:
|
||||
if (pr_boundscheck->int_val) {
|
||||
PR_BoundsCheckSize (pr, OPC.pointer_var, st->b);
|
||||
}
|
||||
pr_memset (pr->pr_globals + OPC.pointer_var, OPA.integer_var,
|
||||
st->b);
|
||||
break;
|
||||
case OP_GE_D:
|
||||
OPC.float_var = OPA_double_var >= OPB_double_var;
|
||||
break;
|
||||
|
|
|
@ -1183,6 +1183,16 @@ VISIBLE const opcode_t pr_opcodes[] = {
|
|||
PROG_VERSION,
|
||||
"%Ga, %Gb, %Gc",
|
||||
},
|
||||
{"<MEMSET>", "memset", OP_MEMSET, true,
|
||||
ev_integer, ev_integer, ev_pointer,
|
||||
PROG_VERSION,
|
||||
"%Ga, %Gb, %Gc",
|
||||
},
|
||||
{"<MEMSET>", "memseti", OP_MEMSETI, true,
|
||||
ev_integer, ev_short, ev_pointer,
|
||||
PROG_VERSION,
|
||||
"%Ga, %Gb, %Gc",
|
||||
},
|
||||
|
||||
{"<PUSH>", "push.s", OP_PUSH_S, false,
|
||||
ev_string, ev_invalid, ev_invalid,
|
||||
|
|
Loading…
Reference in a new issue