add disassembly & display functions

This commit is contained in:
Michael Sippel 2024-05-12 04:21:17 +02:00
parent 7efee58c4d
commit 4fb80fe158
Signed by: senvas
GPG key ID: F96CF119C34B64A6
3 changed files with 62 additions and 1 deletions

View file

@ -12,6 +12,20 @@ pub enum VM_Instruction {
BitwiseNot,
}
impl VM_Instruction {
pub fn param_length(&self) -> usize {
match self {
VM_Instruction::Jmp |
VM_Instruction::Call |
VM_Instruction::Branch |
VM_Instruction::Lit => {
1
},
_ => 0
}
}
}
pub struct VM {
pub data_stack: Vec< VM_Word >,
pub call_stack: Vec< VM_Word >,