From 77067f6e244a9cf4a6ef59df2e3d735b4f172c35 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sun, 24 Dec 2023 22:19:11 +1300 Subject: First commit --- src/main.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..98bc20f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,22 @@ +#![feature(bigint_helper_methods)] +#![feature(split_array)] + +use std::io::Read; +use std::process::exit; + +mod devices; +mod emulator; + +pub use devices::*; +pub use emulator::*; + +fn main() { + // Read bytecode from standard input + let mut bytecode: Vec = Vec::new(); + match std::io::stdin().take(64*1024).read_to_end(&mut bytecode) { + Ok(len) => eprintln!("Loaded {len} bytes of bytecode."), + Err(err) => { eprintln!("Could not read from standard input, quitting.\n({err:?})"); exit(1); } + }; + BedrockEmulator::new(&bytecode).run(); +} + -- cgit v1.2.3-70-g09d2