From 6fb0aa5217b558956f406be2a0a811d1a01443d9 Mon Sep 17 00:00:00 2001 From: haskal Date: Sun, 7 Jun 2020 21:49:22 -0400 Subject: [PATCH] sharks --- src/main.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 156f46a..bb359e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -367,10 +367,10 @@ fn arg_count(opcode: OP) -> usize { } fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) { - //println!("{:#02x?}", &bytes[0..8]); let mut consumed = 0; let def = DefinitionWord(bytes[0]); + print!("{:04x} ", bytes[0]); bytes = &bytes[1..]; consumed += 1; @@ -394,6 +394,7 @@ fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) { if register_count > 0 { let mut aw = bytes[0]; //dbg!(aw); + print!("{:04x} ", bytes[0]); bytes = &bytes[1..]; consumed += 1; @@ -419,17 +420,23 @@ fn parse_instruction(mut bytes: &[u16]) -> (Instruction, usize) { AFLG::Register => args.push(Arg::Register(registers.remove(0))), AFLG::SIN => { args.push(Arg::SIN(bytes[0])); + print!("{:04x} ", bytes[0]); bytes = &bytes[1..]; consumed += 1; } AFLG::SMAIN => { args.push(Arg::SMAIN(bytes[0])); + print!("{:04x} ", bytes[0]); bytes = &bytes[1..]; consumed += 1; } } } + for _ in 0..(4-consumed) { + print!(" "); + } + (Instruction { def, args }, consumed) } @@ -696,7 +703,7 @@ fn main() { m.SIN[1..=sin.inner().len()].copy_from_slice(sin.inner()); m.SCODE[1..=code.inner().len()].copy_from_slice(code.inner()); m.input = vec![ - 0x05,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, + 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, 0x0a]; log::debug!("{:?}", &m.SIN[1..=sin.inner().len()]); @@ -706,7 +713,7 @@ fn main() { // Return here if you don't want it to run - // return; + return; while m.step() {} }