mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-07 14:28:12 +03:00
Implement OBJSWAP instruction
This commit is contained in:
+1
-1
@@ -196,7 +196,7 @@ const struct instruction instructions[NR_OPCODES] = {
|
||||
OP(FTOS, 0),
|
||||
OP(S_MOD, 0),
|
||||
OP(S_PLUSA2, 0),
|
||||
OP(OBJSWAP, 0), // TODO
|
||||
OP(OBJSWAP, 0),
|
||||
OP(S_ERASE, 0), // TODO
|
||||
OP(SR_REF2, 0), // TODO
|
||||
OP(S_ERASE2, 0),
|
||||
|
||||
@@ -751,6 +751,15 @@ static void execute_instruction(enum opcode opcode)
|
||||
heap_ref(stack_pop().i);
|
||||
break;
|
||||
}
|
||||
case OBJSWAP: {
|
||||
stack_pop(); // type
|
||||
union vm_value *b = stack_pop_var();
|
||||
union vm_value *a = stack_pop_var();
|
||||
union vm_value tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
break;
|
||||
}
|
||||
//
|
||||
// --- Control Flow ---
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user