VM basics #5

Merged
andre merged 9 commits from vm into master 2026-04-30 13:34:49 -05:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit ae9b84a814 - Show all commits

View File

@@ -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

View File

@@ -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);
}