get rid of cycle_count
This commit is contained in:
parent
bfb4772536
commit
962b2af282
|
@ -82,7 +82,6 @@ fn main() {
|
||||||
bootrom: args.bootrom.map(RomFile::Path),
|
bootrom: args.bootrom.map(RomFile::Path),
|
||||||
connect_serial: args.connect_serial,
|
connect_serial: args.connect_serial,
|
||||||
verbose: args.verbose,
|
verbose: args.verbose,
|
||||||
cycle_count: args.cycle_count,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let tile_window: Option<Box<dyn Renderer<u32>>> = if args.tile_window {
|
let tile_window: Option<Box<dyn Renderer<u32>>> = if args.tile_window {
|
||||||
|
|
|
@ -125,7 +125,6 @@ impl Plugin for GameboyEmu {
|
||||||
bootrom,
|
bootrom,
|
||||||
connect_serial: false,
|
connect_serial: false,
|
||||||
verbose: false,
|
verbose: false,
|
||||||
cycle_count: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(ref mut vars) = self.vars {
|
if let Some(ref mut vars) = self.vars {
|
||||||
|
|
|
@ -29,7 +29,6 @@ pub struct Options {
|
||||||
pub bootrom: Option<RomFile>,
|
pub bootrom: Option<RomFile>,
|
||||||
pub connect_serial: bool,
|
pub connect_serial: bool,
|
||||||
pub verbose: bool,
|
pub verbose: bool,
|
||||||
pub cycle_count: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut PAUSE_ENABLED: bool = false;
|
static mut PAUSE_ENABLED: bool = false;
|
||||||
|
@ -43,8 +42,6 @@ pub const HEIGHT: usize = 144;
|
||||||
pub struct EmulatorCore<ColourFormat: From<Colour> + Clone> {
|
pub struct EmulatorCore<ColourFormat: From<Colour> + Clone> {
|
||||||
receiver: Receiver<EmulatorMessage>,
|
receiver: Receiver<EmulatorMessage>,
|
||||||
cpu: Cpu<ColourFormat>,
|
cpu: Cpu<ColourFormat>,
|
||||||
cycle_num: usize,
|
|
||||||
cycle_count: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<ColourFormat: From<Colour> + Clone> EmulatorCore<ColourFormat> {
|
impl<ColourFormat: From<Colour> + Clone> EmulatorCore<ColourFormat> {
|
||||||
|
@ -110,17 +107,11 @@ impl<ColourFormat: From<Colour> + Clone> EmulatorCore<ColourFormat> {
|
||||||
),
|
),
|
||||||
bootrom_enabled,
|
bootrom_enabled,
|
||||||
),
|
),
|
||||||
options.cycle_count,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(receiver: Receiver<EmulatorMessage>, cpu: Cpu<ColourFormat>, cycle_count: bool) -> Self {
|
fn new(receiver: Receiver<EmulatorMessage>, cpu: Cpu<ColourFormat>) -> Self {
|
||||||
Self {
|
Self { receiver, cpu }
|
||||||
receiver,
|
|
||||||
cpu,
|
|
||||||
cycle_num: 0,
|
|
||||||
cycle_count,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn replace_output(&mut self, new: AudioOutput) {
|
pub fn replace_output(&mut self, new: AudioOutput) {
|
||||||
|
@ -129,10 +120,6 @@ impl<ColourFormat: From<Colour> + Clone> EmulatorCore<ColourFormat> {
|
||||||
|
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
self.process_messages();
|
self.process_messages();
|
||||||
self.cycle_num += 1;
|
|
||||||
if self.cycle_count {
|
|
||||||
self.print_cycles();
|
|
||||||
}
|
|
||||||
self.run_cycle();
|
self.run_cycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,16 +127,8 @@ impl<ColourFormat: From<Colour> + Clone> EmulatorCore<ColourFormat> {
|
||||||
loop {
|
loop {
|
||||||
self.process_messages();
|
self.process_messages();
|
||||||
for _ in 0..step_size {
|
for _ in 0..step_size {
|
||||||
self.cycle_num += 1;
|
|
||||||
if self.cycle_count {
|
|
||||||
self.print_cycles();
|
|
||||||
}
|
|
||||||
self.run_cycle();
|
self.run_cycle();
|
||||||
}
|
}
|
||||||
print!(
|
|
||||||
" ...{} cycles - press enter to continue\r",
|
|
||||||
self.cycle_num
|
|
||||||
);
|
|
||||||
stdout().flush().unwrap();
|
stdout().flush().unwrap();
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
|
@ -183,17 +162,4 @@ impl<ColourFormat: From<Colour> + Clone> EmulatorCore<ColourFormat> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_cycles(&self) {
|
|
||||||
if self.cycle_num % 45678 != 0 {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let instructions_per_second = 400000;
|
|
||||||
print!(
|
|
||||||
"cycle {} - approx {} seconds on real hardware\r",
|
|
||||||
self.cycle_num,
|
|
||||||
self.cycle_num / instructions_per_second
|
|
||||||
);
|
|
||||||
stdout().flush().unwrap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue