aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-15 05:40:53 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-15 05:40:53 +0100
commitbee6d445bb227f788eb584b0943233613e0d2770 (patch)
tree6cf9b3a385233dd8c02bf02c8130f2a1549be4f2
parent2de37b20e2904d09ff5337c8e0cc04c9fde5f38a (diff)
downloadovm-bee6d445bb227f788eb584b0943233613e0d2770.tar.gz
ovm-bee6d445bb227f788eb584b0943233613e0d2770.tar.bz2
ovm-bee6d445bb227f788eb584b0943233613e0d2770.zip
Added a routine to load a pointer as stack memory
-rw-r--r--src/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index df596a7..3d878b3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,6 +24,13 @@ typedef struct
} stack;
} vm_t;
+void vm_load_stack(vm_t *vm, byte *bytes, size_t size)
+{
+ vm->stack.data = bytes;
+ vm->stack.size = size;
+ vm->stack.ptr = 0;
+}
+
void vm_push_byte(vm_t *vm, data_t b)
{
if (vm->stack.ptr >= vm->stack.size)