v0.1.1 Partial Super Chip Support #11
@ -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 {
|
||||||
|
@ -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(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user