2023-06-07 17:25:38 -05:00
|
|
|
use hbbytecode::opcode;
|
2023-06-06 15:56:28 -05:00
|
|
|
use hbvm::{validate::validate, vm::Vm, RuntimeErrors};
|
2023-04-18 18:08:30 -05:00
|
|
|
|
|
|
|
fn main() -> Result<(), RuntimeErrors> {
|
2023-05-23 02:29:31 -05:00
|
|
|
// TODO: Grab program from cmdline
|
2023-04-22 17:17:49 -05:00
|
|
|
#[rustfmt::skip]
|
2023-06-06 15:03:37 -05:00
|
|
|
let prog = &[];
|
2023-04-22 16:06:33 -05:00
|
|
|
|
2023-06-06 15:56:28 -05:00
|
|
|
if let Err(e) = validate(prog) {
|
|
|
|
eprintln!("Program validation error: {e:?}");
|
|
|
|
return Ok(());
|
|
|
|
} else {
|
|
|
|
unsafe {
|
|
|
|
let mut vm = Vm::new_unchecked(prog);
|
2023-06-07 17:25:38 -05:00
|
|
|
vm.memory.insert_test_page();
|
2023-06-06 15:56:28 -05:00
|
|
|
vm.run();
|
|
|
|
}
|
2023-06-06 15:03:37 -05:00
|
|
|
}
|
2023-04-22 16:06:33 -05:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn time() -> u32 {
|
|
|
|
9
|
|
|
|
}
|