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:
parent
c395199977
commit
083f3607ba
|
@ -412,7 +412,8 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"clap 3.2.20",
|
||||
"flate2",
|
||||
"moa",
|
||||
"moa_core",
|
||||
"moa_m68k",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
|
@ -620,34 +621,131 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "moa"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "moa-common"
|
||||
name = "moa_common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cpal",
|
||||
"moa",
|
||||
"moa_core",
|
||||
"nix 0.23.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "moa-console"
|
||||
name = "moa_computie"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"moa",
|
||||
"moa-common",
|
||||
"moa_core",
|
||||
"moa_m68k",
|
||||
"moa_peripherals_generic",
|
||||
"moa_peripherals_motorola",
|
||||
]
|
||||
|
||||
[[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"
|
||||
dependencies = [
|
||||
"clap 3.2.20",
|
||||
"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]]
|
||||
|
|
17
Cargo.toml
17
Cargo.toml
|
@ -1,10 +1,9 @@
|
|||
[package]
|
||||
name = "moa"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
members = [".", "frontends/moa-common", "frontends/moa-console", "frontends/moa-minifb", "tests/harte_tests"]
|
||||
default-members = ["frontends/moa-console"]
|
||||
|
||||
[dependencies]
|
||||
members = [
|
||||
"emulator/core",
|
||||
"emulator/frontends/common",
|
||||
"emulator/frontends/console",
|
||||
"emulator/frontends/minifb",
|
||||
"tests/harte_tests"
|
||||
]
|
||||
default-members = ["emulator/frontends/minifb"]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
|
@ -63,35 +63,40 @@ pub fn log_level() -> LogLevel {
|
|||
unsafe { LOG_LEVEL }
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! printlog {
|
||||
($level:expr, $($arg:tt)*) => ({
|
||||
if $level <= crate::error::log_level() {
|
||||
if $level <= $crate::log_level() {
|
||||
println!($($arg)*);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! error {
|
||||
($($arg:tt)*) => ({
|
||||
printlog!(crate::error::LogLevel::Error, $($arg)*);
|
||||
$crate::printlog!($crate::LogLevel::Error, $($arg)*);
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! warning {
|
||||
($($arg:tt)*) => ({
|
||||
printlog!(crate::error::LogLevel::Warning, $($arg)*);
|
||||
$crate::printlog!($crate::LogLevel::Warning, $($arg)*);
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! info {
|
||||
($($arg:tt)*) => ({
|
||||
printlog!(crate::error::LogLevel::Info, $($arg)*);
|
||||
$crate::printlog!($crate::LogLevel::Info, $($arg)*);
|
||||
})
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! debug {
|
||||
($($arg:tt)*) => ({
|
||||
printlog!(crate::error::LogLevel::Debug, $($arg)*);
|
||||
$crate::printlog!($crate::LogLevel::Debug, $($arg)*);
|
||||
})
|
||||
}
|
||||
|
|
@ -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};
|
||||
|
|
@ -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;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_m68k"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::parser::{AssemblyLine, AssemblyOperand, AssemblyParser};
|
||||
use crate::parser::{expect_args, expect_label, expect_immediate};
|
||||
use moa_core::Error;
|
||||
use moa_core::parser::{self, AssemblyLine, AssemblyOperand, AssemblyParser};
|
||||
|
||||
use super::state::M68kType;
|
||||
use super::instructions::Size;
|
||||
|
@ -151,12 +150,12 @@ impl M68kAssembler {
|
|||
fn convert_instruction(&mut self, lineno: usize, mneumonic: &str, args: &[AssemblyOperand]) -> Result<(), Error> {
|
||||
match mneumonic {
|
||||
"bra" => {
|
||||
let label = expect_label(lineno, args)?;
|
||||
let label = parser::expect_label(lineno, args)?;
|
||||
self.output.push(0x6000);
|
||||
self.relocations.push(Relocation::new(RelocationType::Displacement, label, self.output.len() - 1, self.current_origin));
|
||||
},
|
||||
"bsr" => {
|
||||
let label = expect_label(lineno, args)?;
|
||||
let label = parser::expect_label(lineno, args)?;
|
||||
self.output.push(0x6100);
|
||||
self.relocations.push(Relocation::new(RelocationType::Displacement, label, self.output.len() - 1, self.current_origin));
|
||||
},
|
||||
|
@ -165,7 +164,7 @@ impl M68kAssembler {
|
|||
},
|
||||
|
||||
"lea" => {
|
||||
expect_args(lineno, args, 2)?;
|
||||
parser::expect_args(lineno, args, 2)?;
|
||||
let reg = expect_address_register(lineno, &args[0])?;
|
||||
let (effective_address, additional_words) = convert_target(lineno, &args[1], Size::Long, Disallow::NoRegsPrePostOrImmediate)?;
|
||||
self.output.push(0x41C0 | (reg << 9) | effective_address);
|
||||
|
@ -184,7 +183,7 @@ impl M68kAssembler {
|
|||
self.output.push(0x4E77);
|
||||
},
|
||||
"stop" => {
|
||||
let immediate = expect_immediate(lineno, &args[0])?;
|
||||
let immediate = parser::expect_immediate(lineno, &args[0])?;
|
||||
self.output.push(0x4E72);
|
||||
self.output.extend(convert_immediate(lineno, immediate, Size::Word)?);
|
||||
},
|
||||
|
@ -252,7 +251,7 @@ impl M68kAssembler {
|
|||
|
||||
"move" | "movea" => {
|
||||
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_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);
|
||||
|
@ -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> {
|
||||
expect_args(lineno, args, 2)?;
|
||||
let immediate = expect_immediate(lineno, &args[0])?;
|
||||
parser::expect_args(lineno, args, 2)?;
|
||||
let immediate = parser::expect_immediate(lineno, &args[0])?;
|
||||
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.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> {
|
||||
expect_args(lineno, args, 2)?;
|
||||
parser::expect_args(lineno, args, 2)?;
|
||||
let (direction, reg, operand) = convert_reg_and_other(lineno, args, disallow_reg)?;
|
||||
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);
|
||||
|
@ -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> {
|
||||
expect_args(lineno, args, 1)?;
|
||||
parser::expect_args(lineno, args, 1)?;
|
||||
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.extend(additional_words);
|
||||
|
@ -351,8 +350,8 @@ impl M68kAssembler {
|
|||
};
|
||||
|
||||
if let Some(opcode) = opcode {
|
||||
expect_args(lineno, args, 2)?;
|
||||
let immediate = expect_immediate(lineno, &args[0])?;
|
||||
parser::expect_args(lineno, args, 2)?;
|
||||
let immediate = parser::expect_immediate(lineno, &args[0])?;
|
||||
self.output.push(opcode);
|
||||
self.output.extend(convert_immediate(lineno, immediate, Size::Word)?);
|
||||
return Ok(true);
|
||||
|
@ -373,7 +372,7 @@ impl M68kAssembler {
|
|||
|
||||
match &args {
|
||||
&[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 {
|
||||
return Err(Error::new(&format!("error at line {}: immediate value must be between 1 and 8, found {:?}", lineno, args)));
|
||||
} else if immediate == 8 {
|
|
@ -2,8 +2,8 @@
|
|||
use std::fs;
|
||||
use std::env;
|
||||
|
||||
use moa::cpus::m68k::M68kType;
|
||||
use moa::cpus::m68k::assembler::M68kAssembler;
|
||||
use moa_m68k::M68kType;
|
||||
use moa_m68k::assembler::M68kAssembler;
|
||||
|
||||
fn main() {
|
||||
let mut assembler = M68kAssembler::new(M68kType::MC68000);
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{Address, Addressable, Debuggable};
|
||||
use moa_core::{System, Error, Address, Addressable, Debuggable};
|
||||
|
||||
use super::state::M68k;
|
||||
use super::decode::M68kDecoder;
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::devices::{Address, Addressable};
|
||||
use moa_core::{Error, Address, Addressable};
|
||||
|
||||
use super::state::{M68kType, Exceptions};
|
||||
use super::instructions::{
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
use crate::system::System;
|
||||
use crate::error::{ErrorType, Error};
|
||||
use crate::devices::{ClockElapsed, Address, Steppable, Interruptable, Addressable, Debuggable, Transmutable};
|
||||
use moa_core::debug;
|
||||
use moa_core::{System, Error, ErrorType, ClockElapsed, Address, Steppable, Interruptable, Addressable, Debuggable, Transmutable};
|
||||
|
||||
use super::state::{M68k, M68kType, Status, Flags, Exceptions, InterruptPriority, FunctionCode, MemType, MemAccess};
|
||||
use super::instructions::{
|
||||
use crate::state::{M68k, M68kType, Status, Flags, Exceptions, InterruptPriority, FunctionCode, MemType, MemAccess};
|
||||
use crate::instructions::{
|
||||
Register,
|
||||
Size,
|
||||
Sign,
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
use crate::devices::Address;
|
||||
use crate::timers::CpuTimer;
|
||||
use crate::memory::BusPort;
|
||||
use moa_core::{Address, BusPort};
|
||||
use moa_core::timers::CpuTimer;
|
||||
|
||||
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)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
|
@ -1,16 +1,13 @@
|
|||
|
||||
#[cfg(test)]
|
||||
mod decode_tests {
|
||||
use crate::error::{Error, ErrorType};
|
||||
use crate::system::System;
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use crate::devices::{Address, Addressable, wrap_transmutable};
|
||||
use moa_core::{System, Error, ErrorType, MemoryBlock, BusPort, Address, Addressable, wrap_transmutable};
|
||||
|
||||
use crate::cpus::m68k::{M68k, M68kType};
|
||||
use crate::cpus::m68k::state::Exceptions;
|
||||
use crate::cpus::m68k::instructions::{Instruction, Target, Size, Sign, XRegister, BaseRegister, IndexRegister, Direction, ShiftDirection};
|
||||
use crate::cpus::m68k::timing::M68kInstructionTiming;
|
||||
use crate::cpus::m68k::assembler::M68kAssembler;
|
||||
use crate::{M68k, M68kType};
|
||||
use crate::state::Exceptions;
|
||||
use crate::instructions::{Instruction, Target, Size, Sign, XRegister, BaseRegister, IndexRegister, Direction, ShiftDirection};
|
||||
use crate::timing::M68kInstructionTiming;
|
||||
use crate::assembler::M68kAssembler;
|
||||
|
||||
const INIT_STACK: Address = 0x00002000;
|
||||
const INIT_ADDR: Address = 0x00000010;
|
||||
|
@ -113,7 +110,6 @@ mod decode_tests {
|
|||
assert_eq!(cpu.decoder.instruction, ins.clone());
|
||||
},
|
||||
None => {
|
||||
println!("{:?}", cpu.decoder.instruction);
|
||||
assert!(cpu.decode_next().is_err());
|
||||
},
|
||||
}
|
||||
|
@ -497,14 +493,12 @@ println!("{:?}", cpu.decoder.instruction);
|
|||
|
||||
#[cfg(test)]
|
||||
mod execute_tests {
|
||||
use crate::system::System;
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use crate::devices::{Address, Addressable, Steppable, wrap_transmutable};
|
||||
use moa_core::{System, MemoryBlock, BusPort, Address, Addressable, Steppable, wrap_transmutable};
|
||||
|
||||
use crate::cpus::m68k::{M68k, M68kType};
|
||||
use crate::cpus::m68k::state::M68kState;
|
||||
use crate::cpus::m68k::execute::Used;
|
||||
use crate::cpus::m68k::instructions::{Instruction, Target, Size, Sign, ShiftDirection, Direction, Condition};
|
||||
use crate::{M68k, M68kType};
|
||||
use crate::state::M68kState;
|
||||
use crate::execute::Used;
|
||||
use crate::instructions::{Instruction, Target, Size, Sign, ShiftDirection, Direction, Condition};
|
||||
|
||||
const INIT_STACK: Address = 0x00002000;
|
||||
const INIT_ADDR: Address = 0x00000010;
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
use super::state::M68kType;
|
||||
|
||||
use super::instructions::{Size, Sign, Direction, Target, Instruction};
|
||||
use crate::M68kType;
|
||||
use crate::instructions::{Size, Sign, Direction, Target, Instruction};
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_z80"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{Address, Debuggable};
|
||||
use moa_core::{System, Error, Address, Debuggable};
|
||||
|
||||
use super::state::Z80;
|
||||
use super::decode::Z80Decoder;
|
||||
use crate::state::Z80;
|
||||
use crate::decode::Z80Decoder;
|
||||
|
||||
|
||||
pub struct Z80Debugger {
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::devices::{Address, Addressable};
|
||||
use moa_core::{Error, Address, Addressable};
|
||||
|
||||
use super::state::{Register, InterruptMode};
|
||||
use crate::state::{Register, InterruptMode};
|
||||
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
use crate::system::System;
|
||||
use crate::error::{ErrorType, Error};
|
||||
use crate::devices::{ClockElapsed, Address, Steppable, Addressable, Interruptable, Debuggable, Transmutable, read_beu16, write_beu16};
|
||||
use moa_core::{System, Error, ErrorType, 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 super::state::{Z80, Status, Flags, Register};
|
||||
use crate::decode::{Condition, Instruction, LoadTarget, Target, RegisterPair, IndexRegister, SpecialRegister, IndexRegisterHalf, Size, Direction};
|
||||
use crate::state::{Z80, Status, Flags, Register};
|
||||
|
||||
|
||||
const DEV_NAME: &'static str = "z80-cpu";
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
use crate::devices::Address;
|
||||
use crate::memory::BusPort;
|
||||
use crate::signals::Signal;
|
||||
use moa_core::{Address, BusPort, Signal};
|
||||
|
||||
use super::decode::Z80Decoder;
|
||||
use super::debugger::Z80Debugger;
|
||||
use crate::decode::Z80Decoder;
|
||||
use crate::debugger::Z80Debugger;
|
||||
|
||||
|
||||
#[allow(dead_code)]
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
#[cfg(test)]
|
||||
mod decode_tests {
|
||||
use crate::system::System;
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use crate::devices::{Address, Addressable, wrap_transmutable};
|
||||
use moa_core::{System, MemoryBlock, BusPort, Address, Addressable, wrap_transmutable};
|
||||
|
||||
use super::super::{Z80, Z80Type};
|
||||
use super::super::state::Register;
|
||||
|
@ -78,9 +76,7 @@ mod decode_tests {
|
|||
|
||||
#[cfg(test)]
|
||||
mod execute_tests {
|
||||
use crate::system::System;
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use crate::devices::{Address, Addressable, wrap_transmutable};
|
||||
use moa_core::{System, MemoryBlock, BusPort, Address, Addressable, wrap_transmutable};
|
||||
|
||||
use super::super::{Z80, Z80Type};
|
||||
use super::super::state::{Z80State, Register};
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "moa-common"
|
||||
name = "moa_common"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
|
@ -8,7 +8,7 @@ tty = ["nix"]
|
|||
audio = ["cpal"]
|
||||
|
||||
[dependencies]
|
||||
moa = { path = "../../" }
|
||||
moa_core = { path = "../../core" }
|
||||
nix = { version = "0.23", optional = true }
|
||||
cpal = { version = "0.13", optional = true }
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
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;
|
||||
|
||||
const SAMPLE_RATE: usize = 48000;
|
|
@ -9,8 +9,8 @@ use nix::fcntl::OFlag;
|
|||
use nix::pty::{self, PtyMaster};
|
||||
use nix::fcntl::{fcntl, FcntlArg};
|
||||
|
||||
use moa::error::Error;
|
||||
use moa::host::traits::Tty;
|
||||
use moa_core::Error;
|
||||
use moa_core::host::Tty;
|
||||
|
||||
|
||||
pub struct SimplePty {
|
|
@ -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" }
|
|
@ -2,30 +2,27 @@
|
|||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use moa::error::Error;
|
||||
use moa::system::System;
|
||||
use moa::devices::wrap_transmutable;
|
||||
use moa::memory::{MemoryBlock, BusPort};
|
||||
use moa_core::{System, Error, MemoryBlock, BusPort, wrap_transmutable};
|
||||
|
||||
use moa::cpus::m68k::{M68k, M68kType};
|
||||
use moa::peripherals::ata::AtaDevice;
|
||||
use moa::peripherals::mc68681::MC68681;
|
||||
use moa_m68k::{M68k, M68kType};
|
||||
use moa_peripherals_generic::AtaDevice;
|
||||
use moa_peripherals_motorola::MC68681;
|
||||
|
||||
use moa::machines::computie::build_computie;
|
||||
use moa_computie::build_computie;
|
||||
|
||||
fn main() {
|
||||
thread::spawn(|| {
|
||||
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();
|
||||
|
||||
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();
|
||||
|
||||
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();
|
||||
|
||||
let mut serial = MC68681::new();
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use moa_console::ConsoleFrontend;
|
||||
use moa::machines::computie::build_computie;
|
||||
use moa_computie::build_computie;
|
||||
|
||||
fn main() {
|
||||
let mut frontend = ConsoleFrontend;
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use moa::error::Error;
|
||||
use moa::host::traits::{Host, Tty, WindowUpdater};
|
||||
use moa_core::Error;
|
||||
use moa_core::host::{Host, Tty, WindowUpdater};
|
||||
|
||||
pub struct ConsoleFrontend;
|
||||
|
|
@ -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" }
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
use clap::Arg;
|
||||
|
||||
use moa_minifb;
|
||||
use moa::machines::genesis::{build_genesis, SegaGenesisOptions};
|
||||
use moa_genesis::{build_genesis, SegaGenesisOptions};
|
||||
|
||||
fn main() {
|
||||
let matches = moa_minifb::new("Sega Genesis/Mega Drive Emulator")
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use moa_minifb;
|
||||
use moa::machines::macintosh::build_macintosh_512k;
|
||||
use moa_macintosh::build_macintosh_512k;
|
||||
|
||||
fn main() {
|
||||
let matches = moa_minifb::new("Macintosh 512k Emulator")
|
|
@ -2,15 +2,11 @@
|
|||
use std::sync::mpsc;
|
||||
|
||||
use moa_minifb;
|
||||
use moa::peripherals::ym2612::{Ym2612};
|
||||
use moa::peripherals::sn76489::{Sn76489};
|
||||
use moa_peripherals_yamaha::{Ym2612, Sn76489};
|
||||
|
||||
use moa::error::Error;
|
||||
use moa::system::System;
|
||||
use moa::host::gfx::Frame;
|
||||
use moa::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
|
||||
use moa::host::keys::{Key};
|
||||
use moa::host::traits::{Host, KeyboardUpdater};
|
||||
use moa_core::host::gfx::Frame;
|
||||
use moa_core::host::{Host, KeyboardUpdater, Key};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
|
||||
|
||||
|
||||
pub struct SynthControlsUpdater(mpsc::Sender<(Key, bool)>);
|
|
@ -2,7 +2,7 @@
|
|||
use clap::Arg;
|
||||
|
||||
use moa_minifb;
|
||||
use moa::machines::trs80::{build_trs80, Trs80Options};
|
||||
use moa_trs80::{build_trs80, Trs80Options};
|
||||
|
||||
fn main() {
|
||||
let matches = moa_minifb::new("TRS-80 Emulator")
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
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> {
|
||||
match key {
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use minifb::Key as MiniKey;
|
||||
use moa::host::keys::Key;
|
||||
use moa_core::host::Key;
|
||||
|
||||
pub fn map_key(key: MiniKey) -> Key {
|
||||
match key {
|
|
@ -7,11 +7,8 @@ use std::sync::{Arc, Mutex};
|
|||
use minifb::{self, Key};
|
||||
use clap::{App, Arg, ArgMatches};
|
||||
|
||||
use moa::error::Error;
|
||||
use moa::system::System;
|
||||
use moa::devices::Clock;
|
||||
use moa::host::traits::{Host, HostData, ControllerUpdater, KeyboardUpdater, WindowUpdater, Audio};
|
||||
use moa::host::controllers::ControllerDevice;
|
||||
use moa_core::{System, Error, Clock};
|
||||
use moa_core::host::{Host, HostData, ControllerUpdater, KeyboardUpdater, WindowUpdater, Audio, ControllerDevice};
|
||||
|
||||
use moa_common::audio::{AudioOutput, AudioMixer, AudioSource};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_peripherals_generic"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
use std::fs;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::devices::{Address, Addressable, Transmutable};
|
||||
use moa_core::{Error, Address, Addressable, Transmutable, debug};
|
||||
|
||||
|
||||
const ATA_REG_DATA_WORD: Address = 0x20;
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
mod ata;
|
||||
pub use crate::ata::AtaDevice;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_peripherals_mos"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
mod mos6522;
|
||||
pub use crate::mos6522::Mos6522;
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::signals::{Signal, ObservableSignal, Observable};
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::{Error, System, ClockElapsed, Address, Addressable, Steppable, Transmutable, Signal, ObservableSignal, Observable, debug, warning};
|
||||
|
||||
|
||||
const REG_OUTPUT_B: Address = 0x00;
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_peripherals_motorola"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
mod mc68681;
|
||||
pub use crate::mc68681::MC68681;
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Steppable, Addressable, Transmutable};
|
||||
|
||||
use crate::host::traits::Tty;
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Steppable, Addressable, Transmutable, debug};
|
||||
use moa_core::host::Tty;
|
||||
|
||||
|
||||
const REG_MR1A_MR2A: Address = 0x01;
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_peripherals_yamaha"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
mod sn76489;
|
||||
pub use crate::sn76489::Sn76489;
|
||||
|
||||
mod ym2612;
|
||||
pub use crate::ym2612::Ym2612;
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use crate::host::audio::{SquareWave};
|
||||
use crate::host::traits::{Host, Audio};
|
||||
use moa_core::{info, warning, debug};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::host::{Host, Audio};
|
||||
use moa_core::host::audio::{SquareWave};
|
||||
|
||||
|
||||
const DEV_NAME: &'static str = "sn76489";
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
use std::num::NonZeroU8;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use crate::host::audio::{SineWave};
|
||||
use crate::host::traits::{Host, Audio};
|
||||
use moa_core::{debug, warning};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::host::{Host, Audio};
|
||||
use moa_core::host::audio::{SineWave};
|
||||
|
||||
const DEV_NAME: &'static str = "ym2612";
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "moa_peripherals_zilog"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
mod z8530;
|
||||
pub use crate::z8530::Z8530;
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, warning, debug};
|
||||
|
||||
const DEV_NAME: &'static str = "z8530";
|
||||
|
|
@ -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" }
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
mod system;
|
||||
pub use crate::system::{build_computie, build_computie_k30, launch_terminal_emulator, launch_slip_connection};
|
||||
|
|
@ -1,14 +1,10 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{Debuggable, wrap_transmutable};
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use moa_core::{System, Error, Debuggable, MemoryBlock, BusPort, wrap_transmutable};
|
||||
use moa_core::host::Host;
|
||||
|
||||
use crate::cpus::m68k::{M68k, M68kType};
|
||||
use crate::peripherals::ata::AtaDevice;
|
||||
use crate::peripherals::mc68681::MC68681;
|
||||
|
||||
use crate::host::traits::Host;
|
||||
use moa_m68k::{M68k, M68kType};
|
||||
use moa_peripherals_generic::AtaDevice;
|
||||
use moa_peripherals_motorola::MC68681;
|
||||
|
||||
|
||||
pub fn build_computie<H: Host>(host: &H) -> Result<System, Error> {
|
|
@ -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" }
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
pub mod peripherals;
|
||||
|
||||
mod system;
|
||||
pub use crate::system::{SegaGenesisOptions, build_genesis};
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use crate::host::controllers::{ControllerDevice, ControllerEvent};
|
||||
use crate::host::traits::{Host, ControllerUpdater, HostData};
|
||||
use moa_core::{warning, info};
|
||||
use moa_core::{System, Error, Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::host::{Host, ControllerUpdater, HostData, ControllerDevice, ControllerEvent};
|
||||
|
||||
|
||||
const REG_VERSION: Address = 0x01;
|
|
@ -2,10 +2,8 @@
|
|||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use crate::memory::Bus;
|
||||
use crate::error::Error;
|
||||
use crate::signals::Signal;
|
||||
use crate::devices::{Address, Addressable, Transmutable};
|
||||
use moa_core::{warning, info};
|
||||
use moa_core::{Bus, Signal, Error, Address, Addressable, Transmutable};
|
||||
|
||||
|
||||
const DEV_NAME: &'static str = "coprocessor";
|
|
@ -1,11 +1,8 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::memory::dump_slice;
|
||||
use crate::signals::{EdgeSignal};
|
||||
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};
|
||||
use moa_core::{debug, warning, error};
|
||||
use moa_core::{System, Error, EdgeSignal, Clock, ClockElapsed, Address, Addressable, Steppable, Inspectable, Transmutable, TransmutableBox, read_beu16, dump_slice};
|
||||
use moa_core::host::{Host, BlitableSurface, HostData};
|
||||
use moa_core::host::gfx::{Frame, FrameSwapper};
|
||||
|
||||
|
||||
const REG_MODE_SET_1: usize = 0x00;
|
|
@ -2,20 +2,17 @@
|
|||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::signals::{Signal};
|
||||
use crate::memory::{MemoryBlock, Bus, BusPort};
|
||||
use crate::devices::{wrap_transmutable, Address, Addressable, Debuggable};
|
||||
use moa_core::{System, Error, Signal, MemoryBlock, Bus, BusPort, Address, Addressable, Debuggable, wrap_transmutable};
|
||||
use moa_core::host::Host;
|
||||
|
||||
use crate::cpus::m68k::{M68k, M68kType};
|
||||
use crate::cpus::z80::{Z80, Z80Type};
|
||||
use crate::peripherals::ym2612::Ym2612;
|
||||
use crate::peripherals::sn76489::Sn76489;
|
||||
use crate::peripherals::genesis;
|
||||
use crate::peripherals::genesis::coprocessor::{CoprocessorBankRegister, CoprocessorBankArea};
|
||||
use moa_m68k::{M68k, M68kType};
|
||||
use moa_z80::{Z80, Z80Type};
|
||||
use moa_peripherals_yamaha::Ym2612;
|
||||
use moa_peripherals_yamaha::Sn76489;
|
||||
|
||||
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 {
|
||||
|
@ -91,14 +88,14 @@ pub fn build_genesis<H: Host>(host: &mut H, options: SegaGenesisOptions) -> Resu
|
|||
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();
|
||||
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();
|
||||
|
||||
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.add_peripheral("vdp", 0x00c00000, wrap_transmutable(vdp)).unwrap();
|
||||
|
|
@ -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" }
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
pub mod peripherals;
|
||||
|
||||
mod system;
|
||||
pub use crate::system::{build_macintosh_512k};
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, info, warning};
|
||||
|
||||
|
||||
//const CA0: u8 = 0x01;
|
|
@ -2,15 +2,11 @@
|
|||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use crate::memory::Bus;
|
||||
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 moa_core::{System, Bus, Error, Observable, Clock, ClockElapsed, Address, Addressable, Steppable, Transmutable, TransmutableBox, wrap_transmutable};
|
||||
|
||||
use crate::peripherals::z8530::Z8530;
|
||||
use crate::peripherals::mos6522::Mos6522;
|
||||
use crate::peripherals::macintosh::iwm::IWM;
|
||||
use moa_peripherals_mos::Mos6522;
|
||||
use moa_peripherals_zilog::Z8530;
|
||||
use crate::peripherals::iwm::IWM;
|
||||
|
||||
const DEV_NAME: &'static str = "mac";
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
|
||||
use crate::host::gfx::Frame;
|
||||
use crate::host::traits::{Host, BlitableSurface};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
use moa_core::host::gfx::Frame;
|
||||
use moa_core::host::{Host, BlitableSurface};
|
||||
|
||||
|
||||
const SCRN_BASE: u32 = 0x07A700;
|
|
@ -1,14 +1,11 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{wrap_transmutable, Debuggable};
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use moa_core::{System, Error, MemoryBlock, BusPort, Debuggable, wrap_transmutable};
|
||||
use moa_core::host::Host;
|
||||
|
||||
use crate::cpus::m68k::{M68k, M68kType};
|
||||
use crate::peripherals::macintosh::video::MacVideo;
|
||||
use crate::peripherals::macintosh::mainboard::Mainboard;
|
||||
use moa_m68k::{M68k, M68kType};
|
||||
|
||||
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> {
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "moa_trs80"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
moa_core = { path = "../../core" }
|
||||
moa_z80 = { path = "../../cpus/z80" }
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
pub mod peripherals;
|
||||
|
||||
mod system;
|
||||
pub use crate::system::{Trs80Options, build_trs80};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
use crate::host::keys::Key;
|
||||
use moa_core::host::Key;
|
||||
|
||||
#[inline(always)]
|
||||
pub fn set_bit(data: &mut [u8; 8], index: usize, bit: u8, state: bool) {
|
|
@ -1,13 +1,9 @@
|
|||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::{ClockElapsed, Address, Addressable, Steppable, Transmutable};
|
||||
|
||||
use crate::host::keys::Key;
|
||||
use crate::host::gfx::{Frame};
|
||||
use crate::host::traits::{Host, BlitableSurface, KeyboardUpdater};
|
||||
use moa_core::{System, Error, ClockElapsed, Address, Addressable, Steppable, Transmutable, debug, warning};
|
||||
use moa_core::host::gfx::Frame;
|
||||
use moa_core::host::{Host, BlitableSurface, KeyboardUpdater, Key};
|
||||
|
||||
use super::keymap;
|
||||
use super::charset::CharacterGenerator;
|
|
@ -1,13 +1,11 @@
|
|||
|
||||
use crate::error::Error;
|
||||
use crate::system::System;
|
||||
use crate::devices::wrap_transmutable;
|
||||
use crate::memory::{MemoryBlock, BusPort};
|
||||
use moa_core::{System, Error, MemoryBlock, BusPort, wrap_transmutable};
|
||||
use moa_core::host::Host;
|
||||
|
||||
use crate::cpus::z80::{Z80, Z80Type};
|
||||
use crate::peripherals::trs80;
|
||||
use moa_z80::{Z80, Z80Type};
|
||||
|
||||
use crate::peripherals::model1::Model1Peripherals;
|
||||
|
||||
use crate::host::traits::Host;
|
||||
|
||||
pub struct Trs80Options {
|
||||
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]);
|
||||
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();
|
||||
|
||||
let cpu = Z80::new(Z80Type::Z80, options.frequency, BusPort::new(0, 16, 8, system.bus.clone()));
|
|
@ -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"] }
|
||||
|
|
@ -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"
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
pub mod m68k;
|
||||
pub mod z80;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
pub mod traits;
|
||||
|
||||
pub mod gfx;
|
||||
pub mod audio;
|
||||
pub mod keys;
|
||||
pub mod controllers;
|
||||
|
17
src/lib.rs
17
src/lib.rs
|
@ -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;
|
||||
|
|
@ -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
Loading…
Reference in New Issue