This commit is contained in:
2025-02-14 20:13:10 +00:00
parent eaa86e14ba
commit 06fb6aa650
3 changed files with 6 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
Chip 8 emulator/interpreter.
```bash
./porcel8 -f an_awesome_chip8_rom.ch8
./porcel8 an_awesome_chip8_rom.ch8
```
![pong.gif](assets/pong.gif)

View File

@@ -3,8 +3,8 @@ use clap::Parser;
#[derive(Parser, Debug, Clone)]
#[command(version, about, author)]
pub struct Porcel8ProgramArgs {
#[arg(short, long, help = "Filename of ROM to load.")]
pub filename: Option<String>,
/// CHIP-8 rom file to load
pub filename: String,
#[arg(short, long, help = "Draw scale of window", default_value_t = 8f32)]
pub draw_scale: f32,
#[arg(

View File

@@ -94,13 +94,11 @@ fn main() -> EmulatorResult<()> {
Ok(())
}
fn start_compute_thread(filename: Option<String>, mut device: Device) -> EmulatorResult<(Sender<()>, JoinHandle<()>)> {
fn start_compute_thread(filename: String, mut device: Device) -> EmulatorResult<(Sender<()>, JoinHandle<()>)> {
device.set_default_font();
if let Some(rom_file_location) = filename {
let rom = rom::load_rom(rom_file_location)?;
device.load_rom(&rom);
}
let rom = rom::load_rom(filename)?;
device.load_rom(&rom);
let (device_termination_signal_sender, device_termination_signal_sender_receiver) = std::sync::mpsc::channel();
let compute_handle = thread::Builder::new().name("Compute".to_string()).spawn(move || {