diff --git a/src/bus.rs b/src/bus.rs index e37fb6c..adb19fd 100644 --- a/src/bus.rs +++ b/src/bus.rs @@ -72,6 +72,10 @@ impl Bus { self.timer.step(cycles); self.sound.step(cycles); } + + pub fn timer(&self) -> Timer { + self.timer + } } impl Bus { diff --git a/src/gui.rs b/src/gui.rs index f7b8087..06daaec 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -143,6 +143,30 @@ impl Egui { }); }); + egui::Window::new("Timer").show(ctx, |ui| { + let timer = game_boy.bus.timer(); + + ui.horizontal(|ui| { + ui.label("DIV"); + ui.monospace(format!("{:#06X}", timer.divider)); + }); + + ui.horizontal(|ui| { + ui.label("TIMA"); + ui.monospace(format!("{:#04X}", timer.counter)); + }); + + ui.horizontal(|ui| { + ui.label("TMA"); + ui.monospace(format!("{:#04X}", timer.modulo)); + }); + + ui.horizontal(|ui| { + ui.label("TAC"); + ui.monospace(format!("{:?}", timer.control)); + }); + }); + egui::Window::new("Registers") .open(&mut self.show_registers) .show(ctx, |ui| {