diff --git a/src/display.rs b/src/display.rs index 64f33c0..afd7f23 100644 --- a/src/display.rs +++ b/src/display.rs @@ -10,7 +10,7 @@ impl Display { let video = sdl_ctx.video().unwrap(); let window = video .window( - "FooBar", + "chip8-rs", (crate::SCREEN_WIDTH * crate::SCREEN_SCALE) as u32, (crate::SCREEN_HEIGHT * crate::SCREEN_SCALE) as u32) .position_centered() @@ -30,7 +30,7 @@ impl Display { Display { canvas, } - } + } pub fn draw(&mut self, pixel: &[[u8; crate::SCREEN_WIDTH]; crate::SCREEN_HEIGHT]) { for (y, &row) in pixel.iter().enumerate() { diff --git a/src/fontset.rs b/src/fontset.rs index 05c6f15..f48d310 100644 --- a/src/fontset.rs +++ b/src/fontset.rs @@ -1,5 +1,5 @@ pub (crate) const FONT: [u8; 80] = [ - 0xF0, 0x90, 0x90, 0x90, 0xF0, // 0 + 0xF0, 0x90, 0x90, 0x90, 0xF0, // 0 0x20, 0x60, 0x20, 0x20, 0x70, // 1 0xF0, 0x10, 0xF0, 0x80, 0xF0, // 2 0xF0, 0x10, 0xF0, 0x10, 0xF0, // 3 diff --git a/src/input.rs b/src/input.rs index be26811..485bb2a 100644 --- a/src/input.rs +++ b/src/input.rs @@ -19,7 +19,7 @@ impl Input { return Err(()); } } - + // get all inputs let input: Vec = self.events .keyboard_state() diff --git a/src/main.rs b/src/main.rs index 9ff3b72..5220316 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,5 +34,4 @@ fn main() { let cartridge = Cartridge::new(&game_file.unwrap()); processor.start(&cartridge.rom); - } diff --git a/src/processor.rs b/src/processor.rs index 44dca94..b93734e 100644 --- a/src/processor.rs +++ b/src/processor.rs @@ -137,13 +137,13 @@ impl Processor { // n or nibble - A 4-bit value, the lowest 4 bits of the instruction let n = nibbles.3 as usize; - + // x - A 4-bit value, the lower 4 bits of the high byte of the instruction let x = nibbles.1 as usize; // y - A 4-bit value, the upper 4 bits of the low byte of the instruction let y = nibbles.2 as usize; - + //kk or byte - An 8-bit value, the lowest 8 bits of the instruction let kk = (opcode & 0x00FF) as u8;