Skip to content

Commit

Permalink
Significantly simplified opcode decoding; all clippy warnings fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeGaL0DoN committed Oct 19, 2024
1 parent 2ce8f40 commit 408a7b0
Show file tree
Hide file tree
Showing 2 changed files with 212 additions and 239 deletions.
12 changes: 12 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::chip_core::{ ChipCore };
use std::path::PathBuf;
use std::process::Command;
use std::time::{ Duration, Instant };
use minifb::{ Key, KeyRepeat, Menu, Window, WindowOptions };

Expand Down Expand Up @@ -95,9 +96,20 @@ impl App {
self.window.set_title(title.as_str());
}

fn clear_console() {
if cfg!(target_os = "windows") {
let _ = Command::new("cmd").args(["/C", "cls"]).status();
}
else {
let _ = Command::new("clear").status();
}
}

fn check_seconds_timer(&mut self) {
if self.seconds_timer.elapsed() >= Duration::from_secs(1) && self.rom_loaded && !self.chip_paused {
let avg_exec_time = (self.execute_times / self.execute_count as f64) * 1000.0;

Self::clear_console();
println!("Average execute time: {:.3} ms", avg_exec_time);

self.execute_times = 0.0;
Expand Down
Loading

0 comments on commit 408a7b0

Please sign in to comment.