Pass backplane to card command function
This commit is contained in:
parent
bf21b98498
commit
6b09e92ae7
@ -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<u16, BusError> {
|
||||
|
@ -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(())
|
||||
}
|
||||
|
||||
|
@ -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(_)
|
||||
|
@ -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()?;
|
||||
}
|
||||
|
@ -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))?;
|
||||
|
@ -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))?;
|
||||
|
Loading…
Reference in New Issue
Block a user