editor changes

This commit is contained in:
2025-06-16 03:49:08 +01:00
parent 7f834adbce
commit e9eca34d48
7 changed files with 52 additions and 17 deletions
+8 -6
View File
@@ -5,7 +5,7 @@ use crate::emulator::{
ui::interface::Component,
};
use common::instructions::Register;
use common::{instructions::Register, prelude::Instruction};
pub struct ControlPanel {
visible: bool,
@@ -77,11 +77,13 @@ impl Component for ControlPanel {
));
ui.label(format!("Instructions: {}", state.instructions));
ui.label(format!("PC: 0x{:08X}", state.reg_file.get(Register::Pcx)));
ui.label(format!(
"Last Instruction: {:?}",
"TODO: DECODE INSTRUCTION" // TODO: decode instruction
// Instruction::decode(state.current_state.cir)
));
let instruction = match Instruction::decode(state.reg_file.get(Register::Cir)) {
Ok(instruction) => instruction.to_string(),
Err(_) => "Invalid Instruction".to_string(),
};
ui.label(format!("Instruction: {}", instruction));
});
render_register_table(state, ui, ctx);
+1 -2
View File
@@ -279,9 +279,8 @@ impl Editor {
// builds the current file
if ui.button("Build").clicked() {
let instructions = assembler::assemble(&self.text);
// TODO: uncomment this once assembler works!!!
// let instructions = assembler::assemble(&self.text);
// self.output = instructions
// .iter()
// .flat_map(|i| i.encode().to_le_bytes().to_vec())
+3 -1
View File
@@ -1,5 +1,7 @@
use std::{num::ParseIntError, sync::mpsc::Sender};
use common::prelude::Instruction;
use crate::emulator::{
system::model::{Command, State},
ui::interface::Component,
@@ -129,7 +131,7 @@ impl Component for MemoryInspector {
.fold(0u32, |acc, &byte| acc << 8 | u32::from(byte));
ui.monospace(format!("{combined}"));
// ui.monospace(format!("{:?}", Instruction::decode(combined)));
ui.monospace(format!("{:?}", Instruction::decode(combined)));
ui.monospace("TODO! instruction");
ui.end_row();