From 4223055c0cbcbb1136b4f3a59f21ecacd7f0bcd0 Mon Sep 17 00:00:00 2001 From: able Date: Tue, 23 May 2023 02:29:31 -0500 Subject: [PATCH] minor changes and a bug fix --- hbvm/assets/inf_loop.hb | Bin 0 -> 10 bytes hbvm/src/engine/mod.rs | 3 +-- hbvm/src/main.rs | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 hbvm/assets/inf_loop.hb diff --git a/hbvm/assets/inf_loop.hb b/hbvm/assets/inf_loop.hb new file mode 100644 index 0000000000000000000000000000000000000000..65168fa85d41f53973238f9cc5d07ae0beba9373 GIT binary patch literal 10 LcmZQbVSoYv1C9V? literal 0 HcmV?d00001 diff --git a/hbvm/src/engine/mod.rs b/hbvm/src/engine/mod.rs index 21b575d..bbc23cd 100644 --- a/hbvm/src/engine/mod.rs +++ b/hbvm/src/engine/mod.rs @@ -284,8 +284,7 @@ F5-F9 {:016X} {:016X} {:016X} {:016X} {:016X}", panic!("Not a register.") } } - - self.index += 4; + self.index += 5; } (2, 2) => { let mut lhs_array = [0; 8]; diff --git a/hbvm/src/main.rs b/hbvm/src/main.rs index 583383a..59cbb2f 100644 --- a/hbvm/src/main.rs +++ b/hbvm/src/main.rs @@ -5,25 +5,25 @@ use hbvm::{ }; fn main() -> Result<(), RuntimeErrors> { + // TODO: Grab program from cmdline #[rustfmt::skip] let prog: Vec = vec![ - // NOP as u8, NOP as u8, - // 255, 10, - ADD as u8, EightBit as u8, 100, 20, 0xA7, + NOP as u8, + 255, 10, + // ADD as u8, EightBit as u8, 100, 20, 0xA7, // ADD as u8, // EightBit as u8, 1, 0, 0xB0, // ADD as u8, - // SixtyFourBit as u8, - // 0, 0, 0, 0, 0, 0, 0, 0, - // 0, 0, 0, 0, 0, 0, 0, 2, 0xD0, - // SUB as u8, EightBit as u8, 255, 0, 0xA7, - // DIV as u8, EightBit as u8, 12, 5, 0xA8, - // ADD as u8, Register8 as u8, 0xA7, 0xB0, 0xA7, + // SixtyFourBit as u8, + // 0, 0, 0, 0, 0, 0, 0, 0, + // 0, 0, 0, 0, 0, 0, 0, 2, 0xD0, + SUB as u8, EightBit as u8, 255, 0, 0xA0, + // This currently fails because of a lack of register to register addition + // ADD as u8, Register8 as u8, 0xA0, 0xA0, 0xA1, // LOAD as u8, AddrToReg as u8, // 0, 0, 0, 0, 0, 0, 0, 2, // 0xA0, - // JUMP as u8, 0, 0, 0, 0, 0, 0, 0, 0, - + JUMP as u8, 0, 0, 0, 0, 0, 0, 0, 0, ]; let mut eng = Engine::new(prog);