From 940023f47b3c9166ea55bed97ca69d1fb6c89804 Mon Sep 17 00:00:00 2001 From: Ry Date: Tue, 21 Jun 2022 19:36:40 -0700 Subject: [PATCH] Allow passing multiple arguments to mount multiple disks --- README.md | 2 +- src/main.rs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e93fa9d..3cf9743 100644 --- a/README.md +++ b/README.md @@ -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. -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. diff --git a/src/main.rs b/src/main.rs index a496526..0ba18ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,7 +102,11 @@ fn main() { }; 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, MemoryWrapped) = {