take file path as arg

This commit is contained in:
Martin Löffler 2023-01-24 00:24:25 +01:00
parent b02e8e7672
commit 351ce267da
Signed by: FatalErrorCoded
GPG key ID: FFEF368AC076566A
2 changed files with 6 additions and 2 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
/target /target
test/

View file

@ -1,10 +1,12 @@
use std::fs; use std::{env, fs};
use core::slice::Iter; use core::slice::Iter;
const REGISTERS: [&str; 8] = [ "B", "C", "D", "E", "H", "L", "M", "A" ]; const REGISTERS: [&str; 8] = [ "B", "C", "D", "E", "H", "L", "M", "A" ];
fn main() { fn main() {
let file = fs::read("/home/lea/Downloads/invadeez/invadeez/rom/invaders.h").expect("where file"); let mut args = env::args();
let filename = args.nth(1).expect("Provide a path to a file to disassemble as an argument");
let file = fs::read(filename).expect("where file");
let mut data = file.iter(); let mut data = file.iter();
while let Some(byte) = data.next() { while let Some(byte) = data.next() {