Allow passing multiple arguments to mount multiple disks

This commit is contained in:
Ry 2022-06-21 19:36:40 -07:00
parent 5d6bfbb409
commit 940023f47b
2 changed files with 6 additions and 2 deletions

View File

@ -20,7 +20,7 @@ After that, just run `cargo build --release`. The resulting binary will be saved
**fox32** attempts to read its ROM from a file called `fox32.rom` in the current directory. If this file isn't found then it falls back to `../fox32rom/fox32.rom`, and if this file isn't found then it exits. **fox32** attempts to read its ROM from a file called `fox32.rom` in the current directory. If this file isn't found then it falls back to `../fox32rom/fox32.rom`, and if this file isn't found then it exits.
Passing a file as an argument will mount that file as Disk 0. Passing files as arguments will mount those files as disks, in the order that the arguments were passed.
See [encoding.md](encoding.md) for information about the instruction set. See [encoding.md](encoding.md) for information about the instruction set.

View File

@ -102,7 +102,11 @@ fn main() {
}; };
if args.len() > 1 { if args.len() > 1 {
bus.disk_controller.insert(File::open(&args[1]).expect("failed to load provided disk image"), 0); let mut args_iter = args.iter();
args_iter.next();
for (i, arg) in args_iter.enumerate() {
bus.disk_controller.insert(File::open(&arg).expect("failed to load provided disk image"), i as u8);
}
} }
let (mut runtime, memory): (Box<dyn Runtime>, MemoryWrapped) = { let (mut runtime, memory): (Box<dyn Runtime>, MemoryWrapped) = {