summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 98bc20fd3f64e1b18e78cff3ba45c78eacbf0801 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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<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.\n({err:?})"); exit(1); }
    };
    BedrockEmulator::new(&bytecode).run();
}