fox32: Allow specifying a disk to be inserted using command line args
This commit is contained in:
parent
27f308e785
commit
738ccd16e8
16
src/main.rs
16
src/main.rs
|
@ -12,7 +12,7 @@ use memory::Memory;
|
||||||
use mouse::Mouse;
|
use mouse::Mouse;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::read;
|
use std::fs::{File, read};
|
||||||
//use std::process::exit;
|
//use std::process::exit;
|
||||||
use std::sync::{Arc, mpsc, Mutex};
|
use std::sync::{Arc, mpsc, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
@ -99,17 +99,6 @@ fn main() {
|
||||||
Cpu::new(bus)
|
Cpu::new(bus)
|
||||||
};
|
};
|
||||||
|
|
||||||
if args.len() >= 2 {
|
|
||||||
let input_file_name = &args[1];
|
|
||||||
let opcodes = read(input_file_name).unwrap();
|
|
||||||
//println!("{:02X?}", opcodes);
|
|
||||||
let mut address = 0u32;
|
|
||||||
for byte in opcodes.iter() {
|
|
||||||
cpu.bus.memory.write_8(address, *byte);
|
|
||||||
address += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let event_loop = EventLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
let mut input = WinitInputHelper::new();
|
let mut input = WinitInputHelper::new();
|
||||||
let window = {
|
let window = {
|
||||||
|
@ -135,6 +124,9 @@ fn main() {
|
||||||
let builder = thread::Builder::new().name("cpu".to_string());
|
let builder = thread::Builder::new().name("cpu".to_string());
|
||||||
builder.spawn({
|
builder.spawn({
|
||||||
move || {
|
move || {
|
||||||
|
if args.len() > 1 {
|
||||||
|
cpu.bus.disk_controller.insert(File::open(&args[1]).unwrap(), 0);
|
||||||
|
}
|
||||||
loop {
|
loop {
|
||||||
while !cpu.halted {
|
while !cpu.halted {
|
||||||
if let Ok(interrupt) = interrupt_receiver.try_recv() {
|
if let Ok(interrupt) = interrupt_receiver.try_recv() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user