Skip to content

Commit

Permalink
debug flag view like sameboy
Browse files Browse the repository at this point in the history
  • Loading branch information
pineman committed Jul 21, 2024
1 parent abe0f7d commit a17fc0e
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions fpt-egui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ impl FPT {
let cpu = self.gb.cpu();
ui.vertical(|ui| {
Grid::new("cpu_registers_a-e").num_columns(4).min_col_width(10.0).striped(true).show(ui, |ui| {
ui.colored_label(Color32::LIGHT_BLUE, "A");
ui.monospace(format!("{:08b}", cpu.a()));
ui.code(format!("{:#04X}", cpu.a()));
ui.end_row();
cpu_register!(ui, "A": cpu.a(), "F": cpu.f()); ui.end_row();
cpu_register!(ui, "B": cpu.b(), "C": cpu.c()); ui.end_row();
cpu_register!(ui, "D": cpu.d(), "E": cpu.e()); ui.end_row();
cpu_register!(ui, "H": cpu.a(), "L": cpu.f()); ui.end_row();
Expand All @@ -293,15 +290,14 @@ impl FPT {
ui.separator();
ui.vertical(|ui| {
Grid::new("flags").num_columns(1).min_col_width(10.0).striped(true).show(ui, |ui| {
ui.colored_label(Color32::LIGHT_BLUE, "Z");
ui.code(if cpu.z_flag() { "1" } else { "0" });
ui.colored_label(Color32::LIGHT_BLUE, "N");
ui.code(if cpu.n_flag() { "1" } else { "0" });
ui.end_row();
ui.colored_label(Color32::LIGHT_BLUE, "H");
ui.code(if cpu.h_flag() { "1" } else { "0" });
ui.colored_label(Color32::LIGHT_BLUE, "C");
ui.code(if cpu.c_flag() { "1" } else { "0" });
ui.colored_label(Color32::LIGHT_BLUE, "H");
ui.code(if cpu.h_flag() { "1" } else { "0" });
ui.colored_label(Color32::LIGHT_BLUE, "N");
ui.code(if cpu.n_flag() { "1" } else { "0" });
ui.colored_label(Color32::LIGHT_BLUE, "Z");
ui.code(if cpu.z_flag() { "1" } else { "0" });
});
ui.horizontal(|ui| {
ui.colored_label(Color32::LIGHT_BLUE, "SP");
Expand Down

0 comments on commit a17fc0e

Please sign in to comment.