Monotonic: This flag is being deprecated soon, switch it for bool

This commit is contained in:
John 2023-04-29 18:20:49 -05:00
parent a16d7fe732
commit ea357be477
5 changed files with 6 additions and 9 deletions

View File

@ -145,7 +145,6 @@ impl State {
quirks: options.mode.unwrap_or_default().into(),
debug: options.debug,
pause: options.pause,
monotonic: options.speed,
..Default::default()
},
)?,

View File

@ -451,7 +451,7 @@ impl CPU {
/// # use chirp::error::Error;
/// let mut cpu = CPU::default();
/// # cpu.flags.debug = true; // enable live disassembly
/// # cpu.flags.monotonic = Some(8); // enable monotonic/test timing
/// # cpu.flags.monotonic = true; // enable monotonic/test timing
/// let mut bus = bus!{
/// Program [0x0200..0x0f00] = &[
/// 0xff, 0xff, // invalid!
@ -466,7 +466,7 @@ impl CPU {
// Do nothing if paused
if self.flags.is_paused() {
// always tick in test mode
if self.flags.monotonic.is_some() {
if self.flags.monotonic {
self.cycle += 1;
}
return Ok(self);

View File

@ -23,8 +23,8 @@ pub struct Flags {
pub mode: Mode,
/// Represents the set of emulator [Quirks] to enable, independent of the [Mode]
pub quirks: Quirks,
/// Represents the number of instructions to run per tick of the internal timer
pub monotonic: Option<usize>,
/// Set when the interpreter should increase the cycle count during a pause
pub monotonic: bool,
}
impl Flags {

View File

@ -27,7 +27,6 @@ fn setup_environment() -> (CPU, Bus) {
flags: Flags {
debug: true,
pause: false,
monotonic: Some(8),
..Default::default()
},
..CPU::default()
@ -1076,8 +1075,8 @@ mod behavior {
#[test]
fn delay() {
let (mut cpu, mut bus) = setup_environment();
cpu.flags.monotonic = None;
cpu.delay = 10.0;
cpu.flags.monotonic = false;
for _ in 0..2 {
cpu.multistep(&mut bus, 8)
.expect("Running valid instructions should always succeed");
@ -1102,7 +1101,7 @@ mod behavior {
#[test]
fn vbi_wait() {
let (mut cpu, mut bus) = setup_environment();
cpu.flags.monotonic = None; // disable monotonic timing
cpu.flags.monotonic = false; // disable monotonic timing
cpu.flags.draw_wait = true;
for _ in 0..2 {
cpu.multistep(&mut bus, 8)

View File

@ -133,7 +133,6 @@ mod cpu {
pause: false,
keypause: false,
draw_wait: false,
monotonic: None,
..Default::default()
};
let cf2 = cf1.clone();