use std::{fs,io};
use minifb;
fn main() {
let mut filename = String::new();
print!("Enter filename of the program to load into memory");
io::stdin().read_line(&mut filename).unwrap();
let program = fs::read_to_string(filename).unwrap();
let mut i = 0;
let mut memory = [0u16;0xFFFFF];
for line in program.lines() {
let mut byte = 0u16;
let mut count = 0;
for digit in line.chars() {
count += 1;
match digit {
'0' => {
byte = byte << 1;
count += 1;
}
'1' => {
byte = (byte << 1) | 1;
count += 1;
}
_ => ()
}
if count > 10 {panic!("10 bits only :)")};
}
memory[i] = byte;
i += 1;
}
}