Compare commits
3 Commits
7d1fd088ef
...
b7de519e47
Author | SHA1 | Date | |
---|---|---|---|
b7de519e47 | |||
5c0edf982a | |||
d679e8710d |
10
src/m68k.rs
10
src/m68k.rs
@ -36,11 +36,11 @@ pub enum BusErrorCause {
|
||||
impl Display for BusErrorCause {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
BusErrorCause::ReadingByte => f.write_str("reading byte from"),
|
||||
BusErrorCause::ReadingWord => f.write_str("reading word from"),
|
||||
BusErrorCause::WritingByte => f.write_str("writing byte to"),
|
||||
BusErrorCause::WritingWord => f.write_str("writing word to"),
|
||||
BusErrorCause::ReadingInstruction => f.write_str("reading instruction at"),
|
||||
Self::ReadingByte => f.write_str("reading byte from"),
|
||||
Self::ReadingWord => f.write_str("reading word from"),
|
||||
Self::WritingByte => f.write_str("writing byte to"),
|
||||
Self::WritingWord => f.write_str("writing word to"),
|
||||
Self::ReadingInstruction => f.write_str("reading instruction at"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
src/rom.rs
12
src/rom.rs
@ -81,8 +81,8 @@ impl Card for Rom {
|
||||
match address {
|
||||
(0..=0xEF) => NullableResult::Ok(self.ram[address as usize]),
|
||||
(0xF0..=0xF1) => NullableResult::Ok(u16_get_be_byte(self.start, address - 0xF0)),
|
||||
0xF2 => NullableResult::Ok(self.enabled as u8),
|
||||
(0xFE..=0xFF) => NullableResult::Ok(u16_get_be_byte(ID, address - 0xFE)),
|
||||
0xF3 => NullableResult::Ok(self.enabled as u8),
|
||||
(0xFE..=0xFF) => NullableResult::Ok(u16_get_be_byte(0x1, address - 0xFE)),
|
||||
_ => NullableResult::Null,
|
||||
}
|
||||
}
|
||||
@ -95,7 +95,7 @@ impl Card for Rom {
|
||||
(0xF0..=0xF1) => {
|
||||
self.start = u16_set_be_byte(self.start, address - 0xF0, data);
|
||||
}
|
||||
0xF2 => {
|
||||
0xF3 => {
|
||||
self.enabled = data > 0;
|
||||
}
|
||||
_ => (),
|
||||
@ -114,11 +114,11 @@ impl Card for Rom {
|
||||
println!("Read ROM image file {}", cmd[1]);
|
||||
} else if cmd[0] == "reload" {
|
||||
if let Some(file_name) = &self.file_name {
|
||||
let mut file = File::open(cmd[1])
|
||||
.map_err(|e| anyhow!("Couldn't open ROM image file {} ({})", cmd[1], e))?;
|
||||
let mut file = File::open(file_name)
|
||||
.map_err(|e| anyhow!("Couldn't open ROM image file {} ({})", file_name, e))?;
|
||||
self.data.clear();
|
||||
file.read_to_end(&mut self.data)
|
||||
.map_err(|e| anyhow!("Failed to read ROM image file {} ({})", cmd[1], e))?;
|
||||
.map_err(|e| anyhow!("Failed to read ROM image file {} ({})", file_name, e))?;
|
||||
println!("Reloaded ROM image file {}", file_name);
|
||||
} else {
|
||||
println!("No ROM image file to reload");
|
||||
|
Loading…
Reference in New Issue
Block a user