Website Summary Files Commits Branches @commit @diff @stats
path: root / vm / src
diff options
context:
space:
mode:
1 files changed, 12 insertions, 5 deletions
-rw-r--r--vm/src/vmm/mod.rs17
diff --git a/vm/src/vmm/mod.rs b/vm/src/vmm/mod.rs
index 9ad250f..0bfca73 100644
--- a/vm/src/vmm/mod.rs
+++ b/vm/src/vmm/mod.rs
@@ -10,9 +10,16 @@ pub(crate) struct VirtualMachineMonitor {
refresh_rate: u64,
}
-macro_rules! above {
+
+macro_rules! info {
+ () => {
+ print!("\x1B[90m|\x1B[0m{:^8}\x1B[90m|> \x1B[0m", "RUN")
+ };
+ (error $str:expr) => {
+ info!(format!("\x1B[41m{:^8}\x1B[0m", $str))
+ };
($str:expr) => {
- concat!("\x1B7\x1B[1F|", $str, "|\x1B8")
+ print!("\x1B7\x1B[1G\x1B[90m|\x1B[0m{:^8}\x1B[90m|> \x1B[0m\x1B8", $str)
};
}
@@ -32,7 +39,7 @@ impl VirtualMachineMonitor {
tx.send(buffer).unwrap();
});
- print!("\n> ");
+ info!();
loop {
match rx.try_recv() {
Ok(input) => {
@@ -44,16 +51,16 @@ impl VirtualMachineMonitor {
println!("{}", msg);
}
}
- print!("\n> ");
+ info!();
},
_ => {},
}
{
if vm.is_halted() {
- print!(above!("HALTED!"));
}
}
+ info!(error "HALTED");
let _ = stdout().flush();
thread::sleep(time::Duration::from_millis(self.refresh_rate));