tests: Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.

This commit is contained in:
2023-03-28 08:57:24 -05:00
parent f2f47e13d4
commit 83c178413d
4 changed files with 193 additions and 10 deletions

View File

@@ -51,10 +51,15 @@ pub trait Write<T> {
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Region {
/// Character ROM (but writable!)
Charset,
/// Program memory
Program,
/// Screen buffer
Screen,
/// Stack space
Stack,
/// Total number of named regions
Count,
}
@@ -191,6 +196,17 @@ impl Bus {
///# Ok(())
///# }
/// ```
/// If the region doesn't exist, that's okay.
/// ```rust
///# use chirp::prelude::*;
///# fn main() -> Result<()> {
/// let bus = Bus::new()
/// .add_region(Program, 0..1234)
/// .clear_region(Screen);
///# // TODO: test if region actually clear
///# Ok(())
///# }
/// ```
pub fn clear_region(&mut self, name: Region) -> &mut Self {
if let Some(region) = self.get_region_mut(name) {
region.fill(0)

View File

@@ -314,6 +314,20 @@ impl CPU {
self
}
/// Gets a slice of breakpoints
/// # Examples
/// ```rust
///# use chirp::prelude::*;
///# fn main() -> Result<()> {
/// let mut cpu = CPU::default();
/// assert_eq!(cpu.breakpoints(), &[]);
///# Ok(())
///# }
/// ```
pub fn breakpoints(&self) -> &[Adr] {
&self.breakpoints.as_slice()
}
/// Unpauses the emulator for a single tick,
/// even if cpu.flags.pause is set.
///

View File

@@ -171,7 +171,7 @@ impl Disassemble {
0x65 => self.dma_load(x),
_ => self.unimplemented(opcode),
},
_ => unimplemented!("Extracted nibble from byte, got >nibble?"),
_ => unreachable!("Extracted nibble from byte, got >nibble?"),
}
}
}