feat(egui): add timer window

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-06-02 02:44:32 -05:00
parent b1bf6c5868
commit 86f3a897f1
2 changed files with 28 additions and 0 deletions

View File

@ -72,6 +72,10 @@ impl Bus {
self.timer.step(cycles);
self.sound.step(cycles);
}
pub fn timer(&self) -> Timer {
self.timer
}
}
impl Bus {

View File

@ -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| {