Unnamed repository; edit this file 'description' to name the repository.
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
29
30
31
32
33
34
|
use std::{
io::{self, Stdout},
process::ExitCode,
};
use lemu::{Executor, Output};
fn main() -> ExitCode {
let mut args = std::env::args();
args.next().unwrap(); // path to executable
for file in args {
let f = std::fs::read_to_string(&file).unwrap();
let mut lex: Executor<Stdout> = match Executor::with_output(io::stdout())
.large_display()
.program(&f)
{
Ok(x) => x,
Err(e) => {
eprint!("{}", e.diagnose(&f));
return ExitCode::FAILURE;
}
};
println!("{lex}");
let now = std::time::Instant::now();
lex.run();
dbg!(now.elapsed());
dbg!(lex.instructions_ran);
let Output { displays, .. } = lex.output();
for ((d, _), i) in displays.iter().zip(1..=displays.len()) {
d.save(format!("image{i}.png"));
}
}
ExitCode::SUCCESS
}
|