diff --git a/src/backplane.rs b/src/backplane.rs index 7806a91..b7d1175 100644 --- a/src/backplane.rs +++ b/src/backplane.rs @@ -148,7 +148,7 @@ impl Backplane { .get(card_num as usize) .ok_or_else(|| anyhow!("Card {} does not exist", card_num))? .borrow_mut() - .cmd(cmd) + .cmd(cmd, &self) } pub fn read_word(&self, address: u32, supervisor: bool) -> Result { diff --git a/src/card.rs b/src/card.rs index 3643580..9e53509 100644 --- a/src/card.rs +++ b/src/card.rs @@ -112,7 +112,7 @@ pub trait Card: Debug + Display + mopa::Any { NullableResult::Ok(()) } - fn cmd(&mut self, _cmd: &[&str]) -> anyhow::Result<()> { + fn cmd(&mut self, _cmd: &[&str], _backplane: &Backplane) -> anyhow::Result<()> { Ok(()) } diff --git a/src/m68k.rs b/src/m68k.rs index 2388ba8..644a4b7 100644 --- a/src/m68k.rs +++ b/src/m68k.rs @@ -1690,7 +1690,7 @@ impl M68K { } else { Ok(pc.wrapping_sub((-d as u16).into())) } - }, + } EffectiveAddress::AbsoluteShort(x) => Ok(u32::from(x)), EffectiveAddress::AbsoluteLong(x) => Ok(x), EffectiveAddress::DataReg(_) diff --git a/src/mmu.rs b/src/mmu.rs index 6a4959e..c75df9f 100644 --- a/src/mmu.rs +++ b/src/mmu.rs @@ -3,7 +3,7 @@ use std::fmt::Display; use nullable_result::NullableResult; use crate::{ - backplane::Backplane, + backplane::{self, Backplane}, card::{u16_get_be_byte, u32_get_be_byte, u32_set_be_byte, Card, Mmu}, m68k::BusError, register, @@ -114,7 +114,7 @@ impl Card for MmuCard { NullableResult::Ok(()) } - fn cmd(&mut self, cmd: &[&str]) -> anyhow::Result<()> { + fn cmd(&mut self, cmd: &[&str], backplane: &Backplane) -> anyhow::Result<()> { if cmd[0] == "debug" && cmd.len() >= 2 { self.print_debug = cmd[1].parse()?; } diff --git a/src/rom.rs b/src/rom.rs index ee739ea..6002c7d 100644 --- a/src/rom.rs +++ b/src/rom.rs @@ -7,9 +7,7 @@ use serde::Deserialize; use toml::Value; use crate::{ - card::{u16_get_be_byte, u16_set_be_byte, Card}, - m68k::BusError, - register, + backplane::{self, Backplane}, card::{u16_get_be_byte, u16_set_be_byte, Card}, m68k::BusError, register }; const ID: u16 = 1; @@ -99,7 +97,7 @@ impl Card for Rom { NullableResult::Ok(()) } - fn cmd(&mut self, cmd: &[&str]) -> anyhow::Result<()> { + fn cmd(&mut self, cmd: &[&str], _backplane: &Backplane) -> anyhow::Result<()> { if cmd[0] == "load" && cmd.len() >= 2 { let mut file = File::open(cmd[1]) .map_err(|e| anyhow!("Couldn't open ROM image file {} ({})", cmd[1], e))?; diff --git a/src/storage.rs b/src/storage.rs index e68568c..245c9b8 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -139,7 +139,7 @@ impl Card for Storage { NullableResult::Ok(()) } - fn cmd(&mut self, cmd: &[&str]) -> anyhow::Result<()> { + fn cmd(&mut self, cmd: &[&str], _backplane: &Backplane) -> anyhow::Result<()> { if cmd[0] == "load" && cmd.len() >= 2 { let file = File::open(cmd[1]) .map_err(|e| anyhow!("Couldn't open disk image file {} ({})", cmd[1], e))?;