summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 4416f7d4ea5f7a34fb847b775400e35419f06b29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#![feature(bigint_helper_methods)]
#![feature(io_error_more)]
#![feature(split_array)]
#![feature(seek_stream_len)]

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<u8> = 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.");
            eprintln!("({err:?})");
            exit(1);
        }
    };
    BedrockEmulator::new(&bytecode).run();
}