Added very bad screen & readme
This commit is contained in:
+35
-5
@@ -1,9 +1,12 @@
|
||||
#![allow(dead_code)]
|
||||
use core::panic;
|
||||
use minifb::{Key, Window, WindowOptions};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt::write,
|
||||
fs::{self, File},
|
||||
io::Read,
|
||||
mem,
|
||||
path::PathBuf,
|
||||
thread::sleep,
|
||||
time::Duration,
|
||||
@@ -3442,7 +3445,7 @@ fn main() {
|
||||
Ok(()) => {}
|
||||
};
|
||||
let binary = match fs::File::open(PathBuf::from(
|
||||
"/Users/kline/projects/winter/georgeemu/src/george",
|
||||
"/Users/kline/projects/winter/george-emu/src/george",
|
||||
)) {
|
||||
Ok(file) => file,
|
||||
Err(error) => panic!("Couldn't open binary file! {:?}", error),
|
||||
@@ -3451,10 +3454,37 @@ fn main() {
|
||||
Err(error) => println!("{:?}", error),
|
||||
Ok(_) => {}
|
||||
};
|
||||
let mut cpu = Cpu::new(memory);
|
||||
match cpu.reset() {
|
||||
Err(error) => println!("{error:?}"),
|
||||
Ok(()) => {}
|
||||
for i in 0x6000..0xBF00 {
|
||||
if i > 0 && i < 0x9000 {
|
||||
memory.write(i, 0x01).unwrap();
|
||||
} else {
|
||||
memory.write(i, 0x22).unwrap();
|
||||
}
|
||||
}
|
||||
let bitmask = [128, 64, 32, 16, 8, 4, 2, 1];
|
||||
// let bitmask = [1, 2, 4, 8, 16, 32, 64, 128];
|
||||
let mut buffer: Vec<u32> = vec![0; 512 * 380];
|
||||
let mut window = match Window::new("george", 512, 380, WindowOptions::default()) {
|
||||
Ok(win) => win,
|
||||
Err(error) => {
|
||||
println!("unable to create window {}", error);
|
||||
return;
|
||||
}
|
||||
};
|
||||
while window.is_open() && !window.is_key_down(Key::Escape) {
|
||||
for addr in 0x6000..0xBF00 {
|
||||
let byte = memory.read(addr).unwrap();
|
||||
for i in 0..8 {
|
||||
match byte & bitmask[i] == 0 {
|
||||
true => continue,
|
||||
false => buffer[(addr - 0x6000) as usize * 8 + i] = 0xFFFFFF,
|
||||
}
|
||||
}
|
||||
}
|
||||
window.update_with_buffer(&buffer, 512, 380).unwrap();
|
||||
}
|
||||
let mut cpu = Cpu::new(memory);
|
||||
cpu.reset().unwrap();
|
||||
window.limit_update_rate(Some(std::time::Duration::from_micros(16600)));
|
||||
cpu.execute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user