Simple emulation (not even close)
This commit is contained in:
@@ -1,2 +1,9 @@
|
|||||||
# forge
|
# forge
|
||||||
A flash emulator with my own stuff
|
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 |
|
||||||
|
|||||||
+28
-1
@@ -2,6 +2,33 @@ mod binary;
|
|||||||
mod emulator;
|
mod emulator;
|
||||||
mod text;
|
mod text;
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use osui::prelude::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let screen = Screen::new();
|
||||||
|
|
||||||
|
app(&screen).draw(&screen);
|
||||||
|
|
||||||
|
screen.run().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn app(_screen: &Arc<Screen>) -> Rsx {
|
||||||
|
let pc = use_state::<u32>(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}"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user