aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-21 23:55:41 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-21 23:55:41 +0100
commit50ce1b35cd1ce5e93f90c43b0657dced380d89fa (patch)
tree57483370bab94816647167118a7669bffaa42ba4 /src/runtime.c
parentc9b23b7b241fa4cb3aab1ca4436193c943ba46e9 (diff)
downloadovm-50ce1b35cd1ce5e93f90c43b0657dced380d89fa.tar.gz
ovm-50ce1b35cd1ce5e93f90c43b0657dced380d89fa.tar.bz2
ovm-50ce1b35cd1ce5e93f90c43b0657dced380d89fa.zip
Implemented vm routines for OP_XOR_*
Diffstat (limited to 'src/runtime.c')
-rw-r--r--src/runtime.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/runtime.c b/src/runtime.c
index d07f141..19115b6 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -426,3 +426,33 @@ void vm_and_word(vm_t *vm)
vm_push_word(vm, DWORD(a & b));
}
+void vm_xor_byte(vm_t *vm)
+{
+ if (vm->stack.ptr < 2)
+ // TODO: Error STACK_UNDERFLOW
+ return;
+ byte a = vm_pop_byte(vm).as_byte;
+ byte b = vm_pop_byte(vm).as_byte;
+ vm_push_byte(vm, DBYTE(a ^ b));
+}
+
+void vm_xor_hword(vm_t *vm)
+{
+ if (vm->stack.ptr < (HWORD_SIZE * 2))
+ // TODO: Error STACK_UNDERFLOW
+ return;
+ hword a = vm_pop_hword(vm).as_hword;
+ hword b = vm_pop_hword(vm).as_hword;
+ vm_push_hword(vm, DHWORD(a ^ b));
+}
+
+void vm_xor_word(vm_t *vm)
+{
+ if (vm->stack.ptr < (WORD_SIZE * 2))
+ // TODO: Error STACK_UNDERFLOW
+ return;
+ word a = vm_pop_word(vm).as_word;
+ word b = vm_pop_word(vm).as_word;
+ vm_push_word(vm, DWORD(a ^ b));
+}
+