-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept ROM path as a command line argument
- Loading branch information
1 parent
811e7f0
commit 7e0fc07
Showing
2 changed files
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
mod chip8; | ||
use std::thread::sleep; | ||
use std::time::Duration; | ||
use std::env; | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
|
||
let rom = if args.len() > 1 {args[1].as_str()}else {"pong.rom"}; | ||
|
||
let mut cpu = chip8::create_cpu(); | ||
cpu.initialize(); | ||
cpu.load_rom("pong.rom").expect("Unable to load ROM"); | ||
cpu.load_rom(rom).expect("Unable to load ROM"); | ||
|
||
loop { | ||
cpu.do_cycle(); | ||
sleep(Duration::from_millis(1000/70)); | ||
sleep(Duration::from_millis(1000/75)); | ||
} | ||
} |