diff --git a/src/bin/chirp-minifb/ui.rs b/src/bin/chirp-minifb/ui.rs index f896c93..b623721 100644 --- a/src/bin/chirp-minifb/ui.rs +++ b/src/bin/chirp-minifb/ui.rs @@ -109,18 +109,13 @@ impl FrameBuffer { // Resizing the buffer does not unmap memory. // After the first use of high-res mode, this is pretty cheap (self.width, self.height) = match screen.len() { - 256 => { - self.buffer.resize(64 * 32, 0); - (64, 32) - } - 1024 => { - self.buffer.resize(128 * 64, 0); - (128, 64) - } + 256 => (64, 32), + 1024 => (128, 64), _ => { unimplemented!("Screen must be 64*32 or 128*64"); } }; + self.buffer.resize(self.width * self.height, 0); for (idx, byte) in screen.iter().enumerate() { for bit in 0..8 { self.buffer[8 * idx + bit] = if byte & (1 << (7 - bit)) as u8 != 0 { diff --git a/src/bin/chirp-shot-viewer/main.rs b/src/bin/chirp-shot-viewer/main.rs index 91b14a6..9b8f023 100644 --- a/src/bin/chirp-shot-viewer/main.rs +++ b/src/bin/chirp-shot-viewer/main.rs @@ -2,6 +2,9 @@ use chirp::{error::Result, *}; use std::{env::args, fs::read}; fn main() -> Result<()> { - bus! {Screen [0..0x100] = &read(args().nth(1).unwrap_or("screen_dump.bin".to_string()))?} - .print_screen() + for screen in args().skip(1).inspect(|screen| println!("{screen}")) { + let screen = read(screen)?; + bus! {Screen [0..screen.len()] = &screen}.print_screen()?; + } + Ok(()) }