tests: Further improvements to overall system stability and other minor adjustments have been made to enhance the user experience.
This commit is contained in:
		
							
								
								
									
										16
									
								
								src/bus.rs
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/bus.rs
									
									
									
									
									
								
							| @@ -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) | ||||
|   | ||||
							
								
								
									
										14
									
								
								src/cpu.rs
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								src/cpu.rs
									
									
									
									
									
								
							| @@ -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. | ||||
|     /// | ||||
|   | ||||
| @@ -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?"), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user