CPU can now decode instructions, just waiting on the assembler
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
use crate::{common::instructions::Register, emulator::{system::model::State, ui::interface::{Component, EmulatorUI}}};
|
||||
|
||||
pub struct StackInspector {
|
||||
visible: bool
|
||||
}
|
||||
|
||||
impl StackInspector {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for StackInspector {
|
||||
fn visible(&mut self) -> &mut bool {
|
||||
&mut self.visible
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"Stack Inspector"
|
||||
}
|
||||
|
||||
fn category(&self) -> super::interface::Category {
|
||||
super::interface::Category::Memory
|
||||
}
|
||||
|
||||
fn render(&mut self, state: &mut State, ui: &mut egui::Ui, ctx: &egui::Context) {
|
||||
ui.vertical(|ui| {
|
||||
ui.heading("Stack Inspector");
|
||||
egui::ScrollArea::vertical()
|
||||
.id_salt("stack_inspector_scroll")
|
||||
.show(ui, |ui| {
|
||||
egui::Grid::new("stack_grid")
|
||||
.num_columns(2)
|
||||
.spacing([40.0, 4.0])
|
||||
.striped(true)
|
||||
.show(ui, |ui| {
|
||||
ui.label("Address");
|
||||
ui.label("Value");
|
||||
ui.end_row();
|
||||
|
||||
for (i, value) in state.stack_view.iter().take(32).enumerate() {
|
||||
ui.label(format!(
|
||||
"{} [{}]",
|
||||
i,
|
||||
state.reg_file.get(Register::Spr) - i as u32 * 4
|
||||
));
|
||||
ui.label(format!("0x{:08X} ({})", value, value));
|
||||
ui.end_row();
|
||||
}
|
||||
|
||||
if state.stack_view.is_empty() {
|
||||
ui.label("(empty)");
|
||||
ui.label("-");
|
||||
ui.end_row();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user