remove stinky statics

This commit is contained in:
Alex Janka 2023-04-06 14:53:26 +10:00
parent b06743c82e
commit e82baab292
2 changed files with 1 additions and 22 deletions

View file

@ -19,16 +19,12 @@ use std::{
str::FromStr,
sync::{mpsc::Receiver, Arc, Mutex},
};
use util::pause_then_step;
pub mod connect;
mod constants;
mod processor;
pub mod util;
static mut PAUSE_ENABLED: bool = false;
static mut PAUSE_QUEUED: bool = false;
static VERBOSE: OnceCell<bool> = OnceCell::new();
pub const WIDTH: usize = 160;
@ -153,15 +149,7 @@ where
}
fn run_cycle(&mut self) {
let will_pause = unsafe { PAUSE_QUEUED };
let pause_enabled = unsafe { PAUSE_ENABLED };
self.cpu.exec_next();
if !pause_enabled && self.cpu.reg.pc >= 0x100 {
unsafe { PAUSE_ENABLED = true };
}
if will_pause {
pause_then_step();
}
}
fn process_messages(&mut self) {

View file

@ -1,6 +1,6 @@
use crate::{
processor::{memory::mmio::gpu::Colour, Direction},
PAUSE_ENABLED, PAUSE_QUEUED, VERBOSE,
VERBOSE,
};
use std::{io, mem::transmute};
@ -22,15 +22,6 @@ macro_rules! verbose_print {
};
}
pub(crate) fn pause_then_step() {
unsafe {
if PAUSE_ENABLED {
let line = pause();
PAUSE_QUEUED = !line.contains("continue");
}
}
}
pub(crate) fn pause() -> String {
let mut line = String::new();
match io::stdin().read_line(&mut line) {