mirror of
https://github.com/transistorfet/moa.git
synced 2025-04-09 16:38:30 +00:00
Minor fixes
This commit is contained in:
parent
a00d7b2f26
commit
1d8065026d
@ -26,9 +26,9 @@ pub fn new(name: &str) -> App {
|
||||
|
||||
pub fn run<I>(matches: ArgMatches, init: I) where I: FnOnce(&mut MiniFrontendBuilder) -> Result<System, Error> + Send + 'static {
|
||||
if matches.value_of("threaded").is_some() {
|
||||
run_inline(matches, init);
|
||||
} else {
|
||||
run_threaded(matches, init);
|
||||
} else {
|
||||
run_inline(matches, init);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use std::cell::RefCell;
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::memory::{MemoryBlock, Bus, BusPort};
|
||||
use crate::devices::{wrap_transmutable, Debuggable};
|
||||
use crate::devices::{wrap_transmutable, Address, Addressable, Debuggable};
|
||||
|
||||
use crate::cpus::m68k::{M68k, M68kType};
|
||||
use crate::cpus::z80::{Z80, Z80Type};
|
||||
@ -29,19 +29,25 @@ pub fn build_genesis<H: Host>(host: &mut H) -> Result<System, Error> {
|
||||
//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.len();
|
||||
system.add_addressable_device(0x00000000, wrap_transmutable(rom)).unwrap();
|
||||
|
||||
let nvram = MemoryBlock::new(vec![0; 0x00010000]);
|
||||
system.add_addressable_device(rom_end as Address, wrap_transmutable(nvram)).unwrap();
|
||||
|
||||
let ram = MemoryBlock::new(vec![0; 0x00010000]);
|
||||
system.add_addressable_device(0x00ff0000, wrap_transmutable(ram)).unwrap();
|
||||
|
||||
|
||||
let coproc_bus = Rc::new(RefCell::new(Bus::new()));
|
||||
let coproc_shared_mem = wrap_transmutable(MemoryBlock::new(vec![0; 0x00010000]));
|
||||
coproc_bus.borrow_mut().insert(0x0000, coproc_shared_mem.borrow_mut().as_addressable().unwrap().len(), coproc_shared_mem.clone());
|
||||
let coproc_mem = wrap_transmutable(MemoryBlock::new(vec![0; 0x00010000]));
|
||||
coproc_bus.borrow_mut().insert(0x0000, coproc_mem.borrow_mut().as_addressable().unwrap().len(), coproc_mem.clone());
|
||||
let mut coproc = Z80::new(Z80Type::Z80, 3_579_545, BusPort::new(0, 16, 8, coproc_bus.clone()));
|
||||
let reset = coproc.reset.clone();
|
||||
let bus_request = coproc.bus_request.clone();
|
||||
|
||||
system.add_addressable_device(0x00a00000, coproc_shared_mem)?;
|
||||
//system.add_device("coproc", wrap_transmutable(coproc))?;
|
||||
system.add_addressable_device(0x00a00000, coproc_mem)?;
|
||||
system.add_device("coproc", wrap_transmutable(coproc))?;
|
||||
|
||||
|
||||
|
||||
@ -49,7 +55,7 @@ pub fn build_genesis<H: Host>(host: &mut H) -> Result<System, Error> {
|
||||
let interrupt = controllers.get_interrupt_signal();
|
||||
system.add_addressable_device(0x00a10000, wrap_transmutable(controllers)).unwrap();
|
||||
|
||||
let coproc = genesis::coproc_memory::CoprocessorMemory::new();
|
||||
let coproc = genesis::coprocessor::CoprocessorCoordinator::new(reset, bus_request);
|
||||
system.add_addressable_device(0x00a11000, wrap_transmutable(coproc)).unwrap();
|
||||
|
||||
let vdp = genesis::ym7101::Ym7101::new(host, interrupt);
|
||||
|
@ -1,26 +1,27 @@
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::signals::Signal;
|
||||
use crate::devices::{Address, Addressable, Transmutable};
|
||||
|
||||
|
||||
const DEV_NAME: &'static str = "coprocessor";
|
||||
|
||||
pub struct CoprocessorMemory {
|
||||
pub bus_request: bool,
|
||||
pub reset: bool,
|
||||
pub struct CoprocessorCoordinator {
|
||||
pub bus_request: Signal<bool>,
|
||||
pub reset: Signal<bool>,
|
||||
}
|
||||
|
||||
|
||||
impl CoprocessorMemory {
|
||||
pub fn new() -> Self {
|
||||
CoprocessorMemory {
|
||||
bus_request: false,
|
||||
reset: false,
|
||||
impl CoprocessorCoordinator {
|
||||
pub fn new(reset: Signal<bool>, bus_request: Signal<bool>) -> Self {
|
||||
Self {
|
||||
bus_request,
|
||||
reset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Addressable for CoprocessorMemory {
|
||||
impl Addressable for CoprocessorCoordinator {
|
||||
fn len(&self) -> usize {
|
||||
0x4000
|
||||
}
|
||||
@ -28,7 +29,7 @@ impl Addressable for CoprocessorMemory {
|
||||
fn read(&mut self, addr: Address, data: &mut [u8]) -> Result<(), Error> {
|
||||
match addr {
|
||||
0x100 => {
|
||||
data[0] = if self.bus_request && self.reset { 0x01 } else { 0x00 };
|
||||
data[0] = if self.bus_request.get() && self.reset.get() { 0x01 } else { 0x00 };
|
||||
},
|
||||
_ => { warning!("{}: !!! unhandled read from {:0x}", DEV_NAME, addr); },
|
||||
}
|
||||
@ -42,16 +43,16 @@ impl Addressable for CoprocessorMemory {
|
||||
0x000 => { /* ROM vs DRAM mode */ },
|
||||
0x100 => {
|
||||
if data[0] != 0 {
|
||||
self.bus_request = true;
|
||||
self.bus_request.set(true);
|
||||
} else {
|
||||
self.bus_request = false;
|
||||
self.bus_request.set(false);
|
||||
}
|
||||
},
|
||||
0x200 => {
|
||||
if data[0] == 0 {
|
||||
self.reset = true;
|
||||
self.reset.set(true);
|
||||
} else {
|
||||
self.reset = false;
|
||||
self.reset.set(false);
|
||||
}
|
||||
},
|
||||
_ => { warning!("{}: !!! unhandled write {:0x} to {:0x}", DEV_NAME, data[0], addr); },
|
||||
@ -60,7 +61,7 @@ impl Addressable for CoprocessorMemory {
|
||||
}
|
||||
}
|
||||
|
||||
impl Transmutable for CoprocessorMemory {
|
||||
impl Transmutable for CoprocessorCoordinator {
|
||||
fn as_addressable(&mut self) -> Option<&mut dyn Addressable> {
|
||||
Some(self)
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
|
||||
pub mod ym7101;
|
||||
pub mod controllers;
|
||||
pub mod coproc_memory;
|
||||
pub mod coprocessor;
|
||||
|
||||
|
@ -333,9 +333,9 @@ println!("i: {} ({} {}) {:x} ({}, {}) {:x}", i, h_pos, v_pos, size, size_h, size
|
||||
let (h, v) = (if !h_rev { ih } else { size_h - ih }, if !v_rev { iv } else { size_v - iv });
|
||||
let (x, y) = (h_pos + h * 8, v_pos + v * 8);
|
||||
if x > 128 && x < pos_limit_h && y > 128 && y < pos_limit_v {
|
||||
let iter = self.get_pattern_iter(pattern_name + (h * size_v) + v);
|
||||
let iter = self.get_pattern_iter(((pattern_name & 0x07FF) + (h * size_v) + v) | (pattern_name & 0xF800));
|
||||
|
||||
println!("{}: ({} {}), {:x}", i, x, y, pattern_name + (h * size_v) + v);
|
||||
println!("{}: ({} {}), {:x}", i, x, y, ((pattern_name & 0x07FF) + (h * size_v) + v));
|
||||
frame.blit(x as u32 - 128, y as u32 - 128, iter, 8, 8);
|
||||
}
|
||||
}
|
||||
|
3
todo.txt
3
todo.txt
@ -1,6 +1,5 @@
|
||||
|
||||
* the overflow bit is only correct for addition but not subtraction... in subtraction, two positives can result in a negative and vice versa
|
||||
* we need better m68k tests. Can we do what we did for Z80, with maybe a reduced test state and/or different states for different types of tests
|
||||
* add more m68k tests and try to test against a working impl
|
||||
* maybe see about a Mac 128k or something
|
||||
|
||||
* should you rename devices.rs traits.rs?
|
||||
|
Loading…
x
Reference in New Issue
Block a user