From 6dd33396f0d4df66255b710d9b9cb6fa265b0639 Mon Sep 17 00:00:00 2001 From: Anthony Foxclaw <35226681+tonytins@users.noreply.github.com> Date: Thu, 6 Feb 2020 17:42:51 -0500 Subject: [PATCH] Added Jump opcode - And fixed a oversight in the match statement while I was at it. --- src/instruction.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/instruction.rs b/src/instruction.rs index 410cd81..c99c802 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -8,6 +8,7 @@ pub enum Opcode { ADD, MUL, DIV, + JMP, } impl From for Opcode { @@ -15,9 +16,10 @@ impl From for Opcode { match vm { 0 => Opcode::HLT, 1 => Opcode::LOAD, - 2 => Opcode::ADD, - 3 => Opcode::MUL, - 4 => Opcode::DIV + 2 => Opcode::JMP, + 3 => Opcode::ADD, + 4 => Opcode::MUL, + 5 => Opcode::DIV, _ => Opcode::IGL, } }