csv: print multiple shots at a time

This commit is contained in:
John 2023-04-14 21:00:08 -05:00
parent 4f6f91b69b
commit 973811ee8d
2 changed files with 8 additions and 10 deletions

View File

@ -109,18 +109,13 @@ impl FrameBuffer {
// Resizing the buffer does not unmap memory. // Resizing the buffer does not unmap memory.
// After the first use of high-res mode, this is pretty cheap // After the first use of high-res mode, this is pretty cheap
(self.width, self.height) = match screen.len() { (self.width, self.height) = match screen.len() {
256 => { 256 => (64, 32),
self.buffer.resize(64 * 32, 0); 1024 => (128, 64),
(64, 32)
}
1024 => {
self.buffer.resize(128 * 64, 0);
(128, 64)
}
_ => { _ => {
unimplemented!("Screen must be 64*32 or 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 (idx, byte) in screen.iter().enumerate() {
for bit in 0..8 { for bit in 0..8 {
self.buffer[8 * idx + bit] = if byte & (1 << (7 - bit)) as u8 != 0 { self.buffer[8 * idx + bit] = if byte & (1 << (7 - bit)) as u8 != 0 {

View File

@ -2,6 +2,9 @@ use chirp::{error::Result, *};
use std::{env::args, fs::read}; use std::{env::args, fs::read};
fn main() -> Result<()> { fn main() -> Result<()> {
bus! {Screen [0..0x100] = &read(args().nth(1).unwrap_or("screen_dump.bin".to_string()))?} for screen in args().skip(1).inspect(|screen| println!("{screen}")) {
.print_screen() let screen = read(screen)?;
bus! {Screen [0..screen.len()] = &screen}.print_screen()?;
}
Ok(())
} }