Implement R_EQUALE, SH_STRUCTREF_GT_IMM and SH_STRUCT_ASSIGN_LOCALREF_ITOB

Used in Widenyo.
This commit is contained in:
kichikuou
2022-03-24 22:00:19 +09:00
parent fc41239175
commit 382dc0d0bd
+16
View File
@@ -843,6 +843,14 @@ static enum opcode execute_instruction(enum opcode opcode)
stack_push(src_var);
break;
}
case R_EQUALE: {
int rhs_var = stack_pop().i;
int rhs_page = stack_pop().i;
int lhs_var = stack_pop().i;
int lhs_page = stack_pop().i;
stack_push(lhs_page == rhs_page && lhs_var == rhs_var ? 1 : 0);
break;
}
case NEW: {
union vm_value v;
create_struct(stack_pop().i, &v);
@@ -1747,6 +1755,14 @@ static enum opcode execute_instruction(enum opcode opcode)
global_set(get_argument(0), local_get(get_argument(1)), true);
break;
}
case SH_STRUCTREF_GT_IMM: {
stack_push(member_get(get_argument(0)).i > get_argument(1) ? 1 : 0);
break;
}
case SH_STRUCT_ASSIGN_LOCALREF_ITOB: {
member_set(get_argument(0), !!local_get(get_argument(1)).i);
break;
}
case SH_LOCAL_ASSIGN_STRUCTREF: {
local_set(get_argument(0), member_get(get_argument(1)).i);
break;