cargo fmt
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
pub mod system;
|
pub mod system;
|
||||||
pub mod ui;
|
pub mod ui;
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ impl Executable for Instruction {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right shifts the value in Reg by the given amount (either a register, or a literal value).
|
// Right shifts the value in Reg by the given amount (either a register, or a literal value).
|
||||||
Self::ShiftRight(src, reg, imm) => {
|
Self::ShiftRight(src, reg, imm) => {
|
||||||
let regval = cpu.get(reg);
|
let regval = cpu.get(reg);
|
||||||
*cpu.reg(reg) = shr(
|
*cpu.reg(reg) = shr(
|
||||||
@@ -339,7 +339,7 @@ impl Executable for Instruction {
|
|||||||
cpu.begin_interrupt(interrupt_code);
|
cpu.begin_interrupt(interrupt_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns from an interrupt,
|
// Returns from an interrupt,
|
||||||
Self::IntReturn => {
|
Self::IntReturn => {
|
||||||
cpu.end_interrupt();
|
cpu.end_interrupt();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
use std::{num::ParseIntError, sync::mpsc::Sender};
|
use std::{num::ParseIntError, sync::mpsc::Sender};
|
||||||
|
|
||||||
use crate::emulator::{system::model::{Command, State}, ui::interface::Component};
|
use crate::emulator::{
|
||||||
|
system::model::{Command, State},
|
||||||
|
ui::interface::Component,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct MemoryInspector {
|
pub struct MemoryInspector {
|
||||||
view_size: u32,
|
view_size: u32,
|
||||||
@@ -36,7 +39,7 @@ impl Component for MemoryInspector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render(&mut self, state: &mut State, ui: &mut egui::Ui, ctx: &egui::Context) {
|
fn render(&mut self, state: &mut State, ui: &mut egui::Ui, ctx: &egui::Context) {
|
||||||
// Right column - Memory
|
// Right column - Memory
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.heading("Memory Inspector");
|
ui.heading("Memory Inspector");
|
||||||
ui.add_space(10.0);
|
ui.add_space(10.0);
|
||||||
@@ -63,7 +66,9 @@ impl Component for MemoryInspector {
|
|||||||
if search_clicked || enter_pressed {
|
if search_clicked || enter_pressed {
|
||||||
if let Ok(new) = parse_address(&self.addr_input) {
|
if let Ok(new) = parse_address(&self.addr_input) {
|
||||||
self.view_addr = new;
|
self.view_addr = new;
|
||||||
self.sender.send(Command::Read(new, self.view_size)).unwrap();
|
self.sender
|
||||||
|
.send(Command::Read(new, self.view_size))
|
||||||
|
.unwrap();
|
||||||
} else {
|
} else {
|
||||||
state.error = Some("Invalid address".to_string());
|
state.error = Some("Invalid address".to_string());
|
||||||
}
|
}
|
||||||
@@ -144,4 +149,4 @@ fn parse_address(address: &str) -> Result<u32, ParseIntError> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32::from_str_radix(address, 10)
|
u32::from_str_radix(address, 10)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
pub mod control_unit;
|
pub mod control_unit;
|
||||||
pub mod interface;
|
pub mod interface;
|
||||||
pub mod menu;
|
|
||||||
pub mod memory_inspector;
|
pub mod memory_inspector;
|
||||||
pub mod stack_inspector;
|
pub mod menu;
|
||||||
|
pub mod stack_inspector;
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
use crate::{common::instructions::Register, emulator::{system::model::State, ui::interface::{Component, EmulatorUI}}};
|
use crate::{
|
||||||
|
common::instructions::Register,
|
||||||
|
emulator::{
|
||||||
|
system::model::State,
|
||||||
|
ui::interface::{Component, EmulatorUI},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
pub struct StackInspector {
|
pub struct StackInspector {
|
||||||
visible: bool
|
visible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StackInspector {
|
impl StackInspector {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self { visible: false }
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +64,3 @@ impl Component for StackInspector {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -5,7 +5,10 @@ use std::{
|
|||||||
|
|
||||||
use dsa_rs::emulator::{
|
use dsa_rs::emulator::{
|
||||||
system::{emulator::run_emulator, memory::MainStore, processor::Processor},
|
system::{emulator::run_emulator, memory::MainStore, processor::Processor},
|
||||||
ui::{control_unit::ControlPanel, interface::EmulatorUI, memory_inspector::MemoryInspector, stack_inspector::StackInspector},
|
ui::{
|
||||||
|
control_unit::ControlPanel, interface::EmulatorUI, memory_inspector::MemoryInspector,
|
||||||
|
stack_inspector::StackInspector,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() -> Result<(), eframe::Error> {
|
fn main() -> Result<(), eframe::Error> {
|
||||||
|
|||||||
Reference in New Issue
Block a user