VM basics #5
4
TODO.md
4
TODO.md
@@ -28,7 +28,9 @@ After some additional development:
|
|||||||
- [x] External interface
|
- [x] External interface
|
||||||
- [x] Code execution (except functions)
|
- [x] Code execution (except functions)
|
||||||
- [x] Functions
|
- [x] Functions
|
||||||
- [ ] Print stack
|
- [x] Print stack
|
||||||
|
|
||||||
|
- [ ] Assembler
|
||||||
|
|
||||||
After some additional development:
|
After some additional development:
|
||||||
- [ ] Bytecode loader
|
- [ ] Bytecode loader
|
||||||
|
|||||||
@@ -58,9 +58,12 @@ void VM::step()
|
|||||||
case Instruction::Sum:
|
case Instruction::Sum:
|
||||||
stack_.push(binary_operation(stack_.pop(), stack_.pop(), BinaryOperationType::Sum));
|
stack_.push(binary_operation(stack_.pop(), stack_.pop(), BinaryOperationType::Sum));
|
||||||
break;
|
break;
|
||||||
case Instruction::Return:
|
case Instruction::Return: {
|
||||||
|
Value v = stack_.pop();
|
||||||
stack_.pop_fp();
|
stack_.pop_fp();
|
||||||
|
stack_.push(v);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw VMInvalidOpcode((uint8_t) op.instruction);
|
throw VMInvalidOpcode((uint8_t) op.instruction);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user