add disassembly & display functions
This commit is contained in:
parent
7efee58c4d
commit
4fb80fe158
3 changed files with 62 additions and 1 deletions
src
14
src/vm.rs
14
src/vm.rs
|
@ -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 >,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue