mirror of
https://github.com/transistorfet/moa.git
synced 2025-01-20 19:30:33 +00:00
Added option to moa-computie to select a rom file to boot
This commit is contained in:
parent
ba1d9f0bc1
commit
6a6ab426a6
@ -1,14 +1,26 @@
|
||||
|
||||
use clap::{Arg, ArgAction};
|
||||
|
||||
use moa_console::ConsoleFrontend;
|
||||
use moa_systems_computie::build_computie;
|
||||
use moa_systems_computie::{build_computie, ComputieOptions};
|
||||
|
||||
fn main() {
|
||||
let matches = ConsoleFrontend::args("Computie68k Emulator")
|
||||
.arg(Arg::new("ROM")
|
||||
.short('r')
|
||||
.long("rom")
|
||||
.value_name("FILE")
|
||||
.help("ROM file to load at the start of memory"))
|
||||
.get_matches();
|
||||
|
||||
let mut options = ComputieOptions::default();
|
||||
if let Some(filename) = matches.get_one::<String>("ROM") {
|
||||
options.rom = filename.to_string();
|
||||
}
|
||||
|
||||
let mut frontend = ConsoleFrontend::new();
|
||||
|
||||
let system = build_computie(&mut frontend).unwrap();
|
||||
let system = build_computie(&mut frontend, options).unwrap();
|
||||
frontend.start(matches, system);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
mod system;
|
||||
pub use crate::system::{build_computie, build_computie_k30, launch_terminal_emulator, launch_slip_connection};
|
||||
pub use crate::system::{build_computie, build_computie_k30, launch_terminal_emulator, launch_slip_connection, ComputieOptions};
|
||||
|
||||
|
@ -6,14 +6,30 @@ use moa_m68k::{M68k, M68kType};
|
||||
use moa_peripherals_generic::AtaDevice;
|
||||
use moa_peripherals_motorola::MC68681;
|
||||
|
||||
pub struct ComputieOptions {
|
||||
pub rom: String,
|
||||
pub ram: usize,
|
||||
pub frequency: Frequency,
|
||||
}
|
||||
|
||||
pub fn build_computie<H: Host>(host: &H) -> Result<System, Error> {
|
||||
impl Default for ComputieOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
rom: "binaries/computie/monitor.bin".to_string(),
|
||||
ram: 0x10_0000,
|
||||
frequency: Frequency::from_hz(10_000_000),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_computie<H: Host>(host: &H, options: ComputieOptions) -> Result<System, Error> {
|
||||
let mut system = System::default();
|
||||
|
||||
let monitor = MemoryBlock::load("binaries/computie/monitor.bin")?;
|
||||
system.add_addressable_device(0x00000000, Device::new(monitor))?;
|
||||
let mut rom = MemoryBlock::new(vec![0; 0x10000]);
|
||||
rom.load_at(0x0000, &options.rom)?;
|
||||
system.add_addressable_device(0x00000000, Device::new(rom))?;
|
||||
|
||||
let mut ram = MemoryBlock::new(vec![0; 0x00100000]);
|
||||
let mut ram = MemoryBlock::new(vec![0; options.ram]);
|
||||
ram.load_at(0, "binaries/computie/kernel.bin")?;
|
||||
system.add_addressable_device(0x00100000, Device::new(ram))?;
|
||||
|
||||
@ -27,7 +43,7 @@ pub fn build_computie<H: Host>(host: &H) -> Result<System, Error> {
|
||||
system.add_addressable_device(0x00700000, Device::new(serial))?;
|
||||
|
||||
|
||||
let mut cpu = M68k::from_type(M68kType::MC68010, Frequency::from_hz(10_000_000), system.bus.clone(), 0);
|
||||
let mut cpu = M68k::from_type(M68kType::MC68010, options.frequency, system.bus.clone(), 0);
|
||||
|
||||
//cpu.enable_tracing();
|
||||
//cpu.add_breakpoint(0x10781a);
|
||||
|
@ -864,7 +864,7 @@ impl Addressable for Ym7101 {
|
||||
}
|
||||
},
|
||||
|
||||
0x11 | 0x12 => {
|
||||
addr if (0x11..0x17).contains(&addr) => {
|
||||
self.sn_sound.borrow_mut().as_addressable().unwrap().write(clock, 0, data)?;
|
||||
},
|
||||
|
||||
|
@ -41,21 +41,6 @@ pub fn build_genesis<H: Host>(host: &mut H, mut options: SegaGenesisOptions) ->
|
||||
};
|
||||
|
||||
let rom = MemoryBlock::new(rom_data);
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/GenTestV3.0.bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/HDRV_Genesis_Test_v1_4.bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/ComradeOj's tiny demo.bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Digital Rain demo.bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Sonic The Hedgehog (W) (REV 00) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Sonic The Hedgehog (W) (REV 01) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Sonic the Hedgehog 2 (JUE) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Sonic the Hedgehog 3 (U) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Earthworm Jim (U) [h1].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Home Alone (beta).bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/F1 World Championship (JUE) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Ren and Stimpy's Invention (U) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Out of this World (U) [!].bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Ghostbusters (REV 00) (JUE).bin").unwrap();
|
||||
//let mut rom = MemoryBlock::load("binaries/genesis/Teenage Mutant Ninja Turtles - The Hyperstone Heist (U) [!].bin").unwrap();
|
||||
//rom.read_only();
|
||||
let rom_end = rom.size();
|
||||
system.add_addressable_device(0x00000000, Device::new(rom)).unwrap();
|
||||
|
Loading…
x
Reference in New Issue
Block a user