diff --git a/TODO.md b/TODO.md index 842b83a..fedadc1 100644 --- a/TODO.md +++ b/TODO.md @@ -28,7 +28,9 @@ After some additional development: - [x] External interface - [x] Code execution (except functions) - [x] Functions - - [ ] Print stack + - [x] Print stack + +- [ ] Assembler After some additional development: - [ ] Bytecode loader diff --git a/src/vm/vm.cc b/src/vm/vm.cc index a6b0e5b..61d0971 100644 --- a/src/vm/vm.cc +++ b/src/vm/vm.cc @@ -58,9 +58,12 @@ void VM::step() case Instruction::Sum: stack_.push(binary_operation(stack_.pop(), stack_.pop(), BinaryOperationType::Sum)); break; - case Instruction::Return: + case Instruction::Return: { + Value v = stack_.pop(); stack_.pop_fp(); + stack_.push(v); return; + } default: throw VMInvalidOpcode((uint8_t) op.instruction); }