diff --git a/src/bin/main.rs b/src/bin/main.rs index c264f8f..5e04d33 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -39,5 +39,7 @@ fn main() { } println!("Ran program, output of Accum is {}", machine.registers.accumulator); + println!("Machine dump: {}", machine); + } diff --git a/src/machine.rs b/src/machine.rs index 1893ccb..d767ccb 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -27,6 +27,7 @@ use address::Address; use address::AddressDiff; +use std::fmt; use instruction::Instruction; use instruction::ADC; use memory::Memory; @@ -100,6 +101,12 @@ impl Machine { } } +impl fmt::Show for Machine { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "I am a machine") + } +} + #[test] fn add_with_carry_test() {