Added Jump opcode
- And fixed a oversight in the match statement while I was at it.
This commit is contained in:
parent
223ce4c1bd
commit
6dd33396f0
1 changed files with 5 additions and 3 deletions
|
@ -8,6 +8,7 @@ pub enum Opcode {
|
||||||
ADD,
|
ADD,
|
||||||
MUL,
|
MUL,
|
||||||
DIV,
|
DIV,
|
||||||
|
JMP,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<u8> for Opcode {
|
impl From<u8> for Opcode {
|
||||||
|
@ -15,9 +16,10 @@ impl From<u8> for Opcode {
|
||||||
match vm {
|
match vm {
|
||||||
0 => Opcode::HLT,
|
0 => Opcode::HLT,
|
||||||
1 => Opcode::LOAD,
|
1 => Opcode::LOAD,
|
||||||
2 => Opcode::ADD,
|
2 => Opcode::JMP,
|
||||||
3 => Opcode::MUL,
|
3 => Opcode::ADD,
|
||||||
4 => Opcode::DIV
|
4 => Opcode::MUL,
|
||||||
|
5 => Opcode::DIV,
|
||||||
_ => Opcode::IGL,
|
_ => Opcode::IGL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue