Start of DMD machine-level

This commit is contained in:
Seth Morabito 2018-11-18 21:13:09 -08:00
parent 584722eaab
commit 839008f66b
6 changed files with 8233 additions and 2 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
**/*.rs.bk **/*.rs.bk
Cargo.lock Cargo.lock
.idea .idea
.DS_Store

View File

@ -1,5 +1,5 @@
use bus::{AccessCode, Bus}; use bus::{AccessCode, Bus};
use err::{CpuError, CpuException}; use err::*;
use instr::*; use instr::*;
use std::collections::HashMap; use std::collections::HashMap;
@ -391,7 +391,7 @@ impl<'a> Cpu<'a> {
} }
/// Reset the CPU. /// Reset the CPU.
pub fn reset(&mut self, bus: &mut Bus) -> Result<(), CpuError> { pub fn reset(&mut self, bus: &mut Bus) -> Result<(), BusError> {
// //
// The WE32100 Manual, Page 2-52, describes the reset process // The WE32100 Manual, Page 2-52, describes the reset process
// //

29
src/dmd.rs Normal file
View File

@ -0,0 +1,29 @@
use bus::Bus;
use cpu::Cpu;
use rom_lo::LO_ROM;
use rom_hi::HI_ROM;
use err::*;
#[allow(dead_code)]
pub struct Dmd<'a> {
bus: Bus<'a>,
cpu: Cpu<'a>,
}
#[allow(dead_code)]
impl<'a> Dmd<'a> {
pub fn new() -> Dmd<'a> {
let cpu = Cpu::new();
let bus = Bus::new(0x20000);
Dmd { cpu, bus }
}
pub fn reset(&mut self) -> Result<(), BusError> {
self.bus.load(0, &LO_ROM)?;
self.bus.load(0x10000, &HI_ROM)?;
self.cpu.reset(&mut self.bus)?;
Ok(())
}
}

View File

@ -5,6 +5,9 @@ pub mod cpu;
pub mod err; pub mod err;
pub mod mem; pub mod mem;
pub mod instr; pub mod instr;
pub mod rom_lo;
pub mod rom_hi;
pub mod dmd;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;

4099
src/rom_hi.rs Normal file

File diff suppressed because it is too large Load Diff

4099
src/rom_lo.rs Normal file

File diff suppressed because it is too large Load Diff