Major reorganization into crates

I wanted to make this a bit more modular, so it's easier in theory to
write external crates that can reuse bits, and selectively compile in
bits, such as adding new systems or new cpu implementations
This commit is contained in:
transistor 2022-09-24 23:14:03 -07:00
parent c395199977
commit 083f3607ba
104 changed files with 489 additions and 325 deletions

124
Cargo.lock generated
View File

@ -412,7 +412,8 @@ version = "0.1.0"
dependencies = [ dependencies = [
"clap 3.2.20", "clap 3.2.20",
"flate2", "flate2",
"moa", "moa_core",
"moa_m68k",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
@ -620,34 +621,131 @@ dependencies = [
] ]
[[package]] [[package]]
name = "moa" name = "moa_common"
version = "0.1.0"
[[package]]
name = "moa-common"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"cpal", "cpal",
"moa", "moa_core",
"nix 0.23.0", "nix 0.23.0",
] ]
[[package]] [[package]]
name = "moa-console" name = "moa_computie"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"moa", "moa_core",
"moa-common", "moa_m68k",
"moa_peripherals_generic",
"moa_peripherals_motorola",
] ]
[[package]] [[package]]
name = "moa-minifb" name = "moa_console"
version = "0.1.0"
dependencies = [
"moa_common",
"moa_computie",
"moa_core",
"moa_genesis",
"moa_m68k",
"moa_peripherals_generic",
"moa_peripherals_motorola",
]
[[package]]
name = "moa_core"
version = "0.1.0"
[[package]]
name = "moa_genesis"
version = "0.1.0"
dependencies = [
"moa_core",
"moa_m68k",
"moa_peripherals_yamaha",
"moa_z80",
]
[[package]]
name = "moa_m68k"
version = "0.1.0"
dependencies = [
"moa_core",
]
[[package]]
name = "moa_macintosh"
version = "0.1.0"
dependencies = [
"moa_core",
"moa_m68k",
"moa_peripherals_mos",
"moa_peripherals_zilog",
]
[[package]]
name = "moa_minifb"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap 3.2.20", "clap 3.2.20",
"minifb", "minifb",
"moa", "moa_common",
"moa-common", "moa_computie",
"moa_core",
"moa_genesis",
"moa_macintosh",
"moa_peripherals_yamaha",
"moa_trs80",
]
[[package]]
name = "moa_peripherals_generic"
version = "0.1.0"
dependencies = [
"moa_core",
]
[[package]]
name = "moa_peripherals_mos"
version = "0.1.0"
dependencies = [
"moa_core",
]
[[package]]
name = "moa_peripherals_motorola"
version = "0.1.0"
dependencies = [
"moa_core",
]
[[package]]
name = "moa_peripherals_yamaha"
version = "0.1.0"
dependencies = [
"moa_core",
]
[[package]]
name = "moa_peripherals_zilog"
version = "0.1.0"
dependencies = [
"moa_core",
]
[[package]]
name = "moa_trs80"
version = "0.1.0"
dependencies = [
"moa_core",
"moa_z80",
]
[[package]]
name = "moa_z80"
version = "0.1.0"
dependencies = [
"moa_core",
] ]
[[package]] [[package]]

View File

@ -1,10 +1,9 @@
[package]
name = "moa"
version = "0.1.0"
edition = "2018"
[workspace] [workspace]
members = [".", "frontends/moa-common", "frontends/moa-console", "frontends/moa-minifb", "tests/harte_tests"] members = [
default-members = ["frontends/moa-console"] "emulator/core",
"emulator/frontends/common",
[dependencies] "emulator/frontends/console",
"emulator/frontends/minifb",
"tests/harte_tests"
]
default-members = ["emulator/frontends/minifb"]

7
emulator/core/Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "moa_core"
version = "0.1.0"
edition = "2021"
[dependencies]

View File

@ -63,35 +63,40 @@ pub fn log_level() -> LogLevel {
unsafe { LOG_LEVEL } unsafe { LOG_LEVEL }
} }
#[macro_export]
macro_rules! printlog { macro_rules! printlog {
($level:expr, $($arg:tt)*) => ({ ($level:expr, $($arg:tt)*) => ({
if $level <= crate::error::log_level() { if $level <= $crate::log_level() {
println!($($arg)*); println!($($arg)*);
} }
}) })
} }
#[macro_export]
macro_rules! error { macro_rules! error {
($($arg:tt)*) => ({ ($($arg:tt)*) => ({
printlog!(crate::error::LogLevel::Error, $($arg)*); $crate::printlog!($crate::LogLevel::Error, $($arg)*);
}) })
} }
#[macro_export]
macro_rules! warning { macro_rules! warning {
($($arg:tt)*) => ({ ($($arg:tt)*) => ({
printlog!(crate::error::LogLevel::Warning, $($arg)*); $crate::printlog!($crate::LogLevel::Warning, $($arg)*);
}) })
} }
#[macro_export]
macro_rules! info { macro_rules! info {
($($arg:tt)*) => ({ ($($arg:tt)*) => ({
printlog!(crate::error::LogLevel::Info, $($arg)*); $crate::printlog!($crate::LogLevel::Info, $($arg)*);
}) })
} }
#[macro_export]
macro_rules! debug { macro_rules! debug {
($($arg:tt)*) => ({ ($($arg:tt)*) => ({
printlog!(crate::error::LogLevel::Debug, $($arg)*); $crate::printlog!($crate::LogLevel::Debug, $($arg)*);
}) })
} }

View File

@ -0,0 +1,12 @@
mod traits;
mod keys;
mod controllers;
pub mod gfx;
pub mod audio;
pub use self::keys::Key;
pub use self::controllers::{ControllerDevice, ControllerEvent};
pub use self::traits::{Host, Tty, WindowUpdater, ControllerUpdater, KeyboardUpdater, Audio, BlitableSurface, HostData};

24
emulator/core/src/lib.rs Normal file
View File

@ -0,0 +1,24 @@
#[macro_use]
mod error;
mod debugger;
mod devices;
mod interrupts;
mod memory;
mod signals;
mod system;
pub mod host;
pub mod parser;
pub mod timers;
pub use crate::debugger::Debugger;
pub use crate::devices::{Clock, ClockElapsed, Address, Addressable, Steppable, Interruptable, Debuggable, Inspectable, Transmutable, TransmutableBox};
pub use crate::devices::{read_beu16, read_beu32, read_leu16, read_leu32, write_beu16, write_beu32, write_leu16, write_leu32, wrap_transmutable};
pub use crate::error::{Error, ErrorType, LogLevel, log_level};
pub use crate::interrupts::InterruptController;
pub use crate::memory::{MemoryBlock, AddressAdapter, Bus, BusPort, dump_slice};
pub use crate::signals::{Observable, Signal, EdgeSignal, ObservableSignal, ObservableEdgeSignal};
pub use crate::system::System;

View File

@ -0,0 +1,7 @@
[package]
name = "moa_m68k"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -1,9 +1,8 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::error::Error; use moa_core::Error;
use crate::parser::{AssemblyLine, AssemblyOperand, AssemblyParser}; use moa_core::parser::{self, AssemblyLine, AssemblyOperand, AssemblyParser};
use crate::parser::{expect_args, expect_label, expect_immediate};
use super::state::M68kType; use super::state::M68kType;
use super::instructions::Size; use super::instructions::Size;
@ -151,12 +150,12 @@ impl M68kAssembler {
fn convert_instruction(&mut self, lineno: usize, mneumonic: &str, args: &[AssemblyOperand]) -> Result<(), Error> { fn convert_instruction(&mut self, lineno: usize, mneumonic: &str, args: &[AssemblyOperand]) -> Result<(), Error> {
match mneumonic { match mneumonic {
"bra" => { "bra" => {
let label = expect_label(lineno, args)?; let label = parser::expect_label(lineno, args)?;
self.output.push(0x6000); self.output.push(0x6000);
self.relocations.push(Relocation::new(RelocationType::Displacement, label, self.output.len() - 1, self.current_origin)); self.relocations.push(Relocation::new(RelocationType::Displacement, label, self.output.len() - 1, self.current_origin));
}, },
"bsr" => { "bsr" => {
let label = expect_label(lineno, args)?; let label = parser::expect_label(lineno, args)?;
self.output.push(0x6100); self.output.push(0x6100);
self.relocations.push(Relocation::new(RelocationType::Displacement, label, self.output.len() - 1, self.current_origin)); self.relocations.push(Relocation::new(RelocationType::Displacement, label, self.output.len() - 1, self.current_origin));
}, },
@ -165,7 +164,7 @@ impl M68kAssembler {
}, },
"lea" => { "lea" => {
expect_args(lineno, args, 2)?; parser::expect_args(lineno, args, 2)?;
let reg = expect_address_register(lineno, &args[0])?; let reg = expect_address_register(lineno, &args[0])?;
let (effective_address, additional_words) = convert_target(lineno, &args[1], Size::Long, Disallow::NoRegsPrePostOrImmediate)?; let (effective_address, additional_words) = convert_target(lineno, &args[1], Size::Long, Disallow::NoRegsPrePostOrImmediate)?;
self.output.push(0x41C0 | (reg << 9) | effective_address); self.output.push(0x41C0 | (reg << 9) | effective_address);
@ -184,7 +183,7 @@ impl M68kAssembler {
self.output.push(0x4E77); self.output.push(0x4E77);
}, },
"stop" => { "stop" => {
let immediate = expect_immediate(lineno, &args[0])?; let immediate = parser::expect_immediate(lineno, &args[0])?;
self.output.push(0x4E72); self.output.push(0x4E72);
self.output.extend(convert_immediate(lineno, immediate, Size::Word)?); self.output.extend(convert_immediate(lineno, immediate, Size::Word)?);
}, },
@ -252,7 +251,7 @@ impl M68kAssembler {
"move" | "movea" => { "move" | "movea" => {
let operation_size = operation_size?; let operation_size = operation_size?;
expect_args(lineno, args, 2)?; parser::expect_args(lineno, args, 2)?;
let (effective_address_left, additional_words_left) = convert_target(lineno, &args[0], operation_size, Disallow::None)?; let (effective_address_left, additional_words_left) = convert_target(lineno, &args[0], operation_size, Disallow::None)?;
let (effective_address_right, additional_words_right) = convert_target(lineno, &args[1], operation_size, Disallow::None)?; let (effective_address_right, additional_words_right) = convert_target(lineno, &args[1], operation_size, Disallow::None)?;
let effective_address_left = (effective_address_left >> 3) | (effective_address_left << 3); let effective_address_left = (effective_address_left >> 3) | (effective_address_left << 3);
@ -308,8 +307,8 @@ impl M68kAssembler {
} }
fn convert_common_immediate_instruction(&mut self, lineno: usize, opcode: u16, args: &[AssemblyOperand], operation_size: Size, disallow: Disallow) -> Result<(), Error> { fn convert_common_immediate_instruction(&mut self, lineno: usize, opcode: u16, args: &[AssemblyOperand], operation_size: Size, disallow: Disallow) -> Result<(), Error> {
expect_args(lineno, args, 2)?; parser::expect_args(lineno, args, 2)?;
let immediate = expect_immediate(lineno, &args[0])?; let immediate = parser::expect_immediate(lineno, &args[0])?;
let (effective_address, additional_words) = convert_target(lineno, &args[1], operation_size, disallow)?; let (effective_address, additional_words) = convert_target(lineno, &args[1], operation_size, disallow)?;
self.output.push(opcode | encode_size(operation_size) | effective_address); self.output.push(opcode | encode_size(operation_size) | effective_address);
self.output.extend(convert_immediate(lineno, immediate, operation_size)?); self.output.extend(convert_immediate(lineno, immediate, operation_size)?);
@ -326,7 +325,7 @@ impl M68kAssembler {
} }
fn convert_common_reg_instruction(&mut self, lineno: usize, opcode: u16, args: &[AssemblyOperand], operation_size: Size, disallow: Disallow, disallow_reg: Disallow) -> Result<(), Error> { fn convert_common_reg_instruction(&mut self, lineno: usize, opcode: u16, args: &[AssemblyOperand], operation_size: Size, disallow: Disallow, disallow_reg: Disallow) -> Result<(), Error> {
expect_args(lineno, args, 2)?; parser::expect_args(lineno, args, 2)?;
let (direction, reg, operand) = convert_reg_and_other(lineno, args, disallow_reg)?; let (direction, reg, operand) = convert_reg_and_other(lineno, args, disallow_reg)?;
let (effective_address, additional_words) = convert_target(lineno, operand, operation_size, disallow)?; let (effective_address, additional_words) = convert_target(lineno, operand, operation_size, disallow)?;
self.output.push(opcode | encode_size(operation_size) | direction | (reg << 9) | effective_address); self.output.push(opcode | encode_size(operation_size) | direction | (reg << 9) | effective_address);
@ -335,7 +334,7 @@ impl M68kAssembler {
} }
fn convert_common_single_operand_instruction(&mut self, lineno: usize, opcode: u16, args: &[AssemblyOperand], operation_size: Size, disallow: Disallow) -> Result<(), Error> { fn convert_common_single_operand_instruction(&mut self, lineno: usize, opcode: u16, args: &[AssemblyOperand], operation_size: Size, disallow: Disallow) -> Result<(), Error> {
expect_args(lineno, args, 1)?; parser::expect_args(lineno, args, 1)?;
let (effective_address, additional_words) = convert_target(lineno, &args[0], operation_size, disallow)?; let (effective_address, additional_words) = convert_target(lineno, &args[0], operation_size, disallow)?;
self.output.push(opcode | encode_size(operation_size) | effective_address); self.output.push(opcode | encode_size(operation_size) | effective_address);
self.output.extend(additional_words); self.output.extend(additional_words);
@ -351,8 +350,8 @@ impl M68kAssembler {
}; };
if let Some(opcode) = opcode { if let Some(opcode) = opcode {
expect_args(lineno, args, 2)?; parser::expect_args(lineno, args, 2)?;
let immediate = expect_immediate(lineno, &args[0])?; let immediate = parser::expect_immediate(lineno, &args[0])?;
self.output.push(opcode); self.output.push(opcode);
self.output.extend(convert_immediate(lineno, immediate, Size::Word)?); self.output.extend(convert_immediate(lineno, immediate, Size::Word)?);
return Ok(true); return Ok(true);
@ -373,7 +372,7 @@ impl M68kAssembler {
match &args { match &args {
&[AssemblyOperand::Immediate(_), AssemblyOperand::Register(_)] => { &[AssemblyOperand::Immediate(_), AssemblyOperand::Register(_)] => {
let mut immediate = expect_immediate(lineno, &args[0])?; let mut immediate = parser::expect_immediate(lineno, &args[0])?;
if immediate < 1 || immediate > 8 { if immediate < 1 || immediate > 8 {
return Err(Error::new(&format!("error at line {}: immediate value must be between 1 and 8, found {:?}", lineno, args))); return Err(Error::new(&format!("error at line {}: immediate value must be between 1 and 8, found {:?}", lineno, args)));
} else if immediate == 8 { } else if immediate == 8 {

View File

@ -2,8 +2,8 @@
use std::fs; use std::fs;
use std::env; use std::env;
use moa::cpus::m68k::M68kType; use moa_m68k::M68kType;
use moa::cpus::m68k::assembler::M68kAssembler; use moa_m68k::assembler::M68kAssembler;
fn main() { fn main() {
let mut assembler = M68kAssembler::new(M68kType::MC68000); let mut assembler = M68kAssembler::new(M68kType::MC68000);

View File

@ -1,7 +1,5 @@
use crate::error::Error; use moa_core::{System, Error, Address, Addressable, Debuggable};
use crate::system::System;
use crate::devices::{Address, Addressable, Debuggable};
use super::state::M68k; use super::state::M68k;
use super::decode::M68kDecoder; use super::decode::M68kDecoder;

View File

@ -1,6 +1,5 @@
use crate::error::Error; use moa_core::{Error, Address, Addressable};
use crate::devices::{Address, Addressable};
use super::state::{M68kType, Exceptions}; use super::state::{M68kType, Exceptions};
use super::instructions::{ use super::instructions::{

View File

@ -1,10 +1,9 @@
use crate::system::System; use moa_core::debug;
use crate::error::{ErrorType, Error}; use moa_core::{System, Error, ErrorType, ClockElapsed, Address, Steppable, Interruptable, Addressable, Debuggable, Transmutable};
use crate::devices::{ClockElapsed, Address, Steppable, Interruptable, Addressable, Debuggable, Transmutable};
use super::state::{M68k, M68kType, Status, Flags, Exceptions, InterruptPriority, FunctionCode, MemType, MemAccess}; use crate::state::{M68k, M68kType, Status, Flags, Exceptions, InterruptPriority, FunctionCode, MemType, MemAccess};
use super::instructions::{ use crate::instructions::{
Register, Register,
Size, Size,
Sign, Sign,

View File

@ -1,12 +1,12 @@
use crate::devices::Address; use moa_core::{Address, BusPort};
use crate::timers::CpuTimer; use moa_core::timers::CpuTimer;
use crate::memory::BusPort;
use crate::instructions::Size;
use crate::decode::M68kDecoder;
use crate::debugger::M68kDebugger;
use crate::timing::M68kInstructionTiming;
use super::instructions::Size;
use super::decode::M68kDecoder;
use super::debugger::M68kDebugger;
use super::timing::M68kInstructionTiming;
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]

View File

@ -1,16 +1,13 @@
#[cfg(test)] #[cfg(test)]
mod decode_tests { mod decode_tests {
use crate::error::{Error, ErrorType}; use moa_core::{System, Error, ErrorType, MemoryBlock, BusPort, Address, Addressable, wrap_transmutable};
use crate::system::System;
use crate::memory::{MemoryBlock, BusPort};
use crate::devices::{Address, Addressable, wrap_transmutable};
use crate::cpus::m68k::{M68k, M68kType}; use crate::{M68k, M68kType};
use crate::cpus::m68k::state::Exceptions; use crate::state::Exceptions;
use crate::cpus::m68k::instructions::{Instruction, Target, Size, Sign, XRegister, BaseRegister, IndexRegister, Direction, ShiftDirection}; use crate::instructions::{Instruction, Target, Size, Sign, XRegister, BaseRegister, IndexRegister, Direction, ShiftDirection};
use crate::cpus::m68k::timing::M68kInstructionTiming; use crate::timing::M68kInstructionTiming;
use crate::cpus::m68k::assembler::M68kAssembler; use crate::assembler::M68kAssembler;
const INIT_STACK: Address = 0x00002000; const INIT_STACK: Address = 0x00002000;
const INIT_ADDR: Address = 0x00000010; const INIT_ADDR: Address = 0x00000010;
@ -113,7 +110,6 @@ mod decode_tests {
assert_eq!(cpu.decoder.instruction, ins.clone()); assert_eq!(cpu.decoder.instruction, ins.clone());
}, },
None => { None => {
println!("{:?}", cpu.decoder.instruction);
assert!(cpu.decode_next().is_err()); assert!(cpu.decode_next().is_err());
}, },
} }
@ -497,14 +493,12 @@ println!("{:?}", cpu.decoder.instruction);
#[cfg(test)] #[cfg(test)]
mod execute_tests { mod execute_tests {
use crate::system::System; use moa_core::{System, MemoryBlock, BusPort, Address, Addressable, Steppable, wrap_transmutable};
use crate::memory::{MemoryBlock, BusPort};
use crate::devices::{Address, Addressable, Steppable, wrap_transmutable};
use crate::cpus::m68k::{M68k, M68kType}; use crate::{M68k, M68kType};
use crate::cpus::m68k::state::M68kState; use crate::state::M68kState;
use crate::cpus::m68k::execute::Used; use crate::execute::Used;
use crate::cpus::m68k::instructions::{Instruction, Target, Size, Sign, ShiftDirection, Direction, Condition}; use crate::instructions::{Instruction, Target, Size, Sign, ShiftDirection, Direction, Condition};
const INIT_STACK: Address = 0x00002000; const INIT_STACK: Address = 0x00002000;
const INIT_ADDR: Address = 0x00000010; const INIT_ADDR: Address = 0x00000010;

View File

@ -1,7 +1,6 @@
use super::state::M68kType; use crate::M68kType;
use crate::instructions::{Size, Sign, Direction, Target, Instruction};
use super::instructions::{Size, Sign, Direction, Target, Instruction};
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]

View File

@ -0,0 +1,7 @@
[package]
name = "moa_z80"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -1,10 +1,8 @@
use crate::error::Error; use moa_core::{System, Error, Address, Debuggable};
use crate::system::System;
use crate::devices::{Address, Debuggable};
use super::state::Z80; use crate::state::Z80;
use super::decode::Z80Decoder; use crate::decode::Z80Decoder;
pub struct Z80Debugger { pub struct Z80Debugger {

View File

@ -1,8 +1,7 @@
use crate::error::Error; use moa_core::{Error, Address, Addressable};
use crate::devices::{Address, Addressable};
use super::state::{Register, InterruptMode}; use crate::state::{Register, InterruptMode};
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]

View File

@ -1,10 +1,8 @@
use crate::system::System; use moa_core::{System, Error, ErrorType, ClockElapsed, Address, Steppable, Addressable, Interruptable, Debuggable, Transmutable, read_beu16, write_beu16};
use crate::error::{ErrorType, Error};
use crate::devices::{ClockElapsed, Address, Steppable, Addressable, Interruptable, Debuggable, Transmutable, read_beu16, write_beu16};
use super::decode::{Condition, Instruction, LoadTarget, Target, RegisterPair, IndexRegister, SpecialRegister, IndexRegisterHalf, Size, Direction}; use crate::decode::{Condition, Instruction, LoadTarget, Target, RegisterPair, IndexRegister, SpecialRegister, IndexRegisterHalf, Size, Direction};
use super::state::{Z80, Status, Flags, Register}; use crate::state::{Z80, Status, Flags, Register};
const DEV_NAME: &'static str = "z80-cpu"; const DEV_NAME: &'static str = "z80-cpu";

View File

@ -1,10 +1,8 @@
use crate::devices::Address; use moa_core::{Address, BusPort, Signal};
use crate::memory::BusPort;
use crate::signals::Signal;
use super::decode::Z80Decoder; use crate::decode::Z80Decoder;
use super::debugger::Z80Debugger; use crate::debugger::Z80Debugger;
#[allow(dead_code)] #[allow(dead_code)]

View File

@ -1,9 +1,7 @@
#[cfg(test)] #[cfg(test)]
mod decode_tests { mod decode_tests {
use crate::system::System; use moa_core::{System, MemoryBlock, BusPort, Address, Addressable, wrap_transmutable};
use crate::memory::{MemoryBlock, BusPort};
use crate::devices::{Address, Addressable, wrap_transmutable};
use super::super::{Z80, Z80Type}; use super::super::{Z80, Z80Type};
use super::super::state::Register; use super::super::state::Register;
@ -78,9 +76,7 @@ mod decode_tests {
#[cfg(test)] #[cfg(test)]
mod execute_tests { mod execute_tests {
use crate::system::System; use moa_core::{System, MemoryBlock, BusPort, Address, Addressable, wrap_transmutable};
use crate::memory::{MemoryBlock, BusPort};
use crate::devices::{Address, Addressable, wrap_transmutable};
use super::super::{Z80, Z80Type}; use super::super::{Z80, Z80Type};
use super::super::state::{Z80State, Register}; use super::super::state::{Z80State, Register};

View File

@ -1,5 +1,5 @@
[package] [package]
name = "moa-common" name = "moa_common"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2018"
@ -8,7 +8,7 @@ tty = ["nix"]
audio = ["cpal"] audio = ["cpal"]
[dependencies] [dependencies]
moa = { path = "../../" } moa_core = { path = "../../core" }
nix = { version = "0.23", optional = true } nix = { version = "0.23", optional = true }
cpal = { version = "0.13", optional = true } cpal = { version = "0.13", optional = true }

View File

@ -1,7 +1,7 @@
use cpal::{Sample, Stream, SampleRate, SampleFormat, StreamConfig, traits::{DeviceTrait, HostTrait, StreamTrait}}; use cpal::{Sample, Stream, SampleRate, SampleFormat, StreamConfig, traits::{DeviceTrait, HostTrait, StreamTrait}};
use moa::host::traits::{HostData, Audio}; use moa_core::host::{HostData, Audio};
use crate::circularbuf::CircularBuffer; use crate::circularbuf::CircularBuffer;
const SAMPLE_RATE: usize = 48000; const SAMPLE_RATE: usize = 48000;

View File

@ -9,8 +9,8 @@ use nix::fcntl::OFlag;
use nix::pty::{self, PtyMaster}; use nix::pty::{self, PtyMaster};
use nix::fcntl::{fcntl, FcntlArg}; use nix::fcntl::{fcntl, FcntlArg};
use moa::error::Error; use moa_core::Error;
use moa::host::traits::Tty; use moa_core::host::Tty;
pub struct SimplePty { pub struct SimplePty {

View File

@ -0,0 +1,15 @@
[package]
name = "moa_console"
version = "0.1.0"
edition = "2018"
default-run = "moa-computie"
[dependencies]
moa_core = { path = "../../core" }
moa_common = { path = "../common", features = ["tty"] }
moa_genesis = { path = "../../systems/genesis" }
moa_computie = { path = "../../systems/computie" }
moa_m68k = { path = "../../cpus/m68k" }
moa_peripherals_generic = { path = "../../peripherals/generic" }
moa_peripherals_motorola = { path = "../../peripherals/motorola" }

View File

@ -2,30 +2,27 @@
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use moa::error::Error; use moa_core::{System, Error, MemoryBlock, BusPort, wrap_transmutable};
use moa::system::System;
use moa::devices::wrap_transmutable;
use moa::memory::{MemoryBlock, BusPort};
use moa::cpus::m68k::{M68k, M68kType}; use moa_m68k::{M68k, M68kType};
use moa::peripherals::ata::AtaDevice; use moa_peripherals_generic::AtaDevice;
use moa::peripherals::mc68681::MC68681; use moa_peripherals_motorola::MC68681;
use moa::machines::computie::build_computie; use moa_computie::build_computie;
fn main() { fn main() {
thread::spawn(|| { thread::spawn(|| {
let mut system = System::new(); let mut system = System::new();
let monitor = MemoryBlock::load("binaries/monitor.bin").unwrap(); let monitor = MemoryBlock::load("binaries/computie/monitor.bin").unwrap();
system.add_addressable_device(0x00000000, wrap_transmutable(monitor)).unwrap(); system.add_addressable_device(0x00000000, wrap_transmutable(monitor)).unwrap();
let mut ram = MemoryBlock::new(vec![0; 0x00100000]); let mut ram = MemoryBlock::new(vec![0; 0x00100000]);
ram.load_at(0, "binaries/kernel.bin").unwrap(); ram.load_at(0, "binaries/computie/kernel.bin").unwrap();
system.add_addressable_device(0x00100000, wrap_transmutable(ram)).unwrap(); system.add_addressable_device(0x00100000, wrap_transmutable(ram)).unwrap();
let mut ata = AtaDevice::new(); let mut ata = AtaDevice::new();
ata.load("binaries/disk-with-partition-table.img").unwrap(); ata.load("binaries/computie/disk-with-partition-table.img").unwrap();
system.add_addressable_device(0x00600000, wrap_transmutable(ata)).unwrap(); system.add_addressable_device(0x00600000, wrap_transmutable(ata)).unwrap();
let mut serial = MC68681::new(); let mut serial = MC68681::new();

View File

@ -1,6 +1,6 @@
use moa_console::ConsoleFrontend; use moa_console::ConsoleFrontend;
use moa::machines::computie::build_computie; use moa_computie::build_computie;
fn main() { fn main() {
let mut frontend = ConsoleFrontend; let mut frontend = ConsoleFrontend;

View File

@ -1,6 +1,6 @@
use moa::error::Error; use moa_core::Error;
use moa::host::traits::{Host, Tty, WindowUpdater}; use moa_core::host::{Host, Tty, WindowUpdater};
pub struct ConsoleFrontend; pub struct ConsoleFrontend;

View File

@ -0,0 +1,18 @@
[package]
name = "moa_minifb"
version = "0.1.0"
edition = "2018"
default-run = "moa-genesis"
[dependencies]
moa_core = { path = "../../core" }
moa_common = { path = "../common", features = ["audio"] }
minifb = "0.19"
clap = "3.2.20"
moa_genesis = { path = "../../systems/genesis" }
moa_computie = { path = "../../systems/computie" }
moa_trs80 = { path = "../../systems/trs80" }
moa_macintosh = { path = "../../systems/macintosh" }
moa_peripherals_yamaha = { path = "../../peripherals/yamaha" }

View File

@ -2,7 +2,7 @@
use clap::Arg; use clap::Arg;
use moa_minifb; use moa_minifb;
use moa::machines::genesis::{build_genesis, SegaGenesisOptions}; use moa_genesis::{build_genesis, SegaGenesisOptions};
fn main() { fn main() {
let matches = moa_minifb::new("Sega Genesis/Mega Drive Emulator") let matches = moa_minifb::new("Sega Genesis/Mega Drive Emulator")

View File

@ -1,6 +1,6 @@
use moa_minifb; use moa_minifb;
use moa::machines::macintosh::build_macintosh_512k; use moa_macintosh::build_macintosh_512k;
fn main() { fn main() {
let matches = moa_minifb::new("Macintosh 512k Emulator") let matches = moa_minifb::new("Macintosh 512k Emulator")

View File

@ -2,15 +2,11 @@
use std::sync::mpsc; use std::sync::mpsc;
use moa_minifb; use moa_minifb;
use moa::peripherals::ym2612::{Ym2612}; use moa_peripherals_yamaha::{Ym2612, Sn76489};
use moa::peripherals::sn76489::{Sn76489};
use moa::error::Error; use moa_core::host::gfx::Frame;
use moa::system::System; use moa_core::host::{Host, KeyboardUpdater, Key};
use moa::host::gfx::Frame; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
use moa::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
use moa::host::keys::{Key};
use moa::host::traits::{Host, KeyboardUpdater};
pub struct SynthControlsUpdater(mpsc::Sender<(Key, bool)>); pub struct SynthControlsUpdater(mpsc::Sender<(Key, bool)>);

View File

@ -2,7 +2,7 @@
use clap::Arg; use clap::Arg;
use moa_minifb; use moa_minifb;
use moa::machines::trs80::{build_trs80, Trs80Options}; use moa_trs80::{build_trs80, Trs80Options};
fn main() { fn main() {
let matches = moa_minifb::new("TRS-80 Emulator") let matches = moa_minifb::new("TRS-80 Emulator")

View File

@ -1,6 +1,6 @@
use minifb::Key as MiniKey; use minifb::Key as MiniKey;
use moa::host::controllers::ControllerEvent; use moa_core::host::ControllerEvent;
pub fn map_controller_a(key: MiniKey, state: bool) -> Option<ControllerEvent> { pub fn map_controller_a(key: MiniKey, state: bool) -> Option<ControllerEvent> {
match key { match key {

View File

@ -1,6 +1,6 @@
use minifb::Key as MiniKey; use minifb::Key as MiniKey;
use moa::host::keys::Key; use moa_core::host::Key;
pub fn map_key(key: MiniKey) -> Key { pub fn map_key(key: MiniKey) -> Key {
match key { match key {

View File

@ -7,11 +7,8 @@ use std::sync::{Arc, Mutex};
use minifb::{self, Key}; use minifb::{self, Key};
use clap::{App, Arg, ArgMatches}; use clap::{App, Arg, ArgMatches};
use moa::error::Error; use moa_core::{System, Error, Clock};
use moa::system::System; use moa_core::host::{Host, HostData, ControllerUpdater, KeyboardUpdater, WindowUpdater, Audio, ControllerDevice};
use moa::devices::Clock;
use moa::host::traits::{Host, HostData, ControllerUpdater, KeyboardUpdater, WindowUpdater, Audio};
use moa::host::controllers::ControllerDevice;
use moa_common::audio::{AudioOutput, AudioMixer, AudioSource}; use moa_common::audio::{AudioOutput, AudioMixer, AudioSource};

View File

@ -0,0 +1,7 @@
[package]
name = "moa_peripherals_generic"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -1,8 +1,7 @@
use std::fs; use std::fs;
use crate::error::Error; use moa_core::{Error, Address, Addressable, Transmutable, debug};
use crate::devices::{Address, Addressable, Transmutable};
const ATA_REG_DATA_WORD: Address = 0x20; const ATA_REG_DATA_WORD: Address = 0x20;

View File

@ -0,0 +1,4 @@
mod ata;
pub use crate::ata::AtaDevice;

View File

@ -0,0 +1,7 @@
[package]
name = "moa_peripherals_mos"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -0,0 +1,4 @@
mod mos6522;
pub use crate::mos6522::Mos6522;

View File

@ -1,8 +1,5 @@
use crate::error::Error; use moa_core::{Error, System, ClockElapsed, Address, Addressable, Steppable, Transmutable, Signal, ObservableSignal, Observable, debug, warning};
use crate::system::System;
use crate::signals::{Signal, ObservableSignal, Observable};
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
const REG_OUTPUT_B: Address = 0x00; const REG_OUTPUT_B: Address = 0x00;

View File

@ -0,0 +1,7 @@
[package]
name = "moa_peripherals_motorola"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -0,0 +1,4 @@
mod mc68681;
pub use crate::mc68681::MC68681;

View File

@ -1,9 +1,6 @@
use crate::error::Error; use moa_core::{System, Error, ClockElapsed, Address, Steppable, Addressable, Transmutable, debug};
use crate::system::System; use moa_core::host::Tty;
use crate::devices::{ClockElapsed, Address, Steppable, Addressable, Transmutable};
use crate::host::traits::Tty;
const REG_MR1A_MR2A: Address = 0x01; const REG_MR1A_MR2A: Address = 0x01;

View File

@ -0,0 +1,7 @@
[package]
name = "moa_peripherals_yamaha"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -0,0 +1,7 @@
mod sn76489;
pub use crate::sn76489::Sn76489;
mod ym2612;
pub use crate::ym2612::Ym2612;

View File

@ -1,9 +1,8 @@
use crate::error::Error; use moa_core::{info, warning, debug};
use crate::system::System; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable};
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable}; use moa_core::host::{Host, Audio};
use crate::host::audio::{SquareWave}; use moa_core::host::audio::{SquareWave};
use crate::host::traits::{Host, Audio};
const DEV_NAME: &'static str = "sn76489"; const DEV_NAME: &'static str = "sn76489";

View File

@ -1,11 +1,10 @@
use std::num::NonZeroU8; use std::num::NonZeroU8;
use crate::error::Error; use moa_core::{debug, warning};
use crate::system::System; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable};
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable}; use moa_core::host::{Host, Audio};
use crate::host::audio::{SineWave}; use moa_core::host::audio::{SineWave};
use crate::host::traits::{Host, Audio};
const DEV_NAME: &'static str = "ym2612"; const DEV_NAME: &'static str = "ym2612";

View File

@ -0,0 +1,7 @@
[package]
name = "moa_peripherals_zilog"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }

View File

@ -0,0 +1,4 @@
mod z8530;
pub use crate::z8530::Z8530;

View File

@ -1,7 +1,5 @@
use crate::error::Error; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, warning, debug};
use crate::system::System;
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
const DEV_NAME: &'static str = "z8530"; const DEV_NAME: &'static str = "z8530";

View File

@ -0,0 +1,10 @@
[package]
name = "moa_computie"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }
moa_m68k = { path = "../../cpus/m68k" }
moa_peripherals_generic = { path = "../../peripherals/generic" }
moa_peripherals_motorola = { path = "../../peripherals/motorola" }

View File

@ -0,0 +1,4 @@
mod system;
pub use crate::system::{build_computie, build_computie_k30, launch_terminal_emulator, launch_slip_connection};

View File

@ -1,14 +1,10 @@
use crate::error::Error; use moa_core::{System, Error, Debuggable, MemoryBlock, BusPort, wrap_transmutable};
use crate::system::System; use moa_core::host::Host;
use crate::devices::{Debuggable, wrap_transmutable};
use crate::memory::{MemoryBlock, BusPort};
use crate::cpus::m68k::{M68k, M68kType}; use moa_m68k::{M68k, M68kType};
use crate::peripherals::ata::AtaDevice; use moa_peripherals_generic::AtaDevice;
use crate::peripherals::mc68681::MC68681; use moa_peripherals_motorola::MC68681;
use crate::host::traits::Host;
pub fn build_computie<H: Host>(host: &H) -> Result<System, Error> { pub fn build_computie<H: Host>(host: &H) -> Result<System, Error> {

View File

@ -0,0 +1,11 @@
[package]
name = "moa_genesis"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }
moa_peripherals_yamaha = { path = "../../peripherals/yamaha" }
moa_m68k = { path = "../../cpus/m68k" }
moa_z80 = { path = "../../cpus/z80" }

View File

@ -0,0 +1,6 @@
pub mod peripherals;
mod system;
pub use crate::system::{SegaGenesisOptions, build_genesis};

View File

@ -1,9 +1,7 @@
use crate::error::Error; use moa_core::{warning, info};
use crate::system::System; use moa_core::{System, Error, Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable};
use crate::devices::{Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable}; use moa_core::host::{Host, ControllerUpdater, HostData, ControllerDevice, ControllerEvent};
use crate::host::controllers::{ControllerDevice, ControllerEvent};
use crate::host::traits::{Host, ControllerUpdater, HostData};
const REG_VERSION: Address = 0x01; const REG_VERSION: Address = 0x01;

View File

@ -2,10 +2,8 @@
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;
use crate::memory::Bus; use moa_core::{warning, info};
use crate::error::Error; use moa_core::{Bus, Signal, Error, Address, Addressable, Transmutable};
use crate::signals::Signal;
use crate::devices::{Address, Addressable, Transmutable};
const DEV_NAME: &'static str = "coprocessor"; const DEV_NAME: &'static str = "coprocessor";

View File

@ -1,11 +1,8 @@
use crate::error::Error; use moa_core::{debug, warning, error};
use crate::system::System; use moa_core::{System, Error, EdgeSignal, Clock, ClockElapsed, Address, Addressable, Steppable, Inspectable, Transmutable, TransmutableBox, read_beu16, dump_slice};
use crate::memory::dump_slice; use moa_core::host::{Host, BlitableSurface, HostData};
use crate::signals::{EdgeSignal}; use moa_core::host::gfx::{Frame, FrameSwapper};
use crate::devices::{Clock, ClockElapsed, Address, Addressable, Steppable, Inspectable, Transmutable, TransmutableBox, read_beu16};
use crate::host::traits::{Host, BlitableSurface, HostData};
use crate::host::gfx::{Frame, FrameSwapper};
const REG_MODE_SET_1: usize = 0x00; const REG_MODE_SET_1: usize = 0x00;

View File

@ -2,20 +2,17 @@
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;
use crate::error::Error; use moa_core::{System, Error, Signal, MemoryBlock, Bus, BusPort, Address, Addressable, Debuggable, wrap_transmutable};
use crate::system::System; use moa_core::host::Host;
use crate::signals::{Signal};
use crate::memory::{MemoryBlock, Bus, BusPort};
use crate::devices::{wrap_transmutable, Address, Addressable, Debuggable};
use crate::cpus::m68k::{M68k, M68kType}; use moa_m68k::{M68k, M68kType};
use crate::cpus::z80::{Z80, Z80Type}; use moa_z80::{Z80, Z80Type};
use crate::peripherals::ym2612::Ym2612; use moa_peripherals_yamaha::Ym2612;
use crate::peripherals::sn76489::Sn76489; use moa_peripherals_yamaha::Sn76489;
use crate::peripherals::genesis;
use crate::peripherals::genesis::coprocessor::{CoprocessorBankRegister, CoprocessorBankArea};
use crate::host::traits::{Host}; use crate::peripherals::ym7101::Ym7101;
use crate::peripherals::controllers::GenesisControllers;
use crate::peripherals::coprocessor::{CoprocessorCoordinator, CoprocessorBankRegister, CoprocessorBankArea};
pub struct SegaGenesisOptions { pub struct SegaGenesisOptions {
@ -91,14 +88,14 @@ pub fn build_genesis<H: Host>(host: &mut H, options: SegaGenesisOptions) -> Resu
system.add_device("coproc", wrap_transmutable(coproc))?; system.add_device("coproc", wrap_transmutable(coproc))?;
let controllers = genesis::controllers::GenesisControllers::create(host)?; let controllers = GenesisControllers::create(host)?;
let interrupt = controllers.get_interrupt_signal(); let interrupt = controllers.get_interrupt_signal();
system.add_addressable_device(0x00a10000, wrap_transmutable(controllers)).unwrap(); system.add_addressable_device(0x00a10000, wrap_transmutable(controllers)).unwrap();
let coproc = genesis::coprocessor::CoprocessorCoordinator::new(reset, bus_request); let coproc = CoprocessorCoordinator::new(reset, bus_request);
system.add_addressable_device(0x00a11000, wrap_transmutable(coproc)).unwrap(); system.add_addressable_device(0x00a11000, wrap_transmutable(coproc)).unwrap();
let vdp = genesis::ym7101::Ym7101::new(host, interrupt, coproc_sn_sound); let vdp = Ym7101::new(host, interrupt, coproc_sn_sound);
system.break_signal = Some(vdp.frame_complete.clone()); system.break_signal = Some(vdp.frame_complete.clone());
system.add_peripheral("vdp", 0x00c00000, wrap_transmutable(vdp)).unwrap(); system.add_peripheral("vdp", 0x00c00000, wrap_transmutable(vdp)).unwrap();

View File

@ -0,0 +1,10 @@
[package]
name = "moa_macintosh"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }
moa_m68k = { path = "../../cpus/m68k" }
moa_peripherals_mos = { path = "../../peripherals/mos" }
moa_peripherals_zilog = { path = "../../peripherals/zilog" }

View File

@ -0,0 +1,6 @@
pub mod peripherals;
mod system;
pub use crate::system::{build_macintosh_512k};

View File

@ -1,7 +1,5 @@
use crate::error::Error; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, info, warning};
use crate::system::System;
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
//const CA0: u8 = 0x01; //const CA0: u8 = 0x01;

View File

@ -2,15 +2,11 @@
use std::rc::Rc; use std::rc::Rc;
use std::cell::RefCell; use std::cell::RefCell;
use crate::memory::Bus; use moa_core::{System, Bus, Error, Observable, Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
use crate::error::Error;
use crate::system::System;
use crate::signals::Observable;
use crate::devices::{Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
use crate::peripherals::z8530::Z8530; use moa_peripherals_mos::Mos6522;
use crate::peripherals::mos6522::Mos6522; use moa_peripherals_zilog::Z8530;
use crate::peripherals::macintosh::iwm::IWM; use crate::peripherals::iwm::IWM;
const DEV_NAME: &'static str = "mac"; const DEV_NAME: &'static str = "mac";

View File

@ -1,12 +1,9 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use crate::error::Error; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable};
use crate::system::System; use moa_core::host::gfx::Frame;
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable}; use moa_core::host::{Host, BlitableSurface};
use crate::host::gfx::Frame;
use crate::host::traits::{Host, BlitableSurface};
const SCRN_BASE: u32 = 0x07A700; const SCRN_BASE: u32 = 0x07A700;

View File

@ -1,14 +1,11 @@
use crate::error::Error; use moa_core::{System, Error, MemoryBlock, BusPort, Debuggable, wrap_transmutable};
use crate::system::System; use moa_core::host::Host;
use crate::devices::{wrap_transmutable, Debuggable};
use crate::memory::{MemoryBlock, BusPort};
use crate::cpus::m68k::{M68k, M68kType}; use moa_m68k::{M68k, M68kType};
use crate::peripherals::macintosh::video::MacVideo;
use crate::peripherals::macintosh::mainboard::Mainboard;
use crate::host::traits::Host; use crate::peripherals::video::MacVideo;
use crate::peripherals::mainboard::Mainboard;
pub fn build_macintosh_512k<H: Host>(host: &mut H) -> Result<System, Error> { pub fn build_macintosh_512k<H: Host>(host: &mut H) -> Result<System, Error> {

View File

@ -0,0 +1,9 @@
[package]
name = "moa_trs80"
version = "0.1.0"
edition = "2021"
[dependencies]
moa_core = { path = "../../core" }
moa_z80 = { path = "../../cpus/z80" }

View File

@ -0,0 +1,6 @@
pub mod peripherals;
mod system;
pub use crate::system::{Trs80Options, build_trs80};

View File

@ -1,5 +1,5 @@
use crate::host::keys::Key; use moa_core::host::Key;
#[inline(always)] #[inline(always)]
pub fn set_bit(data: &mut [u8; 8], index: usize, bit: u8, state: bool) { pub fn set_bit(data: &mut [u8; 8], index: usize, bit: u8, state: bool) {

View File

@ -1,13 +1,9 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use crate::error::Error; use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, debug, warning};
use crate::system::System; use moa_core::host::gfx::Frame;
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable}; use moa_core::host::{Host, BlitableSurface, KeyboardUpdater, Key};
use crate::host::keys::Key;
use crate::host::gfx::{Frame};
use crate::host::traits::{Host, BlitableSurface, KeyboardUpdater};
use super::keymap; use super::keymap;
use super::charset::CharacterGenerator; use super::charset::CharacterGenerator;

View File

@ -1,13 +1,11 @@
use crate::error::Error; use moa_core::{System, Error, MemoryBlock, BusPort, wrap_transmutable};
use crate::system::System; use moa_core::host::Host;
use crate::devices::wrap_transmutable;
use crate::memory::{MemoryBlock, BusPort};
use crate::cpus::z80::{Z80, Z80Type}; use moa_z80::{Z80, Z80Type};
use crate::peripherals::trs80;
use crate::peripherals::model1::Model1Peripherals;
use crate::host::traits::Host;
pub struct Trs80Options { pub struct Trs80Options {
pub rom: String, pub rom: String,
@ -39,7 +37,7 @@ pub fn build_trs80<H: Host>(host: &mut H, options: Trs80Options) -> Result<Syste
let ram = MemoryBlock::new(vec![0; options.memory as usize]); let ram = MemoryBlock::new(vec![0; options.memory as usize]);
system.add_addressable_device(0x4000, wrap_transmutable(ram))?; system.add_addressable_device(0x4000, wrap_transmutable(ram))?;
let model1 = trs80::model1::Model1Peripherals::create(host)?; let model1 = Model1Peripherals::create(host)?;
system.add_addressable_device(0x37E0, wrap_transmutable(model1)).unwrap(); system.add_addressable_device(0x37E0, wrap_transmutable(model1)).unwrap();
let cpu = Z80::new(Z80Type::Z80, options.frequency, BusPort::new(0, 16, 8, system.bus.clone())); let cpu = Z80::new(Z80Type::Z80, options.frequency, BusPort::new(0, 16, 8, system.bus.clone()));

View File

@ -1,10 +0,0 @@
[package]
name = "moa-console"
version = "0.1.0"
edition = "2018"
default-run = "moa-computie"
[dependencies]
moa = { path = "../../" }
moa-common = { path = "../moa-common", features = ["tty"] }

View File

@ -1,14 +0,0 @@
[package]
name = "moa-minifb"
version = "0.1.0"
edition = "2018"
default-run = "moa-genesis"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
moa = { path = "../../" }
moa-common = { path = "../moa-common/", features = ["audio"] }
minifb = "0.19"
clap = "3.2.20"

View File

@ -1,4 +0,0 @@
pub mod m68k;
pub mod z80;

View File

@ -1,8 +0,0 @@
pub mod traits;
pub mod gfx;
pub mod audio;
pub mod keys;
pub mod controllers;

View File

@ -1,17 +0,0 @@
#[macro_use]
pub mod error;
pub mod memory;
pub mod timers;
pub mod signals;
pub mod devices;
pub mod debugger;
pub mod interrupts;
pub mod system;
pub mod parser;
pub mod host;
pub mod cpus;
pub mod peripherals;
pub mod machines;

View File

@ -1,6 +0,0 @@
pub mod computie;
pub mod genesis;
pub mod macintosh;
pub mod trs80;

Some files were not shown because too many files have changed in this diff Show More