Implemented all opcodes, including LOADI and STOREI

This commit is contained in:
2017-01-24 19:47:19 +01:00
parent 1bd5b0a6da
commit 499b0539d3
5 changed files with 55 additions and 46 deletions

View File

@@ -1,12 +1,11 @@
#include "stack.h"
#include <stdlib.h>
t_stack stack_new(const int size) {
t_stack stack;
void stack_init(t_stack& stack, const int size) {
if (stack.data != nullptr) free(stack.data);
stack.data = (unsigned char*)malloc(size);
stack.max = size;
stack.top = -1;
stack.data = (unsigned char*)malloc(size);
return stack;
}
const bool stack_isempty(t_stack& stack) {