Monotonic: This flag is being deprecated soon, switch it for bool
This commit is contained in:
parent
a16d7fe732
commit
ea357be477
@ -145,7 +145,6 @@ impl State {
|
|||||||
quirks: options.mode.unwrap_or_default().into(),
|
quirks: options.mode.unwrap_or_default().into(),
|
||||||
debug: options.debug,
|
debug: options.debug,
|
||||||
pause: options.pause,
|
pause: options.pause,
|
||||||
monotonic: options.speed,
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)?,
|
)?,
|
||||||
|
@ -451,7 +451,7 @@ impl CPU {
|
|||||||
/// # use chirp::error::Error;
|
/// # use chirp::error::Error;
|
||||||
/// let mut cpu = CPU::default();
|
/// let mut cpu = CPU::default();
|
||||||
/// # cpu.flags.debug = true; // enable live disassembly
|
/// # 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!{
|
/// let mut bus = bus!{
|
||||||
/// Program [0x0200..0x0f00] = &[
|
/// Program [0x0200..0x0f00] = &[
|
||||||
/// 0xff, 0xff, // invalid!
|
/// 0xff, 0xff, // invalid!
|
||||||
@ -466,7 +466,7 @@ impl CPU {
|
|||||||
// Do nothing if paused
|
// Do nothing if paused
|
||||||
if self.flags.is_paused() {
|
if self.flags.is_paused() {
|
||||||
// always tick in test mode
|
// always tick in test mode
|
||||||
if self.flags.monotonic.is_some() {
|
if self.flags.monotonic {
|
||||||
self.cycle += 1;
|
self.cycle += 1;
|
||||||
}
|
}
|
||||||
return Ok(self);
|
return Ok(self);
|
||||||
|
@ -23,8 +23,8 @@ pub struct Flags {
|
|||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
/// Represents the set of emulator [Quirks] to enable, independent of the [Mode]
|
/// Represents the set of emulator [Quirks] to enable, independent of the [Mode]
|
||||||
pub quirks: Quirks,
|
pub quirks: Quirks,
|
||||||
/// Represents the number of instructions to run per tick of the internal timer
|
/// Set when the interpreter should increase the cycle count during a pause
|
||||||
pub monotonic: Option<usize>,
|
pub monotonic: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Flags {
|
impl Flags {
|
||||||
|
@ -27,7 +27,6 @@ fn setup_environment() -> (CPU, Bus) {
|
|||||||
flags: Flags {
|
flags: Flags {
|
||||||
debug: true,
|
debug: true,
|
||||||
pause: false,
|
pause: false,
|
||||||
monotonic: Some(8),
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..CPU::default()
|
..CPU::default()
|
||||||
@ -1076,8 +1075,8 @@ mod behavior {
|
|||||||
#[test]
|
#[test]
|
||||||
fn delay() {
|
fn delay() {
|
||||||
let (mut cpu, mut bus) = setup_environment();
|
let (mut cpu, mut bus) = setup_environment();
|
||||||
cpu.flags.monotonic = None;
|
|
||||||
cpu.delay = 10.0;
|
cpu.delay = 10.0;
|
||||||
|
cpu.flags.monotonic = false;
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
cpu.multistep(&mut bus, 8)
|
cpu.multistep(&mut bus, 8)
|
||||||
.expect("Running valid instructions should always succeed");
|
.expect("Running valid instructions should always succeed");
|
||||||
@ -1102,7 +1101,7 @@ mod behavior {
|
|||||||
#[test]
|
#[test]
|
||||||
fn vbi_wait() {
|
fn vbi_wait() {
|
||||||
let (mut cpu, mut bus) = setup_environment();
|
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;
|
cpu.flags.draw_wait = true;
|
||||||
for _ in 0..2 {
|
for _ in 0..2 {
|
||||||
cpu.multistep(&mut bus, 8)
|
cpu.multistep(&mut bus, 8)
|
||||||
|
@ -133,7 +133,6 @@ mod cpu {
|
|||||||
pause: false,
|
pause: false,
|
||||||
keypause: false,
|
keypause: false,
|
||||||
draw_wait: false,
|
draw_wait: false,
|
||||||
monotonic: None,
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let cf2 = cf1.clone();
|
let cf2 = cf1.clone();
|
||||||
|
Loading…
Reference in New Issue
Block a user