VarAction2: Add an ABS opcode

This commit is contained in:
Jonathan G Rennison
2022-06-11 02:33:09 +01:00
parent 3ca95a63d2
commit 6214d0d20d
3 changed files with 33 additions and 1 deletions

View File

@@ -200,6 +200,7 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust &adjust, ScopeResolver
case DSGA_OP_SGT: return ((S)last_value > (S)value) ? 1 : 0;
case DSGA_OP_RSUB: return value - last_value;
case DSGA_OP_STO_NC: _temp_store.StoreValue(adjust.divmod_val, (S)value); return last_value;
case DSGA_OP_ABS: return ((S)last_value < 0) ? -((S)last_value) : (S)last_value;
default: return value;
}
}
@@ -683,6 +684,7 @@ static const char *_dsg_op_special_names[] {
"SGT",
"RSUB",
"STO_NC",
"ABS",
};
static_assert(lengthof(_dsg_op_special_names) == DSGA_OP_SPECIAL_END - DSGA_OP_TERNARY);
@@ -727,6 +729,11 @@ static char *DumpSpriteGroupAdjust(char *p, const char *last, const Deterministi
append_flags();
return p;
}
if (adjust.operation == DSGA_OP_ABS) {
p += seprintf(p, last, "%*sABS", padding, "");
append_flags();
return p;
}
if (adjust.operation == DSGA_OP_STO && adjust.type == DSGA_TYPE_NONE && adjust.variable == 0x1A && adjust.shift_num == 0) {
/* Temp storage store */
highlight_tag = (1 << 16) | (adjust.and_mask & 0xFFFF);