From 775000e5056b854420ffb40f60660ca009f03f1a Mon Sep 17 00:00:00 2001 From: Leo dev Date: Tue, 28 Oct 2025 19:53:56 +0100 Subject: [PATCH] Simple emulation (not even close) --- README.md | 7 +++++++ src/main.rs | 29 ++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 074a156..36c01b6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # forge A flash emulator with my own stuff + +## Opcodes + +| OP | INST | Action | +|-----------|-----------|-----------| +| 0 | LBK | Goes to the next instruction | +| 1 | HLT | Stops further emulation of the program | diff --git a/src/main.rs b/src/main.rs index a8e0593..608fd7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,33 @@ mod binary; mod emulator; mod text; +use std::sync::Arc; + +use osui::prelude::*; + fn main() { - + let screen = Screen::new(); + + app(&screen).draw(&screen); + + screen.run().unwrap(); +} + +fn app(_screen: &Arc) -> Rsx { + let pc = use_state::(0); + + // Spawn a thread to emulate the program + std::thread::spawn({ + let pc = pc.clone(); + move || loop { + **pc.get() += 1; + } + }); + + rsx! { + FlexRow { + %pc + "Program Counter: {pc}" + } + } }