diff --git a/src/instructions.c b/src/instructions.c index 50e73d1..2183742 100644 --- a/src/instructions.c +++ b/src/instructions.c @@ -198,12 +198,17 @@ void push() { } void pop() { + if (!is_reg(args->arg1)) { + last_check_args_code = ARG1_WRONG; + return; + } + if (top == -1) { //stack underflow last_stack_code = UNDERFLOW; return; } - --top; + *get_reg(args->arg1) = stack[top--]; } void and() {